Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Side by Side Diff: src/x64/macro-assembler-x64.cc

Issue 200095: Add near calls (32-bit displacement) to Code objects on X64 platform. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/x64/assembler-x64-inl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 movq(rax, Immediate(num_arguments)); 341 movq(rax, Immediate(num_arguments));
342 JumpToRuntime(ext, result_size); 342 JumpToRuntime(ext, result_size);
343 } 343 }
344 344
345 345
346 void MacroAssembler::JumpToRuntime(const ExternalReference& ext, 346 void MacroAssembler::JumpToRuntime(const ExternalReference& ext,
347 int result_size) { 347 int result_size) {
348 // Set the entry point and jump to the C entry runtime stub. 348 // Set the entry point and jump to the C entry runtime stub.
349 movq(rbx, ext); 349 movq(rbx, ext);
350 CEntryStub ces(result_size); 350 CEntryStub ces(result_size);
351 movq(kScratchRegister, ces.GetCode(), RelocInfo::CODE_TARGET); 351 jmp(ces.GetCode(), RelocInfo::CODE_TARGET);
352 jmp(kScratchRegister);
353 } 352 }
354 353
355 354
356 void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) { 355 void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) {
357 bool resolved; 356 bool resolved;
358 Handle<Code> code = ResolveBuiltin(id, &resolved); 357 Handle<Code> code = ResolveBuiltin(id, &resolved);
359 358
360 const char* name = Builtins::GetName(id); 359 const char* name = Builtins::GetName(id);
361 int argc = Builtins::GetArgumentsCount(id); 360 int argc = Builtins::GetArgumentsCount(id);
362 361
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 } 1262 }
1264 1263
1265 1264
1266 void MacroAssembler::Jump(Address destination, RelocInfo::Mode rmode) { 1265 void MacroAssembler::Jump(Address destination, RelocInfo::Mode rmode) {
1267 movq(kScratchRegister, destination, rmode); 1266 movq(kScratchRegister, destination, rmode);
1268 jmp(kScratchRegister); 1267 jmp(kScratchRegister);
1269 } 1268 }
1270 1269
1271 1270
1272 void MacroAssembler::Jump(Handle<Code> code_object, RelocInfo::Mode rmode) { 1271 void MacroAssembler::Jump(Handle<Code> code_object, RelocInfo::Mode rmode) {
1273 ASSERT(RelocInfo::IsCodeTarget(rmode)); 1272 // TODO(X64): Inline this
1274 movq(kScratchRegister, code_object, rmode); 1273 jmp(code_object, rmode);
1275 #ifdef DEBUG
1276 Label target;
1277 bind(&target);
1278 #endif
1279 jmp(kScratchRegister);
1280 #ifdef DEBUG
1281 ASSERT_EQ(kCallTargetAddressOffset,
1282 SizeOfCodeGeneratedSince(&target) + kPointerSize);
1283 #endif
1284 } 1274 }
1285 1275
1286 1276
1287 void MacroAssembler::Call(ExternalReference ext) { 1277 void MacroAssembler::Call(ExternalReference ext) {
1288 movq(kScratchRegister, ext); 1278 movq(kScratchRegister, ext);
1289 call(kScratchRegister); 1279 call(kScratchRegister);
1290 } 1280 }
1291 1281
1292 1282
1293 void MacroAssembler::Call(Address destination, RelocInfo::Mode rmode) { 1283 void MacroAssembler::Call(Address destination, RelocInfo::Mode rmode) {
1294 movq(kScratchRegister, destination, rmode); 1284 movq(kScratchRegister, destination, rmode);
1295 call(kScratchRegister); 1285 call(kScratchRegister);
1296 } 1286 }
1297 1287
1298 1288
1299 void MacroAssembler::Call(Handle<Code> code_object, RelocInfo::Mode rmode) { 1289 void MacroAssembler::Call(Handle<Code> code_object, RelocInfo::Mode rmode) {
1300 ASSERT(RelocInfo::IsCodeTarget(rmode)); 1290 ASSERT(RelocInfo::IsCodeTarget(rmode));
1301 WriteRecordedPositions(); 1291 WriteRecordedPositions();
1302 movq(kScratchRegister, code_object, rmode); 1292 call(code_object, rmode);
1303 #ifdef DEBUG
1304 // Patch target is kPointer size bytes *before* target label.
1305 Label target;
1306 bind(&target);
1307 #endif
1308 call(kScratchRegister);
1309 #ifdef DEBUG
1310 ASSERT_EQ(kCallTargetAddressOffset,
1311 SizeOfCodeGeneratedSince(&target) + kPointerSize);
1312 #endif
1313 } 1293 }
1314 1294
1315 1295
1316 void MacroAssembler::PushTryHandler(CodeLocation try_location, 1296 void MacroAssembler::PushTryHandler(CodeLocation try_location,
1317 HandlerType type) { 1297 HandlerType type) {
1318 // Adjust this code if not the case. 1298 // Adjust this code if not the case.
1319 ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize); 1299 ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize);
1320 1300
1321 // The pc (return address) is already on TOS. This code pushes state, 1301 // The pc (return address) is already on TOS. This code pushes state,
1322 // frame pointer and current handler. Check that they are expected 1302 // frame pointer and current handler. Check that they are expected
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1569 InvokeCode(Handle<Code>(code), expected, expected, 1549 InvokeCode(Handle<Code>(code), expected, expected,
1570 RelocInfo::CODE_TARGET, flag); 1550 RelocInfo::CODE_TARGET, flag);
1571 1551
1572 const char* name = Builtins::GetName(id); 1552 const char* name = Builtins::GetName(id);
1573 int argc = Builtins::GetArgumentsCount(id); 1553 int argc = Builtins::GetArgumentsCount(id);
1574 // The target address for the jump is stored as an immediate at offset 1554 // The target address for the jump is stored as an immediate at offset
1575 // kInvokeCodeAddressOffset. 1555 // kInvokeCodeAddressOffset.
1576 if (!resolved) { 1556 if (!resolved) {
1577 uint32_t flags = 1557 uint32_t flags =
1578 Bootstrapper::FixupFlagsArgumentsCount::encode(argc) | 1558 Bootstrapper::FixupFlagsArgumentsCount::encode(argc) |
1579 Bootstrapper::FixupFlagsIsPCRelative::encode(false) | 1559 Bootstrapper::FixupFlagsIsPCRelative::encode(true) |
1580 Bootstrapper::FixupFlagsUseCodeObject::encode(false); 1560 Bootstrapper::FixupFlagsUseCodeObject::encode(false);
1581 Unresolved entry = 1561 Unresolved entry =
1582 { pc_offset() - kCallTargetAddressOffset, flags, name }; 1562 { pc_offset() - kCallTargetAddressOffset, flags, name };
1583 unresolved_.Add(entry); 1563 unresolved_.Add(entry);
1584 } 1564 }
1585 } 1565 }
1586 1566
1587 1567
1588 void MacroAssembler::InvokePrologue(const ParameterCount& expected, 1568 void MacroAssembler::InvokePrologue(const ParameterCount& expected,
1589 const ParameterCount& actual, 1569 const ParameterCount& actual,
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
2177 // Indicate that code has changed. 2157 // Indicate that code has changed.
2178 CPU::FlushICache(address_, size_); 2158 CPU::FlushICache(address_, size_);
2179 2159
2180 // Check that the code was patched as expected. 2160 // Check that the code was patched as expected.
2181 ASSERT(masm_.pc_ == address_ + size_); 2161 ASSERT(masm_.pc_ == address_ + size_);
2182 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 2162 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
2183 } 2163 }
2184 2164
2185 2165
2186 } } // namespace v8::internal 2166 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/x64/assembler-x64-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698