|
@ -56,18 +56,20 @@ static void GenerateDictionaryLoad(MacroAssembler* masm, |
|
|
Register r1, |
|
|
Register r1, |
|
|
Register r2, |
|
|
Register r2, |
|
|
Register name, |
|
|
Register name, |
|
|
|
|
|
Register r4, |
|
|
DictionaryCheck check_dictionary) { |
|
|
DictionaryCheck check_dictionary) { |
|
|
// Register use:
|
|
|
// Register use:
|
|
|
//
|
|
|
//
|
|
|
// r0 - used to hold the property dictionary.
|
|
|
// r0 - used to hold the property dictionary.
|
|
|
//
|
|
|
//
|
|
|
// r1 - initially the receiver
|
|
|
// r1 - initially the receiver.
|
|
|
// - used for the index into the property dictionary
|
|
|
// - unchanged on any jump to miss_label.
|
|
|
// - holds the result on exit.
|
|
|
// - holds the result on exit.
|
|
|
//
|
|
|
//
|
|
|
// r2 - used to hold the capacity of the property dictionary.
|
|
|
// r2 - used to hold the capacity of the property dictionary.
|
|
|
//
|
|
|
//
|
|
|
// name - holds the name of the property and is unchanged.
|
|
|
// name - holds the name of the property and is unchanged.
|
|
|
|
|
|
// r4 - used to hold the index into the property dictionary.
|
|
|
|
|
|
|
|
|
Label done; |
|
|
Label done; |
|
|
|
|
|
|
|
@ -116,19 +118,19 @@ static void GenerateDictionaryLoad(MacroAssembler* masm, |
|
|
StringDictionary::kElementsStartIndex * kPointerSize; |
|
|
StringDictionary::kElementsStartIndex * kPointerSize; |
|
|
for (int i = 0; i < kProbes; i++) { |
|
|
for (int i = 0; i < kProbes; i++) { |
|
|
// Compute the masked index: (hash + i + i * i) & mask.
|
|
|
// Compute the masked index: (hash + i + i * i) & mask.
|
|
|
__ movl(r1, FieldOperand(name, String::kHashFieldOffset)); |
|
|
__ movl(r4, FieldOperand(name, String::kHashFieldOffset)); |
|
|
__ shrl(r1, Immediate(String::kHashShift)); |
|
|
__ shrl(r4, Immediate(String::kHashShift)); |
|
|
if (i > 0) { |
|
|
if (i > 0) { |
|
|
__ addl(r1, Immediate(StringDictionary::GetProbeOffset(i))); |
|
|
__ addl(r4, Immediate(StringDictionary::GetProbeOffset(i))); |
|
|
} |
|
|
} |
|
|
__ and_(r1, r2); |
|
|
__ and_(r4, r2); |
|
|
|
|
|
|
|
|
// Scale the index by multiplying by the entry size.
|
|
|
// Scale the index by multiplying by the entry size.
|
|
|
ASSERT(StringDictionary::kEntrySize == 3); |
|
|
ASSERT(StringDictionary::kEntrySize == 3); |
|
|
__ lea(r1, Operand(r1, r1, times_2, 0)); // r1 = r1 * 3
|
|
|
__ lea(r4, Operand(r4, r4, times_2, 0)); // r4 = r4 * 3
|
|
|
|
|
|
|
|
|
// Check if the key is identical to the name.
|
|
|
// Check if the key is identical to the name.
|
|
|
__ cmpq(name, Operand(r0, r1, times_pointer_size, |
|
|
__ cmpq(name, Operand(r0, r4, times_pointer_size, |
|
|
kElementsStartOffset - kHeapObjectTag)); |
|
|
kElementsStartOffset - kHeapObjectTag)); |
|
|
if (i != kProbes - 1) { |
|
|
if (i != kProbes - 1) { |
|
|
__ j(equal, &done); |
|
|
__ j(equal, &done); |
|
@ -140,14 +142,14 @@ static void GenerateDictionaryLoad(MacroAssembler* masm, |
|
|
// Check that the value is a normal property.
|
|
|
// Check that the value is a normal property.
|
|
|
__ bind(&done); |
|
|
__ bind(&done); |
|
|
const int kDetailsOffset = kElementsStartOffset + 2 * kPointerSize; |
|
|
const int kDetailsOffset = kElementsStartOffset + 2 * kPointerSize; |
|
|
__ Test(Operand(r0, r1, times_pointer_size, kDetailsOffset - kHeapObjectTag), |
|
|
__ Test(Operand(r0, r4, times_pointer_size, kDetailsOffset - kHeapObjectTag), |
|
|
Smi::FromInt(PropertyDetails::TypeField::mask())); |
|
|
Smi::FromInt(PropertyDetails::TypeField::mask())); |
|
|
__ j(not_zero, miss_label); |
|
|
__ j(not_zero, miss_label); |
|
|
|
|
|
|
|
|
// Get the value at the masked, scaled index.
|
|
|
// Get the value at the masked, scaled index.
|
|
|
const int kValueOffset = kElementsStartOffset + kPointerSize; |
|
|
const int kValueOffset = kElementsStartOffset + kPointerSize; |
|
|
__ movq(r1, |
|
|
__ movq(r1, |
|
|
Operand(r0, r1, times_pointer_size, kValueOffset - kHeapObjectTag)); |
|
|
Operand(r0, r4, times_pointer_size, kValueOffset - kHeapObjectTag)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -311,14 +313,14 @@ void KeyedStoreIC::RestoreInlinedVersion(Address address) { |
|
|
|
|
|
|
|
|
void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { |
|
|
void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { |
|
|
// ----------- S t a t e -------------
|
|
|
// ----------- S t a t e -------------
|
|
|
|
|
|
// -- rax : key
|
|
|
|
|
|
// -- rdx : receiver
|
|
|
// -- rsp[0] : return address
|
|
|
// -- rsp[0] : return address
|
|
|
// -- rsp[8] : name
|
|
|
|
|
|
// -- rsp[16] : receiver
|
|
|
|
|
|
// -----------------------------------
|
|
|
// -----------------------------------
|
|
|
|
|
|
|
|
|
__ pop(rbx); |
|
|
__ pop(rbx); |
|
|
__ push(Operand(rsp, 1 * kPointerSize)); // receiver
|
|
|
__ push(rdx); // receiver
|
|
|
__ push(Operand(rsp, 1 * kPointerSize)); // name
|
|
|
__ push(rax); // name
|
|
|
__ push(rbx); // return address
|
|
|
__ push(rbx); // return address
|
|
|
|
|
|
|
|
|
// Perform tail call to the entry.
|
|
|
// Perform tail call to the entry.
|
|
@ -329,14 +331,14 @@ void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { |
|
|
|
|
|
|
|
|
void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
|
|
void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
|
|
// ----------- S t a t e -------------
|
|
|
// ----------- S t a t e -------------
|
|
|
|
|
|
// -- rax : key
|
|
|
|
|
|
// -- rdx : receiver
|
|
|
// -- rsp[0] : return address
|
|
|
// -- rsp[0] : return address
|
|
|
// -- rsp[8] : name
|
|
|
|
|
|
// -- rsp[16] : receiver
|
|
|
|
|
|
// -----------------------------------
|
|
|
// -----------------------------------
|
|
|
|
|
|
|
|
|
__ pop(rbx); |
|
|
__ pop(rbx); |
|
|
__ push(Operand(rsp, 1 * kPointerSize)); // receiver
|
|
|
__ push(rdx); // receiver
|
|
|
__ push(Operand(rsp, 1 * kPointerSize)); // name
|
|
|
__ push(rax); // name
|
|
|
__ push(rbx); // return address
|
|
|
__ push(rbx); // return address
|
|
|
|
|
|
|
|
|
// Perform tail call to the entry.
|
|
|
// Perform tail call to the entry.
|
|
@ -346,40 +348,35 @@ void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
|
|
|
|
|
|
|
|
void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { |
|
|
void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { |
|
|
// ----------- S t a t e -------------
|
|
|
// ----------- S t a t e -------------
|
|
|
|
|
|
// -- rax : key
|
|
|
|
|
|
// -- rdx : receiver
|
|
|
// -- rsp[0] : return address
|
|
|
// -- rsp[0] : return address
|
|
|
// -- rsp[8] : name
|
|
|
|
|
|
// -- rsp[16] : receiver
|
|
|
|
|
|
// -----------------------------------
|
|
|
// -----------------------------------
|
|
|
Label slow, check_string, index_smi, index_string; |
|
|
Label slow, check_string, index_smi, index_string; |
|
|
Label check_pixel_array, probe_dictionary; |
|
|
Label check_pixel_array, probe_dictionary, check_number_dictionary; |
|
|
Label check_number_dictionary; |
|
|
|
|
|
|
|
|
|
|
|
// Load name and receiver.
|
|
|
|
|
|
__ movq(rax, Operand(rsp, kPointerSize)); |
|
|
|
|
|
__ movq(rcx, Operand(rsp, 2 * kPointerSize)); |
|
|
|
|
|
|
|
|
|
|
|
// Check that the object isn't a smi.
|
|
|
// Check that the object isn't a smi.
|
|
|
__ JumpIfSmi(rcx, &slow); |
|
|
__ JumpIfSmi(rdx, &slow); |
|
|
|
|
|
|
|
|
// Check that the object is some kind of JS object EXCEPT JS Value type.
|
|
|
// Check that the object is some kind of JS object EXCEPT JS Value type.
|
|
|
// In the case that the object is a value-wrapper object,
|
|
|
// In the case that the object is a value-wrapper object,
|
|
|
// we enter the runtime system to make sure that indexing
|
|
|
// we enter the runtime system to make sure that indexing
|
|
|
// into string objects work as intended.
|
|
|
// into string objects work as intended.
|
|
|
ASSERT(JS_OBJECT_TYPE > JS_VALUE_TYPE); |
|
|
ASSERT(JS_OBJECT_TYPE > JS_VALUE_TYPE); |
|
|
__ CmpObjectType(rcx, JS_OBJECT_TYPE, rdx); |
|
|
__ CmpObjectType(rdx, JS_OBJECT_TYPE, rcx); |
|
|
__ j(below, &slow); |
|
|
__ j(below, &slow); |
|
|
|
|
|
|
|
|
// Check bit field.
|
|
|
// Check bit field.
|
|
|
__ testb(FieldOperand(rdx, Map::kBitFieldOffset), |
|
|
__ testb(FieldOperand(rcx, Map::kBitFieldOffset), |
|
|
Immediate(kSlowCaseBitFieldMask)); |
|
|
Immediate(kSlowCaseBitFieldMask)); |
|
|
__ j(not_zero, &slow); |
|
|
__ j(not_zero, &slow); |
|
|
|
|
|
|
|
|
// Check that the key is a smi.
|
|
|
// Check that the key is a smi.
|
|
|
__ JumpIfNotSmi(rax, &check_string); |
|
|
__ JumpIfNotSmi(rax, &check_string); |
|
|
|
|
|
|
|
|
// Get the elements array of the object.
|
|
|
|
|
|
__ bind(&index_smi); |
|
|
__ bind(&index_smi); |
|
|
__ movq(rcx, FieldOperand(rcx, JSObject::kElementsOffset)); |
|
|
// Now the key is known to be a smi. This place is also jumped to from below
|
|
|
|
|
|
// where a numeric string is converted to a smi.
|
|
|
|
|
|
__ movq(rcx, FieldOperand(rdx, JSObject::kElementsOffset)); |
|
|
// Check that the object is in fast mode (not dictionary).
|
|
|
// Check that the object is in fast mode (not dictionary).
|
|
|
__ CompareRoot(FieldOperand(rcx, HeapObject::kMapOffset), |
|
|
__ CompareRoot(FieldOperand(rcx, HeapObject::kMapOffset), |
|
|
Heap::kFixedArrayMapRootIndex); |
|
|
Heap::kFixedArrayMapRootIndex); |
|
@ -388,91 +385,99 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { |
|
|
__ SmiCompare(rax, FieldOperand(rcx, FixedArray::kLengthOffset)); |
|
|
__ SmiCompare(rax, FieldOperand(rcx, FixedArray::kLengthOffset)); |
|
|
__ j(above_equal, &slow); // Unsigned comparison rejects negative indices.
|
|
|
__ j(above_equal, &slow); // Unsigned comparison rejects negative indices.
|
|
|
// Fast case: Do the load.
|
|
|
// Fast case: Do the load.
|
|
|
SmiIndex index = masm->SmiToIndex(rax, rax, kPointerSizeLog2); |
|
|
SmiIndex index = masm->SmiToIndex(rbx, rax, kPointerSizeLog2); |
|
|
__ movq(rax, FieldOperand(rcx, |
|
|
__ movq(rbx, FieldOperand(rcx, |
|
|
index.reg, |
|
|
index.reg, |
|
|
index.scale, |
|
|
index.scale, |
|
|
FixedArray::kHeaderSize)); |
|
|
FixedArray::kHeaderSize)); |
|
|
__ CompareRoot(rax, Heap::kTheHoleValueRootIndex); |
|
|
__ CompareRoot(rbx, Heap::kTheHoleValueRootIndex); |
|
|
// In case the loaded value is the_hole we have to consult GetProperty
|
|
|
// In case the loaded value is the_hole we have to consult GetProperty
|
|
|
// to ensure the prototype chain is searched.
|
|
|
// to ensure the prototype chain is searched.
|
|
|
__ j(equal, &slow); |
|
|
__ j(equal, &slow); |
|
|
|
|
|
__ movq(rax, rbx); |
|
|
__ IncrementCounter(&Counters::keyed_load_generic_smi, 1); |
|
|
__ IncrementCounter(&Counters::keyed_load_generic_smi, 1); |
|
|
__ ret(0); |
|
|
__ ret(0); |
|
|
|
|
|
|
|
|
// Check whether the elements is a pixel array.
|
|
|
__ bind(&check_pixel_array); |
|
|
|
|
|
// Check whether the elements object is a pixel array.
|
|
|
|
|
|
// rdx: receiver
|
|
|
// rax: key
|
|
|
// rax: key
|
|
|
// rcx: elements array
|
|
|
// rcx: elements array
|
|
|
__ bind(&check_pixel_array); |
|
|
__ SmiToInteger32(rbx, rax); // Used on both directions of next branch.
|
|
|
__ CompareRoot(FieldOperand(rcx, HeapObject::kMapOffset), |
|
|
__ CompareRoot(FieldOperand(rcx, HeapObject::kMapOffset), |
|
|
Heap::kPixelArrayMapRootIndex); |
|
|
Heap::kPixelArrayMapRootIndex); |
|
|
__ j(not_equal, &check_number_dictionary); |
|
|
__ j(not_equal, &check_number_dictionary); |
|
|
__ SmiToInteger32(rax, rax); |
|
|
__ cmpl(rbx, FieldOperand(rcx, PixelArray::kLengthOffset)); |
|
|
__ cmpl(rax, FieldOperand(rcx, PixelArray::kLengthOffset)); |
|
|
|
|
|
__ j(above_equal, &slow); |
|
|
__ j(above_equal, &slow); |
|
|
__ movq(rcx, FieldOperand(rcx, PixelArray::kExternalPointerOffset)); |
|
|
__ movq(rax, FieldOperand(rcx, PixelArray::kExternalPointerOffset)); |
|
|
__ movzxbq(rax, Operand(rcx, rax, times_1, 0)); |
|
|
__ movzxbq(rax, Operand(rax, rbx, times_1, 0)); |
|
|
__ Integer32ToSmi(rax, rax); |
|
|
__ Integer32ToSmi(rax, rax); |
|
|
__ ret(0); |
|
|
__ ret(0); |
|
|
|
|
|
|
|
|
__ bind(&check_number_dictionary); |
|
|
__ bind(&check_number_dictionary); |
|
|
// Check whether the elements is a number dictionary.
|
|
|
// Check whether the elements is a number dictionary.
|
|
|
|
|
|
// rdx: receiver
|
|
|
// rax: key
|
|
|
// rax: key
|
|
|
|
|
|
// rbx: key as untagged int32
|
|
|
// rcx: elements
|
|
|
// rcx: elements
|
|
|
__ CompareRoot(FieldOperand(rcx, HeapObject::kMapOffset), |
|
|
__ CompareRoot(FieldOperand(rcx, HeapObject::kMapOffset), |
|
|
Heap::kHashTableMapRootIndex); |
|
|
Heap::kHashTableMapRootIndex); |
|
|
__ j(not_equal, &slow); |
|
|
__ j(not_equal, &slow); |
|
|
__ SmiToInteger32(rbx, rax); |
|
|
GenerateNumberDictionaryLoad(masm, &slow, rcx, rax, rbx, r9, rdi); |
|
|
GenerateNumberDictionaryLoad(masm, &slow, rcx, rax, rbx, rdx, rdi); |
|
|
|
|
|
__ ret(0); |
|
|
__ ret(0); |
|
|
|
|
|
|
|
|
// Slow case: Load name and receiver from stack and jump to runtime.
|
|
|
|
|
|
__ bind(&slow); |
|
|
__ bind(&slow); |
|
|
|
|
|
// Slow case: Jump to runtime.
|
|
|
|
|
|
// rdx: receiver
|
|
|
|
|
|
// rax: key
|
|
|
__ IncrementCounter(&Counters::keyed_load_generic_slow, 1); |
|
|
__ IncrementCounter(&Counters::keyed_load_generic_slow, 1); |
|
|
GenerateRuntimeGetProperty(masm); |
|
|
GenerateRuntimeGetProperty(masm); |
|
|
|
|
|
|
|
|
__ bind(&check_string); |
|
|
__ bind(&check_string); |
|
|
// The key is not a smi.
|
|
|
// The key is not a smi.
|
|
|
// Is it a string?
|
|
|
// Is it a string?
|
|
|
__ CmpObjectType(rax, FIRST_NONSTRING_TYPE, rdx); |
|
|
// rdx: receiver
|
|
|
|
|
|
// rax: key
|
|
|
|
|
|
__ CmpObjectType(rax, FIRST_NONSTRING_TYPE, rcx); |
|
|
__ j(above_equal, &slow); |
|
|
__ j(above_equal, &slow); |
|
|
// Is the string an array index, with cached numeric value?
|
|
|
// Is the string an array index, with cached numeric value?
|
|
|
__ movl(rbx, FieldOperand(rax, String::kHashFieldOffset)); |
|
|
__ movl(rbx, FieldOperand(rax, String::kHashFieldOffset)); |
|
|
__ testl(rbx, Immediate(String::kIsArrayIndexMask)); |
|
|
__ testl(rbx, Immediate(String::kContainsCachedArrayIndexMask)); |
|
|
|
|
|
__ j(zero, &index_string); // The value in rbx is used at jump target.
|
|
|
|
|
|
|
|
|
// Is the string a symbol?
|
|
|
// Is the string a symbol?
|
|
|
__ j(not_zero, &index_string); // The value in rbx is used at jump target.
|
|
|
|
|
|
ASSERT(kSymbolTag != 0); |
|
|
ASSERT(kSymbolTag != 0); |
|
|
__ testb(FieldOperand(rdx, Map::kInstanceTypeOffset), |
|
|
__ testb(FieldOperand(rcx, Map::kInstanceTypeOffset), |
|
|
Immediate(kIsSymbolMask)); |
|
|
Immediate(kIsSymbolMask)); |
|
|
__ j(zero, &slow); |
|
|
__ j(zero, &slow); |
|
|
|
|
|
|
|
|
// If the receiver is a fast-case object, check the keyed lookup
|
|
|
// If the receiver is a fast-case object, check the keyed lookup
|
|
|
// cache. Otherwise probe the dictionary leaving result in rcx.
|
|
|
// cache. Otherwise probe the dictionary leaving result in rcx.
|
|
|
__ movq(rbx, FieldOperand(rcx, JSObject::kPropertiesOffset)); |
|
|
__ movq(rbx, FieldOperand(rdx, JSObject::kPropertiesOffset)); |
|
|
__ Cmp(FieldOperand(rbx, HeapObject::kMapOffset), Factory::hash_table_map()); |
|
|
__ CompareRoot(FieldOperand(rbx, HeapObject::kMapOffset), |
|
|
|
|
|
Heap::kHashTableMapRootIndex); |
|
|
__ j(equal, &probe_dictionary); |
|
|
__ j(equal, &probe_dictionary); |
|
|
|
|
|
|
|
|
// Load the map of the receiver, compute the keyed lookup cache hash
|
|
|
// Load the map of the receiver, compute the keyed lookup cache hash
|
|
|
// based on 32 bits of the map pointer and the string hash.
|
|
|
// based on 32 bits of the map pointer and the string hash.
|
|
|
__ movq(rbx, FieldOperand(rcx, HeapObject::kMapOffset)); |
|
|
__ movq(rbx, FieldOperand(rdx, HeapObject::kMapOffset)); |
|
|
__ movl(rdx, rbx); |
|
|
__ movl(rcx, rbx); |
|
|
__ shr(rdx, Immediate(KeyedLookupCache::kMapHashShift)); |
|
|
__ shr(rcx, Immediate(KeyedLookupCache::kMapHashShift)); |
|
|
__ movl(rax, FieldOperand(rax, String::kHashFieldOffset)); |
|
|
__ movl(rdi, FieldOperand(rax, String::kHashFieldOffset)); |
|
|
__ shr(rax, Immediate(String::kHashShift)); |
|
|
__ shr(rdi, Immediate(String::kHashShift)); |
|
|
__ xor_(rdx, rax); |
|
|
__ xor_(rcx, rdi); |
|
|
__ and_(rdx, Immediate(KeyedLookupCache::kCapacityMask)); |
|
|
__ and_(rcx, Immediate(KeyedLookupCache::kCapacityMask)); |
|
|
|
|
|
|
|
|
// Load the key (consisting of map and symbol) from the cache and
|
|
|
// Load the key (consisting of map and symbol) from the cache and
|
|
|
// check for match.
|
|
|
// check for match.
|
|
|
ExternalReference cache_keys |
|
|
ExternalReference cache_keys |
|
|
= ExternalReference::keyed_lookup_cache_keys(); |
|
|
= ExternalReference::keyed_lookup_cache_keys(); |
|
|
__ movq(rdi, rdx); |
|
|
__ movq(rdi, rcx); |
|
|
__ shl(rdi, Immediate(kPointerSizeLog2 + 1)); |
|
|
__ shl(rdi, Immediate(kPointerSizeLog2 + 1)); |
|
|
__ movq(kScratchRegister, cache_keys); |
|
|
__ movq(kScratchRegister, cache_keys); |
|
|
__ cmpq(rbx, Operand(kScratchRegister, rdi, times_1, 0)); |
|
|
__ cmpq(rbx, Operand(kScratchRegister, rdi, times_1, 0)); |
|
|
__ j(not_equal, &slow); |
|
|
__ j(not_equal, &slow); |
|
|
__ movq(rdi, Operand(kScratchRegister, rdi, times_1, kPointerSize)); |
|
|
__ cmpq(rax, Operand(kScratchRegister, rdi, times_1, kPointerSize)); |
|
|
__ cmpq(Operand(rsp, kPointerSize), rdi); |
|
|
|
|
|
__ j(not_equal, &slow); |
|
|
__ j(not_equal, &slow); |
|
|
|
|
|
|
|
|
// Get field offset which is a 32-bit integer and check that it is
|
|
|
// Get field offset which is a 32-bit integer and check that it is
|
|
@ -480,29 +485,32 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { |
|
|
ExternalReference cache_field_offsets |
|
|
ExternalReference cache_field_offsets |
|
|
= ExternalReference::keyed_lookup_cache_field_offsets(); |
|
|
= ExternalReference::keyed_lookup_cache_field_offsets(); |
|
|
__ movq(kScratchRegister, cache_field_offsets); |
|
|
__ movq(kScratchRegister, cache_field_offsets); |
|
|
__ movl(rax, Operand(kScratchRegister, rdx, times_4, 0)); |
|
|
__ movl(rdi, Operand(kScratchRegister, rcx, times_4, 0)); |
|
|
__ movzxbq(rdx, FieldOperand(rbx, Map::kInObjectPropertiesOffset)); |
|
|
__ movzxbq(rcx, FieldOperand(rbx, Map::kInObjectPropertiesOffset)); |
|
|
__ cmpq(rax, rdx); |
|
|
__ subq(rdi, rcx); |
|
|
__ j(above_equal, &slow); |
|
|
__ j(above_equal, &slow); |
|
|
|
|
|
|
|
|
// Load in-object property.
|
|
|
// Load in-object property.
|
|
|
__ subq(rax, rdx); |
|
|
__ movzxbq(rcx, FieldOperand(rbx, Map::kInstanceSizeOffset)); |
|
|
__ movzxbq(rdx, FieldOperand(rbx, Map::kInstanceSizeOffset)); |
|
|
__ addq(rcx, rdi); |
|
|
__ addq(rax, rdx); |
|
|
__ movq(rax, FieldOperand(rdx, rcx, times_pointer_size, 0)); |
|
|
__ movq(rax, FieldOperand(rcx, rax, times_pointer_size, 0)); |
|
|
__ IncrementCounter(&Counters::keyed_load_generic_lookup_cache, 1); |
|
|
__ ret(0); |
|
|
__ ret(0); |
|
|
|
|
|
|
|
|
// Do a quick inline probe of the receiver's dictionary, if it
|
|
|
// Do a quick inline probe of the receiver's dictionary, if it
|
|
|
// exists.
|
|
|
// exists.
|
|
|
__ bind(&probe_dictionary); |
|
|
__ bind(&probe_dictionary); |
|
|
|
|
|
// rdx: receiver
|
|
|
|
|
|
// rax: key
|
|
|
GenerateDictionaryLoad(masm, |
|
|
GenerateDictionaryLoad(masm, |
|
|
&slow, |
|
|
&slow, |
|
|
rbx, |
|
|
rbx, |
|
|
rcx, |
|
|
|
|
|
rdx, |
|
|
rdx, |
|
|
|
|
|
rcx, |
|
|
rax, |
|
|
rax, |
|
|
|
|
|
rdi, |
|
|
DICTIONARY_CHECK_DONE); |
|
|
DICTIONARY_CHECK_DONE); |
|
|
__ movq(rax, rcx); |
|
|
__ movq(rax, rdx); |
|
|
__ IncrementCounter(&Counters::keyed_load_generic_symbol, 1); |
|
|
__ IncrementCounter(&Counters::keyed_load_generic_symbol, 1); |
|
|
__ ret(0); |
|
|
__ ret(0); |
|
|
// If the hash field contains an array index pick it out. The assert checks
|
|
|
// If the hash field contains an array index pick it out. The assert checks
|
|
@ -512,19 +520,27 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { |
|
|
ASSERT(TenToThe(String::kMaxCachedArrayIndexLength) < |
|
|
ASSERT(TenToThe(String::kMaxCachedArrayIndexLength) < |
|
|
(1 << String::kArrayIndexValueBits)); |
|
|
(1 << String::kArrayIndexValueBits)); |
|
|
__ bind(&index_string); |
|
|
__ bind(&index_string); |
|
|
// We want the smi-tagged index in rax.
|
|
|
// We want the smi-tagged index in rax. Even if we subsequently go to
|
|
|
|
|
|
// the slow case, converting the key to a smi is always valid.
|
|
|
|
|
|
// rdx: receiver
|
|
|
|
|
|
// rax: key (a string)
|
|
|
|
|
|
// rbx: key's hash field, including its array index value.
|
|
|
__ and_(rbx, Immediate(String::kArrayIndexValueMask)); |
|
|
__ and_(rbx, Immediate(String::kArrayIndexValueMask)); |
|
|
__ shr(rbx, Immediate(String::kHashShift)); |
|
|
__ shr(rbx, Immediate(String::kHashShift)); |
|
|
|
|
|
// Here we actually clobber the key (rax) which will be used if calling into
|
|
|
|
|
|
// runtime later. However as the new key is the numeric value of a string key
|
|
|
|
|
|
// there is no difference in using either key.
|
|
|
__ Integer32ToSmi(rax, rbx); |
|
|
__ Integer32ToSmi(rax, rbx); |
|
|
|
|
|
// Now jump to the place where smi keys are handled.
|
|
|
__ jmp(&index_smi); |
|
|
__ jmp(&index_smi); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void KeyedLoadIC::GenerateString(MacroAssembler* masm) { |
|
|
void KeyedLoadIC::GenerateString(MacroAssembler* masm) { |
|
|
// ----------- S t a t e -------------
|
|
|
// ----------- S t a t e -------------
|
|
|
|
|
|
// -- rax : key
|
|
|
|
|
|
// -- rdx : receiver
|
|
|
// -- rsp[0] : return address
|
|
|
// -- rsp[0] : return address
|
|
|
// -- rsp[8] : name (index)
|
|
|
|
|
|
// -- rsp[16] : receiver
|
|
|
|
|
|
// -----------------------------------
|
|
|
// -----------------------------------
|
|
|
Label miss; |
|
|
Label miss; |
|
|
Label index_out_of_range; |
|
|
Label index_out_of_range; |
|
@ -535,9 +551,6 @@ void KeyedLoadIC::GenerateString(MacroAssembler* masm) { |
|
|
Register scratch2 = rcx; |
|
|
Register scratch2 = rcx; |
|
|
Register result = rax; |
|
|
Register result = rax; |
|
|
|
|
|
|
|
|
__ movq(index, Operand(rsp, 1 * kPointerSize)); |
|
|
|
|
|
__ movq(receiver, Operand(rsp, 2 * kPointerSize)); |
|
|
|
|
|
|
|
|
|
|
|
StringCharAtGenerator char_at_generator(receiver, |
|
|
StringCharAtGenerator char_at_generator(receiver, |
|
|
index, |
|
|
index, |
|
|
scratch1, |
|
|
scratch1, |
|
@ -565,80 +578,80 @@ void KeyedLoadIC::GenerateString(MacroAssembler* masm) { |
|
|
void KeyedLoadIC::GenerateExternalArray(MacroAssembler* masm, |
|
|
void KeyedLoadIC::GenerateExternalArray(MacroAssembler* masm, |
|
|
ExternalArrayType array_type) { |
|
|
ExternalArrayType array_type) { |
|
|
// ----------- S t a t e -------------
|
|
|
// ----------- S t a t e -------------
|
|
|
|
|
|
// -- rax : key
|
|
|
|
|
|
// -- rdx : receiver
|
|
|
// -- rsp[0] : return address
|
|
|
// -- rsp[0] : return address
|
|
|
// -- rsp[8] : name
|
|
|
|
|
|
// -- rsp[16] : receiver
|
|
|
|
|
|
// -----------------------------------
|
|
|
// -----------------------------------
|
|
|
Label slow, failed_allocation; |
|
|
Label slow, failed_allocation; |
|
|
|
|
|
|
|
|
// Load name and receiver.
|
|
|
|
|
|
__ movq(rax, Operand(rsp, kPointerSize)); |
|
|
|
|
|
__ movq(rcx, Operand(rsp, 2 * kPointerSize)); |
|
|
|
|
|
|
|
|
|
|
|
// Check that the object isn't a smi.
|
|
|
// Check that the object isn't a smi.
|
|
|
__ JumpIfSmi(rcx, &slow); |
|
|
__ JumpIfSmi(rdx, &slow); |
|
|
|
|
|
|
|
|
// Check that the key is a smi.
|
|
|
// Check that the key is a smi.
|
|
|
__ JumpIfNotSmi(rax, &slow); |
|
|
__ JumpIfNotSmi(rax, &slow); |
|
|
|
|
|
|
|
|
// Check that the object is a JS object.
|
|
|
// Check that the object is a JS object.
|
|
|
__ CmpObjectType(rcx, JS_OBJECT_TYPE, rdx); |
|
|
__ CmpObjectType(rdx, JS_OBJECT_TYPE, rcx); |
|
|
__ j(not_equal, &slow); |
|
|
__ j(not_equal, &slow); |
|
|
// Check that the receiver does not require access checks. We need
|
|
|
// Check that the receiver does not require access checks. We need
|
|
|
// to check this explicitly since this generic stub does not perform
|
|
|
// to check this explicitly since this generic stub does not perform
|
|
|
// map checks. The map is already in rdx.
|
|
|
// map checks. The map is already in rdx.
|
|
|
__ testb(FieldOperand(rdx, Map::kBitFieldOffset), |
|
|
__ testb(FieldOperand(rcx, Map::kBitFieldOffset), |
|
|
Immediate(1 << Map::kIsAccessCheckNeeded)); |
|
|
Immediate(1 << Map::kIsAccessCheckNeeded)); |
|
|
__ j(not_zero, &slow); |
|
|
__ j(not_zero, &slow); |
|
|
|
|
|
|
|
|
// Check that the elements array is the appropriate type of
|
|
|
// Check that the elements array is the appropriate type of
|
|
|
// ExternalArray.
|
|
|
// ExternalArray.
|
|
|
// rax: index (as a smi)
|
|
|
// rax: index (as a smi)
|
|
|
// rcx: JSObject
|
|
|
// rdx: JSObject
|
|
|
__ movq(rcx, FieldOperand(rcx, JSObject::kElementsOffset)); |
|
|
__ movq(rbx, FieldOperand(rdx, JSObject::kElementsOffset)); |
|
|
__ CompareRoot(FieldOperand(rcx, HeapObject::kMapOffset), |
|
|
__ CompareRoot(FieldOperand(rbx, HeapObject::kMapOffset), |
|
|
Heap::RootIndexForExternalArrayType(array_type)); |
|
|
Heap::RootIndexForExternalArrayType(array_type)); |
|
|
__ j(not_equal, &slow); |
|
|
__ j(not_equal, &slow); |
|
|
|
|
|
|
|
|
// Check that the index is in range.
|
|
|
// Check that the index is in range.
|
|
|
__ SmiToInteger32(rax, rax); |
|
|
__ SmiToInteger32(rcx, rax); |
|
|
__ cmpl(rax, FieldOperand(rcx, ExternalArray::kLengthOffset)); |
|
|
__ cmpl(rcx, FieldOperand(rbx, ExternalArray::kLengthOffset)); |
|
|
// Unsigned comparison catches both negative and too-large values.
|
|
|
// Unsigned comparison catches both negative and too-large values.
|
|
|
__ j(above_equal, &slow); |
|
|
__ j(above_equal, &slow); |
|
|
|
|
|
|
|
|
// rax: untagged index
|
|
|
// rax: index (as a smi)
|
|
|
// rcx: elements array
|
|
|
// rdx: receiver (JSObject)
|
|
|
__ movq(rcx, FieldOperand(rcx, ExternalArray::kExternalPointerOffset)); |
|
|
// rcx: untagged index
|
|
|
// rcx: base pointer of external storage
|
|
|
// rbx: elements array
|
|
|
|
|
|
__ movq(rbx, FieldOperand(rbx, ExternalArray::kExternalPointerOffset)); |
|
|
|
|
|
// rbx: base pointer of external storage
|
|
|
switch (array_type) { |
|
|
switch (array_type) { |
|
|
case kExternalByteArray: |
|
|
case kExternalByteArray: |
|
|
__ movsxbq(rax, Operand(rcx, rax, times_1, 0)); |
|
|
__ movsxbq(rcx, Operand(rbx, rcx, times_1, 0)); |
|
|
break; |
|
|
break; |
|
|
case kExternalUnsignedByteArray: |
|
|
case kExternalUnsignedByteArray: |
|
|
__ movzxbq(rax, Operand(rcx, rax, times_1, 0)); |
|
|
__ movzxbq(rcx, Operand(rbx, rcx, times_1, 0)); |
|
|
break; |
|
|
break; |
|
|
case kExternalShortArray: |
|
|
case kExternalShortArray: |
|
|
__ movsxwq(rax, Operand(rcx, rax, times_2, 0)); |
|
|
__ movsxwq(rcx, Operand(rbx, rcx, times_2, 0)); |
|
|
break; |
|
|
break; |
|
|
case kExternalUnsignedShortArray: |
|
|
case kExternalUnsignedShortArray: |
|
|
__ movzxwq(rax, Operand(rcx, rax, times_2, 0)); |
|
|
__ movzxwq(rcx, Operand(rbx, rcx, times_2, 0)); |
|
|
break; |
|
|
break; |
|
|
case kExternalIntArray: |
|
|
case kExternalIntArray: |
|
|
__ movsxlq(rax, Operand(rcx, rax, times_4, 0)); |
|
|
__ movsxlq(rcx, Operand(rbx, rcx, times_4, 0)); |
|
|
break; |
|
|
break; |
|
|
case kExternalUnsignedIntArray: |
|
|
case kExternalUnsignedIntArray: |
|
|
__ movl(rax, Operand(rcx, rax, times_4, 0)); |
|
|
__ movl(rcx, Operand(rbx, rcx, times_4, 0)); |
|
|
break; |
|
|
break; |
|
|
case kExternalFloatArray: |
|
|
case kExternalFloatArray: |
|
|
__ fld_s(Operand(rcx, rax, times_4, 0)); |
|
|
__ fld_s(Operand(rbx, rcx, times_4, 0)); |
|
|
break; |
|
|
break; |
|
|
default: |
|
|
default: |
|
|
UNREACHABLE(); |
|
|
UNREACHABLE(); |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// rax: index
|
|
|
|
|
|
// rdx: receiver
|
|
|
// For integer array types:
|
|
|
// For integer array types:
|
|
|
// rax: value
|
|
|
// rcx: value
|
|
|
// For floating-point array type:
|
|
|
// For floating-point array type:
|
|
|
// FP(0): value
|
|
|
// FP(0): value
|
|
|
|
|
|
|
|
@ -649,42 +662,45 @@ void KeyedLoadIC::GenerateExternalArray(MacroAssembler* masm, |
|
|
// it to a HeapNumber.
|
|
|
// it to a HeapNumber.
|
|
|
Label box_int; |
|
|
Label box_int; |
|
|
if (array_type == kExternalIntArray) { |
|
|
if (array_type == kExternalIntArray) { |
|
|
__ JumpIfNotValidSmiValue(rax, &box_int); |
|
|
__ JumpIfNotValidSmiValue(rcx, &box_int); |
|
|
} else { |
|
|
} else { |
|
|
ASSERT_EQ(array_type, kExternalUnsignedIntArray); |
|
|
ASSERT_EQ(array_type, kExternalUnsignedIntArray); |
|
|
__ JumpIfUIntNotValidSmiValue(rax, &box_int); |
|
|
__ JumpIfUIntNotValidSmiValue(rcx, &box_int); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
__ Integer32ToSmi(rax, rax); |
|
|
__ Integer32ToSmi(rax, rcx); |
|
|
__ ret(0); |
|
|
__ ret(0); |
|
|
|
|
|
|
|
|
__ bind(&box_int); |
|
|
__ bind(&box_int); |
|
|
|
|
|
|
|
|
// Allocate a HeapNumber for the int and perform int-to-double
|
|
|
// Allocate a HeapNumber for the int and perform int-to-double
|
|
|
// conversion.
|
|
|
// conversion.
|
|
|
__ push(rax); |
|
|
__ push(rcx); |
|
|
if (array_type == kExternalIntArray) { |
|
|
if (array_type == kExternalIntArray) { |
|
|
__ fild_s(Operand(rsp, 0)); |
|
|
__ fild_s(Operand(rsp, 0)); |
|
|
} else { |
|
|
} else { |
|
|
ASSERT(array_type == kExternalUnsignedIntArray); |
|
|
ASSERT(array_type == kExternalUnsignedIntArray); |
|
|
// Need to zero-extend the value.
|
|
|
// The value is zero-extended on the stack, because all pushes are
|
|
|
|
|
|
// 64-bit and we loaded the value from memory with movl.
|
|
|
__ fild_d(Operand(rsp, 0)); |
|
|
__ fild_d(Operand(rsp, 0)); |
|
|
} |
|
|
} |
|
|
__ pop(rax); |
|
|
__ pop(rcx); |
|
|
// FP(0): value
|
|
|
// FP(0): value
|
|
|
__ AllocateHeapNumber(rax, rbx, &failed_allocation); |
|
|
__ AllocateHeapNumber(rcx, rbx, &failed_allocation); |
|
|
// Set the value.
|
|
|
// Set the value.
|
|
|
|
|
|
__ movq(rax, rcx); |
|
|
__ fstp_d(FieldOperand(rax, HeapNumber::kValueOffset)); |
|
|
__ fstp_d(FieldOperand(rax, HeapNumber::kValueOffset)); |
|
|
__ ret(0); |
|
|
__ ret(0); |
|
|
} else if (array_type == kExternalFloatArray) { |
|
|
} else if (array_type == kExternalFloatArray) { |
|
|
// For the floating-point array type, we need to always allocate a
|
|
|
// For the floating-point array type, we need to always allocate a
|
|
|
// HeapNumber.
|
|
|
// HeapNumber.
|
|
|
__ AllocateHeapNumber(rax, rbx, &failed_allocation); |
|
|
__ AllocateHeapNumber(rcx, rbx, &failed_allocation); |
|
|
// Set the value.
|
|
|
// Set the value.
|
|
|
|
|
|
__ movq(rax, rcx); |
|
|
__ fstp_d(FieldOperand(rax, HeapNumber::kValueOffset)); |
|
|
__ fstp_d(FieldOperand(rax, HeapNumber::kValueOffset)); |
|
|
__ ret(0); |
|
|
__ ret(0); |
|
|
} else { |
|
|
} else { |
|
|
__ Integer32ToSmi(rax, rax); |
|
|
__ Integer32ToSmi(rax, rcx); |
|
|
__ ret(0); |
|
|
__ ret(0); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -695,7 +711,7 @@ void KeyedLoadIC::GenerateExternalArray(MacroAssembler* masm, |
|
|
__ fincstp(); |
|
|
__ fincstp(); |
|
|
// Fall through to slow case.
|
|
|
// Fall through to slow case.
|
|
|
|
|
|
|
|
|
// Slow case: Load name and receiver from stack and jump to runtime.
|
|
|
// Slow case: Jump to runtime.
|
|
|
__ bind(&slow); |
|
|
__ bind(&slow); |
|
|
__ IncrementCounter(&Counters::keyed_load_external_array_slow, 1); |
|
|
__ IncrementCounter(&Counters::keyed_load_external_array_slow, 1); |
|
|
GenerateRuntimeGetProperty(masm); |
|
|
GenerateRuntimeGetProperty(masm); |
|
@ -704,37 +720,33 @@ void KeyedLoadIC::GenerateExternalArray(MacroAssembler* masm, |
|
|
|
|
|
|
|
|
void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) { |
|
|
void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) { |
|
|
// ----------- S t a t e -------------
|
|
|
// ----------- S t a t e -------------
|
|
|
|
|
|
// -- rax : key
|
|
|
|
|
|
// -- rdx : receiver
|
|
|
// -- rsp[0] : return address
|
|
|
// -- rsp[0] : return address
|
|
|
// -- rsp[8] : key
|
|
|
|
|
|
// -- rsp[16] : receiver
|
|
|
|
|
|
// -----------------------------------
|
|
|
// -----------------------------------
|
|
|
Label slow; |
|
|
Label slow; |
|
|
|
|
|
|
|
|
// Load key and receiver.
|
|
|
|
|
|
__ movq(rax, Operand(rsp, kPointerSize)); |
|
|
|
|
|
__ movq(rcx, Operand(rsp, 2 * kPointerSize)); |
|
|
|
|
|
|
|
|
|
|
|
// Check that the receiver isn't a smi.
|
|
|
// Check that the receiver isn't a smi.
|
|
|
__ JumpIfSmi(rcx, &slow); |
|
|
__ JumpIfSmi(rdx, &slow); |
|
|
|
|
|
|
|
|
// Check that the key is a smi.
|
|
|
// Check that the key is a smi.
|
|
|
__ JumpIfNotSmi(rax, &slow); |
|
|
__ JumpIfNotSmi(rax, &slow); |
|
|
|
|
|
|
|
|
// Get the map of the receiver.
|
|
|
// Get the map of the receiver.
|
|
|
__ movq(rdx, FieldOperand(rcx, HeapObject::kMapOffset)); |
|
|
__ movq(rcx, FieldOperand(rdx, HeapObject::kMapOffset)); |
|
|
|
|
|
|
|
|
// Check that it has indexed interceptor and access checks
|
|
|
// Check that it has indexed interceptor and access checks
|
|
|
// are not enabled for this object.
|
|
|
// are not enabled for this object.
|
|
|
__ movb(rdx, FieldOperand(rdx, Map::kBitFieldOffset)); |
|
|
__ movb(rcx, FieldOperand(rcx, Map::kBitFieldOffset)); |
|
|
__ andb(rdx, Immediate(kSlowCaseBitFieldMask)); |
|
|
__ andb(rcx, Immediate(kSlowCaseBitFieldMask)); |
|
|
__ cmpb(rdx, Immediate(1 << Map::kHasIndexedInterceptor)); |
|
|
__ cmpb(rcx, Immediate(1 << Map::kHasIndexedInterceptor)); |
|
|
__ j(not_zero, &slow); |
|
|
__ j(not_zero, &slow); |
|
|
|
|
|
|
|
|
// Everything is fine, call runtime.
|
|
|
// Everything is fine, call runtime.
|
|
|
__ pop(rdx); |
|
|
__ pop(rcx); |
|
|
__ push(rcx); // receiver
|
|
|
__ push(rdx); // receiver
|
|
|
__ push(rax); // key
|
|
|
__ push(rax); // key
|
|
|
__ push(rdx); // return address
|
|
|
__ push(rcx); // return address
|
|
|
|
|
|
|
|
|
// Perform tail call to the entry.
|
|
|
// Perform tail call to the entry.
|
|
|
__ TailCallExternalReference(ExternalReference( |
|
|
__ TailCallExternalReference(ExternalReference( |
|
@ -1228,7 +1240,7 @@ static void GenerateNormalHelper(MacroAssembler* masm, |
|
|
// rsp[(argc + 1) * 8] : argument 0 = receiver
|
|
|
// rsp[(argc + 1) * 8] : argument 0 = receiver
|
|
|
// -----------------------------------
|
|
|
// -----------------------------------
|
|
|
// Search dictionary - put result in register rdx.
|
|
|
// Search dictionary - put result in register rdx.
|
|
|
GenerateDictionaryLoad(masm, miss, rax, rdx, rbx, rcx, CHECK_DICTIONARY); |
|
|
GenerateDictionaryLoad(masm, miss, rax, rdx, rbx, rcx, rdi, CHECK_DICTIONARY); |
|
|
|
|
|
|
|
|
// Move the result to register rdi and check that it isn't a smi.
|
|
|
// Move the result to register rdi and check that it isn't a smi.
|
|
|
__ movq(rdi, rdx); |
|
|
__ movq(rdi, rdx); |
|
@ -1318,6 +1330,21 @@ void CallIC::GenerateNormal(MacroAssembler* masm, int argc) { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void KeyedCallIC::GenerateMiss(MacroAssembler* masm, int argc) { |
|
|
|
|
|
UNREACHABLE(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) { |
|
|
|
|
|
UNREACHABLE(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void KeyedCallIC::GenerateNormal(MacroAssembler* masm, int argc) { |
|
|
|
|
|
UNREACHABLE(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// The offset from the inlined patch site to the start of the
|
|
|
// The offset from the inlined patch site to the start of the
|
|
|
// inlined load instruction.
|
|
|
// inlined load instruction.
|
|
|
const int LoadIC::kOffsetToLoadInstruction = 20; |
|
|
const int LoadIC::kOffsetToLoadInstruction = 20; |
|
@ -1333,13 +1360,13 @@ void LoadIC::ClearInlinedVersion(Address address) { |
|
|
|
|
|
|
|
|
void LoadIC::GenerateMiss(MacroAssembler* masm) { |
|
|
void LoadIC::GenerateMiss(MacroAssembler* masm) { |
|
|
// ----------- S t a t e -------------
|
|
|
// ----------- S t a t e -------------
|
|
|
|
|
|
// -- rax : receiver
|
|
|
// -- rcx : name
|
|
|
// -- rcx : name
|
|
|
// -- rsp[0] : return address
|
|
|
// -- rsp[0] : return address
|
|
|
// -- rsp[8] : receiver
|
|
|
|
|
|
// -----------------------------------
|
|
|
// -----------------------------------
|
|
|
|
|
|
|
|
|
__ pop(rbx); |
|
|
__ pop(rbx); |
|
|
__ push(Operand(rsp, 0)); // receiver
|
|
|
__ push(rax); // receiver
|
|
|
__ push(rcx); // name
|
|
|
__ push(rcx); // name
|
|
|
__ push(rbx); // return address
|
|
|
__ push(rbx); // return address
|
|
|
|
|
|
|
|
@ -1351,14 +1378,12 @@ void LoadIC::GenerateMiss(MacroAssembler* masm) { |
|
|
|
|
|
|
|
|
void LoadIC::GenerateArrayLength(MacroAssembler* masm) { |
|
|
void LoadIC::GenerateArrayLength(MacroAssembler* masm) { |
|
|
// ----------- S t a t e -------------
|
|
|
// ----------- S t a t e -------------
|
|
|
|
|
|
// -- rax : receiver
|
|
|
// -- rcx : name
|
|
|
// -- rcx : name
|
|
|
// -- rsp[0] : return address
|
|
|
// -- rsp[0] : return address
|
|
|
// -- rsp[8] : receiver
|
|
|
|
|
|
// -----------------------------------
|
|
|
// -----------------------------------
|
|
|
Label miss; |
|
|
Label miss; |
|
|
|
|
|
|
|
|
__ movq(rax, Operand(rsp, kPointerSize)); |
|
|
|
|
|
|
|
|
|
|
|
StubCompiler::GenerateLoadArrayLength(masm, rax, rdx, &miss); |
|
|
StubCompiler::GenerateLoadArrayLength(masm, rax, rdx, &miss); |
|
|
__ bind(&miss); |
|
|
__ bind(&miss); |
|
|
StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC); |
|
|
StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC); |
|
@ -1367,14 +1392,12 @@ void LoadIC::GenerateArrayLength(MacroAssembler* masm) { |
|
|
|
|
|
|
|
|
void LoadIC::GenerateFunctionPrototype(MacroAssembler* masm) { |
|
|
void LoadIC::GenerateFunctionPrototype(MacroAssembler* masm) { |
|
|
// ----------- S t a t e -------------
|
|
|
// ----------- S t a t e -------------
|
|
|
|
|
|
// -- rax : receiver
|
|
|
// -- rcx : name
|
|
|
// -- rcx : name
|
|
|
// -- rsp[0] : return address
|
|
|
// -- rsp[0] : return address
|
|
|
// -- rsp[8] : receiver
|
|
|
|
|
|
// -----------------------------------
|
|
|
// -----------------------------------
|
|
|
Label miss; |
|
|
Label miss; |
|
|
|
|
|
|
|
|
__ movq(rax, Operand(rsp, kPointerSize)); |
|
|
|
|
|
|
|
|
|
|
|
StubCompiler::GenerateLoadFunctionPrototype(masm, rax, rdx, rbx, &miss); |
|
|
StubCompiler::GenerateLoadFunctionPrototype(masm, rax, rdx, rbx, &miss); |
|
|
__ bind(&miss); |
|
|
__ bind(&miss); |
|
|
StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC); |
|
|
StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC); |
|
@ -1383,13 +1406,11 @@ void LoadIC::GenerateFunctionPrototype(MacroAssembler* masm) { |
|
|
|
|
|
|
|
|
void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { |
|
|
void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { |
|
|
// ----------- S t a t e -------------
|
|
|
// ----------- S t a t e -------------
|
|
|
|
|
|
// -- rax : receiver
|
|
|
// -- rcx : name
|
|
|
// -- rcx : name
|
|
|
// -- rsp[0] : return address
|
|
|
// -- rsp[0] : return address
|
|
|
// -- rsp[8] : receiver
|
|
|
|
|
|
// -----------------------------------
|
|
|
// -----------------------------------
|
|
|
|
|
|
|
|
|
__ movq(rax, Operand(rsp, kPointerSize)); |
|
|
|
|
|
|
|
|
|
|
|
// Probe the stub cache.
|
|
|
// Probe the stub cache.
|
|
|
Code::Flags flags = Code::ComputeFlags(Code::LOAD_IC, |
|
|
Code::Flags flags = Code::ComputeFlags(Code::LOAD_IC, |
|
|
NOT_IN_LOOP, |
|
|
NOT_IN_LOOP, |
|
@ -1403,14 +1424,12 @@ void LoadIC::GenerateMegamorphic(MacroAssembler* masm) { |
|
|
|
|
|
|
|
|
void LoadIC::GenerateNormal(MacroAssembler* masm) { |
|
|
void LoadIC::GenerateNormal(MacroAssembler* masm) { |
|
|
// ----------- S t a t e -------------
|
|
|
// ----------- S t a t e -------------
|
|
|
|
|
|
// -- rax : receiver
|
|
|
// -- rcx : name
|
|
|
// -- rcx : name
|
|
|
// -- rsp[0] : return address
|
|
|
// -- rsp[0] : return address
|
|
|
// -- rsp[8] : receiver
|
|
|
|
|
|
// -----------------------------------
|
|
|
// -----------------------------------
|
|
|
Label miss, probe, global; |
|
|
Label miss, probe, global; |
|
|
|
|
|
|
|
|
__ movq(rax, Operand(rsp, kPointerSize)); |
|
|
|
|
|
|
|
|
|
|
|
// Check that the receiver isn't a smi.
|
|
|
// Check that the receiver isn't a smi.
|
|
|
__ JumpIfSmi(rax, &miss); |
|
|
__ JumpIfSmi(rax, &miss); |
|
|
|
|
|
|
|
@ -1432,7 +1451,8 @@ void LoadIC::GenerateNormal(MacroAssembler* masm) { |
|
|
|
|
|
|
|
|
// Search the dictionary placing the result in rax.
|
|
|
// Search the dictionary placing the result in rax.
|
|
|
__ bind(&probe); |
|
|
__ bind(&probe); |
|
|
GenerateDictionaryLoad(masm, &miss, rdx, rax, rbx, rcx, CHECK_DICTIONARY); |
|
|
GenerateDictionaryLoad(masm, &miss, rdx, rax, rbx, |
|
|
|
|
|
rcx, rdi, CHECK_DICTIONARY); |
|
|
__ ret(0); |
|
|
__ ret(0); |
|
|
|
|
|
|
|
|
// Global object access: Check access rights.
|
|
|
// Global object access: Check access rights.
|
|
@ -1440,23 +1460,20 @@ void LoadIC::GenerateNormal(MacroAssembler* masm) { |
|
|
__ CheckAccessGlobalProxy(rax, rdx, &miss); |
|
|
__ CheckAccessGlobalProxy(rax, rdx, &miss); |
|
|
__ jmp(&probe); |
|
|
__ jmp(&probe); |
|
|
|
|
|
|
|
|
// Cache miss: Restore receiver from stack and jump to runtime.
|
|
|
// Cache miss: Jump to runtime.
|
|
|
__ bind(&miss); |
|
|
__ bind(&miss); |
|
|
__ movq(rax, Operand(rsp, 1 * kPointerSize)); |
|
|
|
|
|
GenerateMiss(masm); |
|
|
GenerateMiss(masm); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void LoadIC::GenerateStringLength(MacroAssembler* masm) { |
|
|
void LoadIC::GenerateStringLength(MacroAssembler* masm) { |
|
|
// ----------- S t a t e -------------
|
|
|
// ----------- S t a t e -------------
|
|
|
|
|
|
// -- rax : receiver
|
|
|
// -- rcx : name
|
|
|
// -- rcx : name
|
|
|
// -- rsp[0] : return address
|
|
|
// -- rsp[0] : return address
|
|
|
// -- rsp[8] : receiver
|
|
|
|
|
|
// -----------------------------------
|
|
|
// -----------------------------------
|
|
|
Label miss; |
|
|
Label miss; |
|
|
|
|
|
|
|
|
__ movq(rax, Operand(rsp, kPointerSize)); |
|
|
|
|
|
|
|
|
|
|
|
StubCompiler::GenerateLoadStringLength(masm, rax, rdx, rbx, &miss); |
|
|
StubCompiler::GenerateLoadStringLength(masm, rax, rdx, rbx, &miss); |
|
|
__ bind(&miss); |
|
|
__ bind(&miss); |
|
|
StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC); |
|
|
StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC); |
|
|