OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 __ LeaveInternalFrame(); | 554 __ LeaveInternalFrame(); |
555 | 555 |
556 // Do a tail-call of the compiled function. | 556 // Do a tail-call of the compiled function. |
557 __ lea(rcx, FieldOperand(rax, Code::kHeaderSize)); | 557 __ lea(rcx, FieldOperand(rax, Code::kHeaderSize)); |
558 __ jmp(rcx); | 558 __ jmp(rcx); |
559 } | 559 } |
560 | 560 |
561 | 561 |
562 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, | 562 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, |
563 Deoptimizer::BailoutType type) { | 563 Deoptimizer::BailoutType type) { |
564 __ int3(); | 564 // Enter an internal frame. |
| 565 __ EnterInternalFrame(); |
| 566 |
| 567 // Pass the deoptimization type to the runtime system. |
| 568 __ Push(Smi::FromInt(static_cast<int>(type))); |
| 569 |
| 570 __ CallRuntime(Runtime::kNotifyDeoptimized, 1); |
| 571 // Tear down temporary frame. |
| 572 __ LeaveInternalFrame(); |
| 573 |
| 574 // Get the full codegen state from the stack and untag it. |
| 575 __ SmiToInteger32(rcx, Operand(rsp, 1 * kPointerSize)); |
| 576 |
| 577 // Switch on the state. |
| 578 NearLabel not_no_registers, not_tos_rax; |
| 579 __ cmpq(rcx, Immediate(FullCodeGenerator::NO_REGISTERS)); |
| 580 __ j(not_equal, ¬_no_registers); |
| 581 __ ret(1 * kPointerSize); // Remove state. |
| 582 |
| 583 __ bind(¬_no_registers); |
| 584 __ movq(rax, Operand(rsp, 2 * kPointerSize)); |
| 585 __ cmpq(rcx, Immediate(FullCodeGenerator::TOS_REG)); |
| 586 __ j(not_equal, ¬_tos_rax); |
| 587 __ ret(2 * kPointerSize); // Remove state, rax. |
| 588 |
| 589 __ bind(¬_tos_rax); |
| 590 __ Abort("no cases left"); |
565 } | 591 } |
566 | 592 |
567 void Builtins::Generate_NotifyDeoptimized(MacroAssembler* masm) { | 593 void Builtins::Generate_NotifyDeoptimized(MacroAssembler* masm) { |
568 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::EAGER); | 594 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::EAGER); |
569 } | 595 } |
570 | 596 |
571 | 597 |
572 void Builtins::Generate_NotifyLazyDeoptimized(MacroAssembler* masm) { | 598 void Builtins::Generate_NotifyLazyDeoptimized(MacroAssembler* masm) { |
573 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::EAGER); | 599 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::EAGER); |
574 } | 600 } |
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1382 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 1408 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
1383 __ int3(); | 1409 __ int3(); |
1384 } | 1410 } |
1385 | 1411 |
1386 | 1412 |
1387 #undef __ | 1413 #undef __ |
1388 | 1414 |
1389 } } // namespace v8::internal | 1415 } } // namespace v8::internal |
1390 | 1416 |
1391 #endif // V8_TARGET_ARCH_X64 | 1417 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |