OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1194 | 1194 |
1195 void MacroAssembler::Jump(Handle<Code> code_object, RelocInfo::Mode rmode) { | 1195 void MacroAssembler::Jump(Handle<Code> code_object, RelocInfo::Mode rmode) { |
1196 ASSERT(RelocInfo::IsCodeTarget(rmode)); | 1196 ASSERT(RelocInfo::IsCodeTarget(rmode)); |
1197 movq(kScratchRegister, code_object, rmode); | 1197 movq(kScratchRegister, code_object, rmode); |
1198 #ifdef DEBUG | 1198 #ifdef DEBUG |
1199 Label target; | 1199 Label target; |
1200 bind(&target); | 1200 bind(&target); |
1201 #endif | 1201 #endif |
1202 jmp(kScratchRegister); | 1202 jmp(kScratchRegister); |
1203 #ifdef DEBUG | 1203 #ifdef DEBUG |
1204 ASSERT_EQ(kPatchReturnSequenceLength, | 1204 ASSERT_EQ(kCallTargetAddressOffset, |
1205 SizeOfCodeGeneratedSince(&target) + kPointerSize); | 1205 SizeOfCodeGeneratedSince(&target) + kPointerSize); |
1206 #endif | 1206 #endif |
1207 } | 1207 } |
1208 | 1208 |
1209 | 1209 |
1210 void MacroAssembler::Call(ExternalReference ext) { | 1210 void MacroAssembler::Call(ExternalReference ext) { |
1211 movq(kScratchRegister, ext); | 1211 movq(kScratchRegister, ext); |
1212 call(kScratchRegister); | 1212 call(kScratchRegister); |
1213 } | 1213 } |
1214 | 1214 |
1215 | 1215 |
1216 void MacroAssembler::Call(Address destination, RelocInfo::Mode rmode) { | 1216 void MacroAssembler::Call(Address destination, RelocInfo::Mode rmode) { |
1217 movq(kScratchRegister, destination, rmode); | 1217 movq(kScratchRegister, destination, rmode); |
1218 call(kScratchRegister); | 1218 call(kScratchRegister); |
1219 } | 1219 } |
1220 | 1220 |
1221 | 1221 |
1222 void MacroAssembler::Call(Handle<Code> code_object, RelocInfo::Mode rmode) { | 1222 void MacroAssembler::Call(Handle<Code> code_object, RelocInfo::Mode rmode) { |
1223 ASSERT(RelocInfo::IsCodeTarget(rmode)); | 1223 ASSERT(RelocInfo::IsCodeTarget(rmode)); |
1224 WriteRecordedPositions(); | 1224 WriteRecordedPositions(); |
1225 movq(kScratchRegister, code_object, rmode); | 1225 movq(kScratchRegister, code_object, rmode); |
1226 #ifdef DEBUG | 1226 #ifdef DEBUG |
1227 // Patch target is kPointer size bytes *before* target label. | 1227 // Patch target is kPointer size bytes *before* target label. |
1228 Label target; | 1228 Label target; |
1229 bind(&target); | 1229 bind(&target); |
1230 #endif | 1230 #endif |
1231 call(kScratchRegister); | 1231 call(kScratchRegister); |
1232 #ifdef DEBUG | 1232 #ifdef DEBUG |
1233 ASSERT_EQ(kPatchReturnSequenceLength, | 1233 ASSERT_EQ(kCallTargetAddressOffset, |
1234 SizeOfCodeGeneratedSince(&target) + kPointerSize); | 1234 SizeOfCodeGeneratedSince(&target) + kPointerSize); |
1235 #endif | 1235 #endif |
1236 } | 1236 } |
1237 | 1237 |
1238 | 1238 |
1239 void MacroAssembler::PushTryHandler(CodeLocation try_location, | 1239 void MacroAssembler::PushTryHandler(CodeLocation try_location, |
1240 HandlerType type) { | 1240 HandlerType type) { |
1241 // Adjust this code if not the case. | 1241 // Adjust this code if not the case. |
1242 ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize); | 1242 ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize); |
1243 | 1243 |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1495 const char* name = Builtins::GetName(id); | 1495 const char* name = Builtins::GetName(id); |
1496 int argc = Builtins::GetArgumentsCount(id); | 1496 int argc = Builtins::GetArgumentsCount(id); |
1497 // The target address for the jump is stored as an immediate at offset | 1497 // The target address for the jump is stored as an immediate at offset |
1498 // kInvokeCodeAddressOffset. | 1498 // kInvokeCodeAddressOffset. |
1499 if (!resolved) { | 1499 if (!resolved) { |
1500 uint32_t flags = | 1500 uint32_t flags = |
1501 Bootstrapper::FixupFlagsArgumentsCount::encode(argc) | | 1501 Bootstrapper::FixupFlagsArgumentsCount::encode(argc) | |
1502 Bootstrapper::FixupFlagsIsPCRelative::encode(false) | | 1502 Bootstrapper::FixupFlagsIsPCRelative::encode(false) | |
1503 Bootstrapper::FixupFlagsUseCodeObject::encode(false); | 1503 Bootstrapper::FixupFlagsUseCodeObject::encode(false); |
1504 Unresolved entry = | 1504 Unresolved entry = |
1505 { pc_offset() - kPatchReturnSequenceLength, flags, name }; | 1505 { pc_offset() - kCallTargetAddressOffset, flags, name }; |
1506 unresolved_.Add(entry); | 1506 unresolved_.Add(entry); |
1507 } | 1507 } |
1508 } | 1508 } |
1509 | 1509 |
1510 | 1510 |
1511 void MacroAssembler::InvokePrologue(const ParameterCount& expected, | 1511 void MacroAssembler::InvokePrologue(const ParameterCount& expected, |
1512 const ParameterCount& actual, | 1512 const ParameterCount& actual, |
1513 Handle<Code> code_constant, | 1513 Handle<Code> code_constant, |
1514 Register code_register, | 1514 Register code_register, |
1515 Label* done, | 1515 Label* done, |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2102 CPU::FlushICache(address_, size_); | 2102 CPU::FlushICache(address_, size_); |
2103 | 2103 |
2104 // Check that the code was patched as expected. | 2104 // Check that the code was patched as expected. |
2105 ASSERT(masm_.pc_ == address_ + size_); | 2105 ASSERT(masm_.pc_ == address_ + size_); |
2106 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2106 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
2107 } | 2107 } |
2108 #endif // ENABLE_DEBUGGER_SUPPORT | 2108 #endif // ENABLE_DEBUGGER_SUPPORT |
2109 | 2109 |
2110 | 2110 |
2111 } } // namespace v8::internal | 2111 } } // namespace v8::internal |
OLD | NEW |