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

« back to all changes in this revision

Viewing changes to src/x64/ic-x64.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:
462
462
  __ movl(rdi, FieldOperand(rax, String::kHashFieldOffset));
463
463
  __ shr(rdi, Immediate(String::kHashShift));
464
464
  __ xor_(rcx, rdi);
465
 
  __ and_(rcx, Immediate(KeyedLookupCache::kCapacityMask));
 
465
  int mask = (KeyedLookupCache::kCapacityMask & KeyedLookupCache::kHashMask);
 
466
  __ and_(rcx, Immediate(mask));
466
467
 
467
468
  // Load the key (consisting of map and symbol) from the cache and
468
469
  // check for match.
 
470
  Label load_in_object_property;
 
471
  static const int kEntriesPerBucket = KeyedLookupCache::kEntriesPerBucket;
 
472
  Label hit_on_nth_entry[kEntriesPerBucket];
469
473
  ExternalReference cache_keys
470
474
      = ExternalReference::keyed_lookup_cache_keys(masm->isolate());
471
 
  __ movq(rdi, rcx);
472
 
  __ shl(rdi, Immediate(kPointerSizeLog2 + 1));
473
 
  __ LoadAddress(kScratchRegister, cache_keys);
474
 
  __ cmpq(rbx, Operand(kScratchRegister, rdi, times_1, 0));
 
475
 
 
476
  for (int i = 0; i < kEntriesPerBucket - 1; i++) {
 
477
    Label try_next_entry;
 
478
    __ movq(rdi, rcx);
 
479
    __ shl(rdi, Immediate(kPointerSizeLog2 + 1));
 
480
    __ LoadAddress(kScratchRegister, cache_keys);
 
481
    int off = kPointerSize * i * 2;
 
482
    __ cmpq(rbx, Operand(kScratchRegister, rdi, times_1, off));
 
483
    __ j(not_equal, &try_next_entry);
 
484
    __ cmpq(rax, Operand(kScratchRegister, rdi, times_1, off + kPointerSize));
 
485
    __ j(equal, &hit_on_nth_entry[i]);
 
486
    __ bind(&try_next_entry);
 
487
  }
 
488
 
 
489
  int off = kPointerSize * (kEntriesPerBucket - 1) * 2;
 
490
  __ cmpq(rbx, Operand(kScratchRegister, rdi, times_1, off));
475
491
  __ j(not_equal, &slow);
476
 
  __ cmpq(rax, Operand(kScratchRegister, rdi, times_1, kPointerSize));
 
492
  __ cmpq(rax, Operand(kScratchRegister, rdi, times_1, off + kPointerSize));
477
493
  __ j(not_equal, &slow);
478
494
 
479
495
  // Get field offset, which is a 32-bit integer.
480
496
  ExternalReference cache_field_offsets
481
497
      = ExternalReference::keyed_lookup_cache_field_offsets(masm->isolate());
482
 
  __ LoadAddress(kScratchRegister, cache_field_offsets);
483
 
  __ movl(rdi, Operand(kScratchRegister, rcx, times_4, 0));
484
 
  __ movzxbq(rcx, FieldOperand(rbx, Map::kInObjectPropertiesOffset));
485
 
  __ subq(rdi, rcx);
486
 
  __ j(above_equal, &property_array_property);
 
498
 
 
499
  // Hit on nth entry.
 
500
  for (int i = kEntriesPerBucket - 1; i >= 0; i--) {
 
501
    __ bind(&hit_on_nth_entry[i]);
 
502
    if (i != 0) {
 
503
      __ addl(rcx, Immediate(i));
 
504
    }
 
505
    __ LoadAddress(kScratchRegister, cache_field_offsets);
 
506
    __ movl(rdi, Operand(kScratchRegister, rcx, times_4, 0));
 
507
    __ movzxbq(rcx, FieldOperand(rbx, Map::kInObjectPropertiesOffset));
 
508
    __ subq(rdi, rcx);
 
509
    __ j(above_equal, &property_array_property);
 
510
    if (i != 0) {
 
511
      __ jmp(&load_in_object_property);
 
512
    }
 
513
  }
487
514
 
488
515
  // Load in-object property.
 
516
  __ bind(&load_in_object_property);
489
517
  __ movzxbq(rcx, FieldOperand(rbx, Map::kInstanceSizeOffset));
490
518
  __ addq(rcx, rdi);
491
519
  __ movq(rax, FieldOperand(rdx, rcx, times_pointer_size, 0));
1397
1425
  //  -- rsp[0] : return address
1398
1426
  // -----------------------------------
1399
1427
  //
1400
 
  // This accepts as a receiver anything JSObject::SetElementsLength accepts
1401
 
  // (currently anything except for external and pixel arrays which means
1402
 
  // anything with elements of FixedArray type.), but currently is restricted
1403
 
  // to JSArray.
1404
 
  // Value must be a number, but only smis are accepted as the most common case.
 
1428
  // This accepts as a receiver anything JSArray::SetElementsLength accepts
 
1429
  // (currently anything except for external arrays which means anything with
 
1430
  // elements of FixedArray type).  Value must be a number, but only smis are
 
1431
  // accepted as the most common case.
1405
1432
 
1406
1433
  Label miss;
1407
1434
 
1423
1450
  __ CmpObjectType(scratch, FIXED_ARRAY_TYPE, scratch);
1424
1451
  __ j(not_equal, &miss);
1425
1452
 
 
1453
  // Check that the array has fast properties, otherwise the length
 
1454
  // property might have been redefined.
 
1455
  __ movq(scratch, FieldOperand(receiver, JSArray::kPropertiesOffset));
 
1456
  __ CompareRoot(FieldOperand(scratch, FixedArray::kMapOffset),
 
1457
                 Heap::kHashTableMapRootIndex);
 
1458
  __ j(equal, &miss);
 
1459
 
1426
1460
  // Check that value is a smi.
1427
1461
  __ JumpIfNotSmi(value, &miss);
1428
1462
 
1641
1675
    rewritten = stub.GetCode();
1642
1676
  } else {
1643
1677
    ICCompareStub stub(op_, state);
 
1678
    if (state == KNOWN_OBJECTS) {
 
1679
      stub.set_known_map(Handle<Map>(Handle<JSObject>::cast(x)->map()));
 
1680
    }
1644
1681
    rewritten = stub.GetCode();
1645
1682
  }
1646
1683
  set_target(*rewritten);