OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 // Patch the map check. | 982 // Patch the map check. |
983 Address ldr_map_instr_address = | 983 Address ldr_map_instr_address = |
984 inline_end_address - 4 * Assembler::kInstrSize; | 984 inline_end_address - 4 * Assembler::kInstrSize; |
985 Assembler::set_target_address_at(ldr_map_instr_address, | 985 Assembler::set_target_address_at(ldr_map_instr_address, |
986 reinterpret_cast<Address>(map)); | 986 reinterpret_cast<Address>(map)); |
987 return true; | 987 return true; |
988 } | 988 } |
989 | 989 |
990 | 990 |
991 bool StoreIC::PatchInlinedStore(Address address, Object* map, int offset) { | 991 bool StoreIC::PatchInlinedStore(Address address, Object* map, int offset) { |
992 // TODO(787): Implement inline stores on arm. | 992 // Find the end of the inlined code for the store if there is an |
993 return false; | 993 // inlined version of the store. |
| 994 Address inline_end_address; |
| 995 if (!IsInlinedICSite(address, &inline_end_address)) return false; |
| 996 |
| 997 // Compute the address of the map load instruction. |
| 998 Address ldr_map_instr_address = |
| 999 inline_end_address - |
| 1000 (CodeGenerator::GetInlinedNamedStoreInstructionsAfterPatch() * |
| 1001 Assembler::kInstrSize); |
| 1002 |
| 1003 // Update the offsets if initializing the inlined store. No reason |
| 1004 // to update the offsets when clearing the inlined version because |
| 1005 // it will bail out in the map check. |
| 1006 if (map != Heap::null_value()) { |
| 1007 // Patch the offset in the actual store instruction. |
| 1008 Address str_property_instr_address = |
| 1009 ldr_map_instr_address + 3 * Assembler::kInstrSize; |
| 1010 Instr str_property_instr = Assembler::instr_at(str_property_instr_address); |
| 1011 ASSERT(Assembler::IsStrRegisterImmediate(str_property_instr)); |
| 1012 str_property_instr = Assembler::SetStrRegisterImmediateOffset( |
| 1013 str_property_instr, offset - kHeapObjectTag); |
| 1014 Assembler::instr_at_put(str_property_instr_address, str_property_instr); |
| 1015 |
| 1016 // Patch the offset in the add instruction that is part of the |
| 1017 // write barrier. |
| 1018 Address add_offset_instr_address = |
| 1019 str_property_instr_address + 4 * Assembler::kInstrSize; |
| 1020 Instr add_offset_instr = Assembler::instr_at(add_offset_instr_address); |
| 1021 ASSERT(Assembler::IsAddRegisterImmediate(add_offset_instr)); |
| 1022 add_offset_instr = Assembler::SetAddRegisterImmediateOffset( |
| 1023 add_offset_instr, offset - kHeapObjectTag); |
| 1024 Assembler::instr_at_put(add_offset_instr_address, add_offset_instr); |
| 1025 |
| 1026 // Indicate that code has changed. |
| 1027 CPU::FlushICache(str_property_instr_address, 5 * Assembler::kInstrSize); |
| 1028 } |
| 1029 |
| 1030 // Patch the map check. |
| 1031 Assembler::set_target_address_at(ldr_map_instr_address, |
| 1032 reinterpret_cast<Address>(map)); |
| 1033 |
| 1034 return true; |
994 } | 1035 } |
995 | 1036 |
996 | 1037 |
997 bool KeyedLoadIC::PatchInlinedLoad(Address address, Object* map) { | 1038 bool KeyedLoadIC::PatchInlinedLoad(Address address, Object* map) { |
998 Address inline_end_address; | 1039 Address inline_end_address; |
999 if (!IsInlinedICSite(address, &inline_end_address)) return false; | 1040 if (!IsInlinedICSite(address, &inline_end_address)) return false; |
1000 | 1041 |
1001 // Patch the map check. | 1042 // Patch the map check. |
1002 Address ldr_map_instr_address = | 1043 Address ldr_map_instr_address = |
1003 inline_end_address - | 1044 inline_end_address - |
(...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2208 GenerateMiss(masm); | 2249 GenerateMiss(masm); |
2209 } | 2250 } |
2210 | 2251 |
2211 | 2252 |
2212 #undef __ | 2253 #undef __ |
2213 | 2254 |
2214 | 2255 |
2215 } } // namespace v8::internal | 2256 } } // namespace v8::internal |
2216 | 2257 |
2217 #endif // V8_TARGET_ARCH_ARM | 2258 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |