diff options
author | Kristian Monsen <kristianm@google.com> | 2010-07-29 15:18:00 +0100 |
---|---|---|
committer | Kristian Monsen <kristianm@google.com> | 2010-07-29 15:18:00 +0100 |
commit | 50ef84f5fad2def87d3fbc737bec4a32711fdef4 (patch) | |
tree | 72049481a445e51e78cc81ec1d114de2e87c6d1f /src/x64/ic-x64.cc | |
parent | 3bec4d28b1f388dbc06a9c4276e1a03e86c52b04 (diff) | |
download | android_external_v8-50ef84f5fad2def87d3fbc737bec4a32711fdef4.tar.gz android_external_v8-50ef84f5fad2def87d3fbc737bec4a32711fdef4.tar.bz2 android_external_v8-50ef84f5fad2def87d3fbc737bec4a32711fdef4.zip |
Update V8 to r5136 as required by WebKit r64264
Change-Id: I55b86fa101d9d53e889e2e3811fdf75f463ac3c6
Diffstat (limited to 'src/x64/ic-x64.cc')
-rw-r--r-- | src/x64/ic-x64.cc | 93 |
1 files changed, 57 insertions, 36 deletions
diff --git a/src/x64/ic-x64.cc b/src/x64/ic-x64.cc index d04a7dcd..b6957b2d 100644 --- a/src/x64/ic-x64.cc +++ b/src/x64/ic-x64.cc @@ -379,7 +379,7 @@ static void GenerateNumberDictionaryLoad(MacroAssembler* masm, } -// One byte opcode for test eax,0xXXXXXXXX. +// One byte opcode for test rax,0xXXXXXXXX. static const byte kTestEaxByte = 0xA9; @@ -418,28 +418,6 @@ bool KeyedStoreIC::PatchInlinedStore(Address address, Object* map) { } -void KeyedLoadIC::ClearInlinedVersion(Address address) { - // Insert null as the map to check for to make sure the map check fails - // sending control flow to the IC instead of the inlined version. - PatchInlinedLoad(address, Heap::null_value()); -} - - -void KeyedStoreIC::ClearInlinedVersion(Address address) { - // Insert null as the elements map to check for. This will make - // sure that the elements fast-case map check fails so that control - // flows to the IC instead of the inlined version. - PatchInlinedStore(address, Heap::null_value()); -} - - -void KeyedStoreIC::RestoreInlinedVersion(Address address) { - // Restore the fast-case elements map check so that the inlined - // version can be used again. - PatchInlinedStore(address, Heap::fixed_array_map()); -} - - void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { // ----------- S t a t e ------------- // -- rax : key @@ -1542,8 +1520,8 @@ void KeyedCallIC::GenerateMegamorphic(MacroAssembler* masm, int argc) { GenerateFunctionTailCall(masm, argc, &slow_call); __ bind(&check_number_dictionary); - // eax: elements - // ecx: smi key + // rax: elements + // rcx: smi key // Check whether the elements is a number dictionary. __ CompareRoot(FieldOperand(rax, HeapObject::kMapOffset), Heap::kHashTableMapRootIndex); @@ -1625,19 +1603,11 @@ void KeyedCallIC::GenerateNormal(MacroAssembler* masm, int argc) { } -// The offset from the inlined patch site to the start of the -// inlined load instruction. +// The offset from the inlined patch site to the start of the inlined +// load instruction. const int LoadIC::kOffsetToLoadInstruction = 20; -void LoadIC::ClearInlinedVersion(Address address) { - // Reset the map check of the inlined inobject property load (if - // present) to guarantee failure by holding an invalid map (the null - // value). The offset can be patched to anything. - PatchInlinedLoad(address, Heap::null_value(), kMaxInt); -} - - void LoadIC::GenerateMiss(MacroAssembler* masm) { // ----------- S t a t e ------------- // -- rax : receiver @@ -1743,7 +1713,7 @@ bool LoadIC::PatchInlinedLoad(Address address, Object* map, int offset) { // The address of the instruction following the call. Address test_instruction_address = address + Assembler::kCallTargetAddressOffset; - // If the instruction following the call is not a test eax, nothing + // If the instruction following the call is not a test rax, nothing // was inlined. if (*test_instruction_address != kTestEaxByte) return false; @@ -1767,6 +1737,57 @@ bool LoadIC::PatchInlinedLoad(Address address, Object* map, int offset) { } +// The offset from the inlined patch site to the start of the inlined +// store instruction. +const int StoreIC::kOffsetToStoreInstruction = 20; + + +bool StoreIC::PatchInlinedStore(Address address, Object* map, int offset) { + // The address of the instruction following the call. + Address test_instruction_address = + address + Assembler::kCallTargetAddressOffset; + + // If the instruction following the call is not a test rax, nothing + // was inlined. + if (*test_instruction_address != kTestEaxByte) return false; + + // Extract the encoded deltas from the test rax instruction. + Address encoded_offsets_address = test_instruction_address + 1; + int encoded_offsets = *reinterpret_cast<int*>(encoded_offsets_address); + int delta_to_map_check = -(encoded_offsets & 0xFFFF); + int delta_to_record_write = encoded_offsets >> 16; + + // Patch the map to check. The map address is the last 8 bytes of + // the 10-byte immediate move instruction. + Address map_check_address = test_instruction_address + delta_to_map_check; + Address map_address = map_check_address + 2; + *(reinterpret_cast<Object**>(map_address)) = map; + + // Patch the offset in the store instruction. The offset is in the + // last 4 bytes of a 7 byte register-to-memory move instruction. + Address offset_address = + map_check_address + StoreIC::kOffsetToStoreInstruction + 3; + // The offset should have initial value (kMaxInt - 1), cleared value + // (-1) or we should be clearing the inlined version. + ASSERT(*reinterpret_cast<int*>(offset_address) == kMaxInt - 1 || + *reinterpret_cast<int*>(offset_address) == -1 || + (offset == 0 && map == Heap::null_value())); + *reinterpret_cast<int*>(offset_address) = offset - kHeapObjectTag; + + // Patch the offset in the write-barrier code. The offset is the + // last 4 bytes of a 7 byte lea instruction. + offset_address = map_check_address + delta_to_record_write + 3; + // The offset should have initial value (kMaxInt), cleared value + // (-1) or we should be clearing the inlined version. + ASSERT(*reinterpret_cast<int*>(offset_address) == kMaxInt || + *reinterpret_cast<int*>(offset_address) == -1 || + (offset == 0 && map == Heap::null_value())); + *reinterpret_cast<int*>(offset_address) = offset - kHeapObjectTag; + + return true; +} + + void StoreIC::GenerateMiss(MacroAssembler* masm) { // ----------- S t a t e ------------- // -- rax : value |