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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
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/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 1444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1455 } | 1455 } |
1456 | 1456 |
1457 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) { | 1457 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) { |
1458 Generate_NotifyStubFailureHelper(masm, kDontSaveFPRegs); | 1458 Generate_NotifyStubFailureHelper(masm, kDontSaveFPRegs); |
1459 } | 1459 } |
1460 | 1460 |
1461 void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) { | 1461 void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) { |
1462 Generate_NotifyStubFailureHelper(masm, kSaveFPRegs); | 1462 Generate_NotifyStubFailureHelper(masm, kSaveFPRegs); |
1463 } | 1463 } |
1464 | 1464 |
1465 void Builtins::Generate_NotifyBuiltinContinuation(MacroAssembler* masm) { | |
1466 // Enter an internal frame. | |
1467 { | |
1468 FrameScope scope(masm, StackFrame::INTERNAL); | |
1469 | |
1470 // Preserve registers across notification, this is important for compiled | |
1471 // stubs that tail call the runtime on deopts passing their parameters in | |
1472 // registers. | |
1473 __ pushad(); | |
1474 __ CallRuntime(Runtime::kNotifyStubFailure, false); | |
1475 __ popad(); | |
1476 // Tear down internal frame. | |
1477 } | |
1478 | |
1479 __ pop(MemOperand(esp, 0)); // Ignore state offset | |
1480 __ 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, here an elsewhere.
| |
1481 } | |
1482 | |
1483 namespace { | |
1484 void Generate_ContinueToBuiltinHelper(MacroAssembler* masm, | |
1485 bool java_script_builtin, | |
1486 bool with_result) { | |
1487 const RegisterConfiguration* config(RegisterConfiguration::Turbofan()); | |
1488 int allocatable_register_count = config->num_allocatable_general_registers(); | |
1489 if (with_result) { | |
1490 __ mov(Operand(esp, | |
1491 config->num_allocatable_general_registers() * kPointerSize + | |
1492 TYPED_FRAME_SIZE(1)), | |
1493 eax); | |
1494 } | |
1495 for (int i = allocatable_register_count - 1; i >= 0; --i) { | |
1496 int code = config->GetAllocatableGeneralCode(i); | |
1497 __ pop(Register::from_code(code)); | |
1498 if (java_script_builtin && code == kJavaScriptCallArgCountRegister.code()) { | |
1499 __ SmiUntag(Register::from_code(code)); | |
1500 } | |
1501 } | |
1502 __ mov(ebp, Operand(esp, 2 * kPointerSize)); | |
1503 __ pop(Operand(esp, TYPED_FRAME_SIZE_FROM_SP(0))); | |
1504 __ add(esp, Immediate(kPointerSize)); | |
Michael Starzinger
2017/05/24 13:54:59
nit: __ Drop(1);
danno
2017/06/06 12:04:52
Done.
| |
1505 __ add(Operand(esp, 0), Immediate(Code::kHeaderSize - kHeapObjectTag)); | |
1506 __ ret(0); | |
1507 } | |
1508 } // namespace | |
1509 | |
1510 void Builtins::Generate_ContinueToCodeStubBuiltin(MacroAssembler* masm) { | |
1511 Generate_ContinueToBuiltinHelper(masm, false, false); | |
1512 } | |
1513 | |
1514 void Builtins::Generate_ContinueToCodeStubBuiltinWithResult( | |
1515 MacroAssembler* masm) { | |
1516 Generate_ContinueToBuiltinHelper(masm, false, true); | |
1517 } | |
1518 | |
1519 void Builtins::Generate_ContinueToJavaScriptBuiltin(MacroAssembler* masm) { | |
1520 Generate_ContinueToBuiltinHelper(masm, true, false); | |
1521 } | |
1522 | |
1523 void Builtins::Generate_ContinueToJavaScriptBuiltinWithResult( | |
1524 MacroAssembler* masm) { | |
1525 Generate_ContinueToBuiltinHelper(masm, true, true); | |
1526 } | |
1527 | |
1465 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, | 1528 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, |
1466 Deoptimizer::BailoutType type) { | 1529 Deoptimizer::BailoutType type) { |
1467 { | 1530 { |
1468 FrameScope scope(masm, StackFrame::INTERNAL); | 1531 FrameScope scope(masm, StackFrame::INTERNAL); |
1469 | 1532 |
1470 // Pass deoptimization type to the runtime system. | 1533 // Pass deoptimization type to the runtime system. |
1471 __ push(Immediate(Smi::FromInt(static_cast<int>(type)))); | 1534 __ push(Immediate(Smi::FromInt(static_cast<int>(type)))); |
1472 __ CallRuntime(Runtime::kNotifyDeoptimized); | 1535 __ CallRuntime(Runtime::kNotifyDeoptimized); |
1473 | 1536 |
1474 // Tear down internal frame. | 1537 // Tear down internal frame. |
(...skipping 1850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3325 } | 3388 } |
3326 // Now jump to the instructions of the returned code object. | 3389 // Now jump to the instructions of the returned code object. |
3327 __ jmp(edi); | 3390 __ jmp(edi); |
3328 } | 3391 } |
3329 | 3392 |
3330 #undef __ | 3393 #undef __ |
3331 } // namespace internal | 3394 } // namespace internal |
3332 } // namespace v8 | 3395 } // namespace v8 |
3333 | 3396 |
3334 #endif // V8_TARGET_ARCH_IA32 | 3397 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |