~ubuntu-branches/ubuntu/saucy/libv8/saucy

« back to all changes in this revision

Viewing changes to src/ia32/ic-ia32.cc

  • Committer: Package Import Robot
  • Author(s): Jérémy Lal
  • Date: 2012-04-07 16:26:13 UTC
  • mfrom: (15.1.27 sid)
  • Revision ID: package-import@ubuntu.com-20120407162613-dqo1m6w9r3fh8tst
Tags: 3.8.9.16-3
* mipsel build fixes :
  + v8_use_mips_abi_hardfloat=false, this lowers EABI requirements.
  + v8_can_use_fpu_instructions=false, detect if FPU is present.
  + set -Wno-unused-but-set-variable only on mipsel.

Show diffs side-by-side

added added

removed removed

Lines of Context:
473
473
  Counters* counters = isolate->counters();
474
474
  __ IncrementCounter(counters->keyed_load_generic_smi(), 1);
475
475
  __ ret(0);
476
 
 
477
476
  __ bind(&check_number_dictionary);
478
477
  __ mov(ebx, eax);
479
478
  __ SmiUntag(ebx);
535
534
  __ mov(edi, FieldOperand(eax, String::kHashFieldOffset));
536
535
  __ shr(edi, String::kHashShift);
537
536
  __ xor_(ecx, edi);
538
 
  __ and_(ecx, KeyedLookupCache::kCapacityMask);
 
537
  __ and_(ecx, KeyedLookupCache::kCapacityMask & KeyedLookupCache::kHashMask);
539
538
 
540
539
  // Load the key (consisting of map and symbol) from the cache and
541
540
  // check for match.
 
541
  Label load_in_object_property;
 
542
  static const int kEntriesPerBucket = KeyedLookupCache::kEntriesPerBucket;
 
543
  Label hit_on_nth_entry[kEntriesPerBucket];
542
544
  ExternalReference cache_keys =
543
545
      ExternalReference::keyed_lookup_cache_keys(masm->isolate());
544
 
  __ mov(edi, ecx);
 
546
 
 
547
  for (int i = 0; i < kEntriesPerBucket - 1; i++) {
 
548
    Label try_next_entry;
 
549
    __ mov(edi, ecx);
 
550
    __ shl(edi, kPointerSizeLog2 + 1);
 
551
    if (i != 0) {
 
552
      __ add(edi, Immediate(kPointerSize * i * 2));
 
553
    }
 
554
    __ cmp(ebx, Operand::StaticArray(edi, times_1, cache_keys));
 
555
    __ j(not_equal, &try_next_entry);
 
556
    __ add(edi, Immediate(kPointerSize));
 
557
    __ cmp(eax, Operand::StaticArray(edi, times_1, cache_keys));
 
558
    __ j(equal, &hit_on_nth_entry[i]);
 
559
    __ bind(&try_next_entry);
 
560
  }
 
561
 
 
562
  __ lea(edi, Operand(ecx, 1));
545
563
  __ shl(edi, kPointerSizeLog2 + 1);
 
564
  __ add(edi, Immediate(kPointerSize * (kEntriesPerBucket - 1) * 2));
546
565
  __ cmp(ebx, Operand::StaticArray(edi, times_1, cache_keys));
547
566
  __ j(not_equal, &slow);
548
567
  __ add(edi, Immediate(kPointerSize));
556
575
  // ecx     : lookup cache index
557
576
  ExternalReference cache_field_offsets =
558
577
      ExternalReference::keyed_lookup_cache_field_offsets(masm->isolate());
559
 
  __ mov(edi,
560
 
         Operand::StaticArray(ecx, times_pointer_size, cache_field_offsets));
561
 
  __ movzx_b(ecx, FieldOperand(ebx, Map::kInObjectPropertiesOffset));
562
 
  __ sub(edi, ecx);
563
 
  __ j(above_equal, &property_array_property);
 
578
 
 
579
  // Hit on nth entry.
 
580
  for (int i = kEntriesPerBucket - 1; i >= 0; i--) {
 
581
    __ bind(&hit_on_nth_entry[i]);
 
582
    if (i != 0) {
 
583
      __ add(ecx, Immediate(i));
 
584
    }
 
585
    __ mov(edi,
 
586
           Operand::StaticArray(ecx, times_pointer_size, cache_field_offsets));
 
587
    __ movzx_b(ecx, FieldOperand(ebx, Map::kInObjectPropertiesOffset));
 
588
    __ sub(edi, ecx);
 
589
    __ j(above_equal, &property_array_property);
 
590
    if (i != 0) {
 
591
      __ jmp(&load_in_object_property);
 
592
    }
 
593
  }
564
594
 
565
595
  // Load in-object property.
 
596
  __ bind(&load_in_object_property);
566
597
  __ movzx_b(ecx, FieldOperand(ebx, Map::kInstanceSizeOffset));
567
598
  __ add(ecx, edi);
568
599
  __ mov(eax, FieldOperand(edx, ecx, times_pointer_size, 0));
1374
1405
  //  -- esp[0] : return address
1375
1406
  // -----------------------------------
1376
1407
  //
1377
 
  // This accepts as a receiver anything JSObject::SetElementsLength accepts
 
1408
  // This accepts as a receiver anything JSArray::SetElementsLength accepts
1378
1409
  // (currently anything except for external arrays which means anything with
1379
 
  // elements of FixedArray type.), but currently is restricted to JSArray.
1380
 
  // Value must be a number, but only smis are accepted as the most common case.
 
1410
  // elements of FixedArray type).  Value must be a number, but only smis are
 
1411
  // accepted as the most common case.
1381
1412
 
1382
1413
  Label miss;
1383
1414
 
1399
1430
  __ CmpObjectType(scratch, FIXED_ARRAY_TYPE, scratch);
1400
1431
  __ j(not_equal, &miss);
1401
1432
 
 
1433
  // Check that the array has fast properties, otherwise the length
 
1434
  // property might have been redefined.
 
1435
  __ mov(scratch, FieldOperand(receiver, JSArray::kPropertiesOffset));
 
1436
  __ CompareRoot(FieldOperand(scratch, FixedArray::kMapOffset),
 
1437
                 Heap::kHashTableMapRootIndex);
 
1438
  __ j(equal, &miss);
 
1439
 
1402
1440
  // Check that value is a smi.
1403
1441
  __ JumpIfNotSmi(value, &miss);
1404
1442
 
1625
1663
    rewritten = stub.GetCode();
1626
1664
  } else {
1627
1665
    ICCompareStub stub(op_, state);
 
1666
    if (state == KNOWN_OBJECTS) {
 
1667
      stub.set_known_map(Handle<Map>(Handle<JSObject>::cast(x)->map()));
 
1668
    }
1628
1669
    rewritten = stub.GetCode();
1629
1670
  }
1630
1671
  set_target(*rewritten);