OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/counters.h" | 9 #include "src/counters.h" |
10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
(...skipping 1407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1418 } | 1418 } |
1419 | 1419 |
1420 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) { | 1420 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) { |
1421 Generate_NotifyStubFailureHelper(masm, kDontSaveFPRegs); | 1421 Generate_NotifyStubFailureHelper(masm, kDontSaveFPRegs); |
1422 } | 1422 } |
1423 | 1423 |
1424 void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) { | 1424 void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) { |
1425 Generate_NotifyStubFailureHelper(masm, kSaveFPRegs); | 1425 Generate_NotifyStubFailureHelper(masm, kSaveFPRegs); |
1426 } | 1426 } |
1427 | 1427 |
1428 void Builtins::Generate_NotifyBuiltinContinuation(MacroAssembler* masm) { | |
1429 // Enter an internal frame. | |
1430 { | |
1431 FrameScope scope(masm, StackFrame::INTERNAL); | |
1432 | |
1433 // Preserve registers across notification, this is important for compiled | |
1434 // stubs that tail call the runtime on deopts passing their parameters in | |
1435 // registers. | |
Jarin
2017/05/24 06:41:22
Improve comment? (We do not really tail call runti
danno
2017/06/06 12:04:52
Done.
| |
1436 __ Pushad(); | |
1437 __ CallRuntime(Runtime::kNotifyStubFailure, false); | |
1438 __ Popad(); | |
1439 // Tear down internal frame. | |
1440 } | |
1441 | |
1442 __ DropUnderReturnAddress(1); // Ignore state offset | |
1443 __ ret(0); // Return to IC Miss stub, continuation still on stack. | |
Jarin
2017/05/24 06:41:22
Fix comment.
danno
2017/06/06 12:04:52
Done.
| |
1444 } | |
1445 | |
1446 namespace { | |
1447 void Generate_ContinueToBuiltinHelper(MacroAssembler* masm, | |
1448 bool java_script_builtin, | |
1449 bool with_result) { | |
1450 const RegisterConfiguration* config(RegisterConfiguration::Turbofan()); | |
1451 int allocatable_register_count = config->num_allocatable_general_registers(); | |
1452 if (with_result) { | |
1453 __ movq(Operand(rsp, | |
1454 config->num_allocatable_general_registers() * kPointerSize + | |
1455 TYPED_FRAME_SIZE(1)), | |
1456 rax); | |
Jarin
2017/05/24 06:41:22
Is this the bit that overwrites the hole inserted
danno
2017/06/06 12:04:52
Done.
| |
1457 } | |
1458 for (int i = allocatable_register_count - 1; i >= 0; --i) { | |
1459 int code = config->GetAllocatableGeneralCode(i); | |
1460 __ popq(Register::from_code(code)); | |
1461 if (java_script_builtin && code == kJavaScriptCallArgCountRegister.code()) { | |
1462 __ SmiToInteger32(Register::from_code(code), Register::from_code(code)); | |
1463 } | |
1464 } | |
1465 __ movq(rbp, Operand(rsp, 2 * kPointerSize)); | |
1466 __ popq(Operand(rsp, TYPED_FRAME_SIZE_FROM_SP(0))); | |
1467 __ addq(rsp, Immediate(kPointerSize)); | |
1468 __ addq(Operand(rsp, 0), Immediate(Code::kHeaderSize - kHeapObjectTag)); | |
1469 __ Ret(); | |
1470 } | |
1471 } // namespace | |
1472 | |
1473 void Builtins::Generate_ContinueToCodeStubBuiltin(MacroAssembler* masm) { | |
1474 Generate_ContinueToBuiltinHelper(masm, false, false); | |
1475 } | |
1476 | |
1477 void Builtins::Generate_ContinueToCodeStubBuiltinWithResult( | |
1478 MacroAssembler* masm) { | |
1479 Generate_ContinueToBuiltinHelper(masm, false, true); | |
1480 } | |
1481 | |
1482 void Builtins::Generate_ContinueToJavaScriptBuiltin(MacroAssembler* masm) { | |
1483 Generate_ContinueToBuiltinHelper(masm, true, false); | |
1484 } | |
1485 | |
1486 void Builtins::Generate_ContinueToJavaScriptBuiltinWithResult( | |
1487 MacroAssembler* masm) { | |
1488 Generate_ContinueToBuiltinHelper(masm, true, true); | |
1489 } | |
1490 | |
1428 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, | 1491 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, |
1429 Deoptimizer::BailoutType type) { | 1492 Deoptimizer::BailoutType type) { |
1430 // Enter an internal frame. | 1493 // Enter an internal frame. |
1431 { | 1494 { |
1432 FrameScope scope(masm, StackFrame::INTERNAL); | 1495 FrameScope scope(masm, StackFrame::INTERNAL); |
1433 | 1496 |
1434 // Pass the deoptimization type to the runtime system. | 1497 // Pass the deoptimization type to the runtime system. |
1435 __ Push(Smi::FromInt(static_cast<int>(type))); | 1498 __ Push(Smi::FromInt(static_cast<int>(type))); |
1436 | 1499 |
1437 __ CallRuntime(Runtime::kNotifyDeoptimized); | 1500 __ CallRuntime(Runtime::kNotifyDeoptimized); |
(...skipping 1797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3235 // Now jump to the instructions of the returned code object. | 3298 // Now jump to the instructions of the returned code object. |
3236 __ jmp(r11); | 3299 __ jmp(r11); |
3237 } | 3300 } |
3238 | 3301 |
3239 #undef __ | 3302 #undef __ |
3240 | 3303 |
3241 } // namespace internal | 3304 } // namespace internal |
3242 } // namespace v8 | 3305 } // namespace v8 |
3243 | 3306 |
3244 #endif // V8_TARGET_ARCH_X64 | 3307 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |