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). |
500 // RAX: result, must be preserved | 501 // RAX: result, must be preserved |
501 void StubCode::GenerateDeoptimizeLazyFromReturnStub(Assembler* assembler) { | 502 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())); |
502 // Push zap value instead of CODE_REG for lazy deopt. | 507 // Push zap value instead of CODE_REG for lazy deopt. |
503 __ pushq(Immediate(0xf1f1f1f1)); | 508 __ pushq(Immediate(0xf1f1f1f1)); |
504 // Return address for "call" to deopt stub. | 509 __ pushq(RBX); |
505 __ pushq(Immediate(0xe1e1e1e1)); | |
506 __ movq(CODE_REG, Address(THR, Thread::lazy_deopt_from_return_stub_offset())); | |
507 GenerateDeoptimizationSequence(assembler, kLazyDeoptFromReturn); | 510 GenerateDeoptimizationSequence(assembler, kLazyDeoptFromReturn); |
508 } | 511 } |
509 | 512 |
510 | 513 |
| 514 // TOS: return address + call-instruction-size (5 bytes). |
511 // RAX: exception, must be preserved | 515 // RAX: exception, must be preserved |
512 // RDX: stacktrace, must be preserved | 516 // RDX: stacktrace, must be preserved |
513 void StubCode::GenerateDeoptimizeLazyFromThrowStub(Assembler* assembler) { | 517 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())); |
514 // Push zap value instead of CODE_REG for lazy deopt. | 522 // Push zap value instead of CODE_REG for lazy deopt. |
515 __ pushq(Immediate(0xf1f1f1f1)); | 523 __ pushq(Immediate(0xf1f1f1f1)); |
516 // Return address for "call" to deopt stub. | 524 __ pushq(RBX); |
517 __ pushq(Immediate(0xe1e1e1e1)); | |
518 __ movq(CODE_REG, Address(THR, Thread::lazy_deopt_from_throw_stub_offset())); | |
519 GenerateDeoptimizationSequence(assembler, kLazyDeoptFromThrow); | 525 GenerateDeoptimizationSequence(assembler, kLazyDeoptFromThrow); |
520 } | 526 } |
521 | 527 |
522 | 528 |
523 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { | 529 void StubCode::GenerateDeoptimizeStub(Assembler* assembler) { |
524 GenerateDeoptimizationSequence(assembler, kEagerDeopt); | 530 GenerateDeoptimizationSequence(assembler, kEagerDeopt); |
525 } | 531 } |
526 | 532 |
527 | 533 |
528 static void GenerateDispatcherCode(Assembler* assembler, | 534 static void GenerateDispatcherCode(Assembler* assembler, |
(...skipping 1748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2277 } | 2283 } |
2278 | 2284 |
2279 | 2285 |
2280 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { | 2286 void StubCode::GenerateFrameAwaitingMaterializationStub(Assembler* assembler) { |
2281 __ int3(); | 2287 __ int3(); |
2282 } | 2288 } |
2283 | 2289 |
2284 } // namespace dart | 2290 } // namespace dart |
2285 | 2291 |
2286 #endif // defined TARGET_ARCH_X64 | 2292 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |