OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/globals.h" | 5 #include "vm/globals.h" |
6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 } | 490 } |
491 __ LeaveStubFrame(); | 491 __ LeaveStubFrame(); |
492 | 492 |
493 __ popq(RCX); // Pop return address. | 493 __ popq(RCX); // Pop return address. |
494 __ addq(RSP, RBX); // Remove materialization arguments. | 494 __ addq(RSP, RBX); // Remove materialization arguments. |
495 __ pushq(RCX); // Push return address. | 495 __ pushq(RCX); // Push return address. |
496 __ ret(); | 496 __ ret(); |
497 } | 497 } |
498 | 498 |
499 | 499 |
500 // TOS: return address + call-instruction-size (5 bytes). | |
501 // RAX: result, must be preserved | 500 // RAX: result, must be preserved |
502 void StubCode::GenerateDeoptimizeLazyFromReturnStub(Assembler* assembler) { | 501 void StubCode::GenerateDeoptimizeLazyFromReturnStub(Assembler* assembler) { |
503 // Correct return address to point just after the call that is being | |
504 // deoptimized. | |
505 __ popq(RBX); | |
506 __ subq(RBX, Immediate(ShortCallPattern::pattern_length_in_bytes())); | |
507 // Push zap value instead of CODE_REG for lazy deopt. | 502 // Push zap value instead of CODE_REG for lazy deopt. |
508 __ pushq(Immediate(0xf1f1f1f1)); | 503 __ pushq(Immediate(0xf1f1f1f1)); |
509 __ pushq(RBX); | 504 // Return address for "call" to deopt stub. |
| 505 __ pushq(Immediate(0xe1e1e1e1)); |
| 506 __ movq(CODE_REG, Address(THR, Thread::lazy_deopt_from_return_stub_offset())); |
510 GenerateDeoptimizationSequence(assembler, kLazyDeoptFromReturn); | 507 GenerateDeoptimizationSequence(assembler, kLazyDeoptFromReturn); |
511 } | 508 } |
512 | 509 |
513 | 510 |
514 // TOS: return address + call-instruction-size (5 bytes). | |
515 // RAX: exception, must be preserved | 511 // RAX: exception, must be preserved |
516 // RDX: stacktrace, must be preserved | 512 // RDX: stacktrace, must be preserved |
517 void StubCode::GenerateDeoptimizeLazyFromThrowStub(Assembler* assembler) { | 513 void StubCode::GenerateDeoptimizeLazyFromThrowStub(Assembler* assembler) { |
518 // Correct return address to point just after the call that is being | |
519 // deoptimized. | |
520 __ popq(RBX); | |
521 __ subq(RBX, Immediate(ShortCallPattern::pattern_length_in_bytes())); | |
522 // Push zap value instead of CODE_REG for lazy deopt. | 514 // Push zap value instead of CODE_REG for lazy deopt. |
523 __ pushq(Immediate(0xf1f1f1f1)); | 515 __ pushq(Immediate(0xf1f1f1f1)); |
524 __ pushq(RBX); | 516 // Return address for "call" to deopt stub. |
| 517 __ pushq(Immediate(0xe1e1e1e1)); |
| 518 __ movq(CODE_REG, Address(THR, Thread::lazy_deopt_from_throw_stub_offset())); |
525 GenerateDeoptimizationSequence(assembler, kLazyDeoptFromThrow); | 519 GenerateDeoptimizationSequence(assembler, kLazyDeoptFromThrow); |
526 } | 520 } |
527 | 521 |
528 | 522 |
529 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { | 523 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { |
530 GenerateDeoptimizationSequence(assembler, kEagerDeopt); | 524 GenerateDeoptimizationSequence(assembler, kEagerDeopt); |
531 } | 525 } |
532 | 526 |
533 | 527 |
534 static void GenerateDispatcherCode(Assembler* assembler, | 528 static void GenerateDispatcherCode(Assembler* assembler, |
(...skipping 1748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2283 } | 2277 } |
2284 | 2278 |
2285 | 2279 |
2286 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { | 2280 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { |
2287 __ int3(); | 2281 __ int3(); |
2288 } | 2282 } |
2289 | 2283 |
2290 } // namespace dart | 2284 } // namespace dart |
2291 | 2285 |
2292 #endif // defined TARGET_ARCH_X64 | 2286 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |