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 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1388 } | 1388 } |
1389 | 1389 |
1390 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) { | 1390 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) { |
1391 Generate_NotifyStubFailureHelper(masm, kDontSaveFPRegs); | 1391 Generate_NotifyStubFailureHelper(masm, kDontSaveFPRegs); |
1392 } | 1392 } |
1393 | 1393 |
1394 void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) { | 1394 void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) { |
1395 Generate_NotifyStubFailureHelper(masm, kSaveFPRegs); | 1395 Generate_NotifyStubFailureHelper(masm, kSaveFPRegs); |
1396 } | 1396 } |
1397 | 1397 |
| 1398 void Builtins::Generate_NotifyBuiltinContinuation(MacroAssembler* masm) { |
| 1399 // Enter an internal frame. |
| 1400 { |
| 1401 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1402 |
| 1403 // Preserve registers across notification, this is important for compiled |
| 1404 // stubs that tail call the runtime on deopts passing their parameters in |
| 1405 // registers. |
| 1406 __ pushad(); |
| 1407 __ CallRuntime(Runtime::kNotifyStubFailure, false); |
| 1408 __ popad(); |
| 1409 // Tear down internal frame. |
| 1410 } |
| 1411 |
| 1412 __ pop(MemOperand(esp, 0)); // Ignore state offset |
| 1413 __ ret(0); // Return to IC Miss stub, continuation still on stack. |
| 1414 } |
| 1415 |
| 1416 namespace { |
| 1417 static void Generate_ContinueToBuiltinHelper(MacroAssembler* masm, |
| 1418 bool java_script_builtin, |
| 1419 bool with_result) { |
| 1420 const RegisterConfiguration* config(RegisterConfiguration::Turbofan()); |
| 1421 int allocatable_register_count = config->num_allocatable_general_registers(); |
| 1422 if (with_result) { |
| 1423 __ mov(Operand(esp, |
| 1424 config->num_allocatable_general_registers() * kPointerSize + |
| 1425 TYPED_FRAME_SIZE(1)), |
| 1426 eax); |
| 1427 } |
| 1428 for (int i = allocatable_register_count - 1; i >= 0; --i) { |
| 1429 int code = config->GetAllocatableGeneralCode(i); |
| 1430 __ pop(Register::from_code(code)); |
| 1431 if (java_script_builtin && code == kJavaScriptCallArgCountRegister.code()) { |
| 1432 __ SmiUntag(Register::from_code(code)); |
| 1433 } |
| 1434 } |
| 1435 __ mov(ebp, Operand(esp, 2 * kPointerSize)); |
| 1436 __ pop(Operand(esp, TYPED_FRAME_SIZE_FROM_SP(0))); |
| 1437 __ add(esp, Immediate(kPointerSize)); |
| 1438 __ add(Operand(esp, 0), Immediate(Code::kHeaderSize - kHeapObjectTag)); |
| 1439 __ ret(0); |
| 1440 } |
| 1441 } // namespace |
| 1442 |
| 1443 void Builtins::Generate_ContinueToJavaScriptBuiltin(MacroAssembler* masm) { |
| 1444 Generate_ContinueToBuiltinHelper(masm, true, false); |
| 1445 } |
| 1446 |
| 1447 void Builtins::Generate_ContinueToJavaScriptBuiltinWithResult( |
| 1448 MacroAssembler* masm) { |
| 1449 Generate_ContinueToBuiltinHelper(masm, true, true); |
| 1450 } |
| 1451 |
1398 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, | 1452 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, |
1399 Deoptimizer::BailoutType type) { | 1453 Deoptimizer::BailoutType type) { |
1400 { | 1454 { |
1401 FrameScope scope(masm, StackFrame::INTERNAL); | 1455 FrameScope scope(masm, StackFrame::INTERNAL); |
1402 | 1456 |
1403 // Pass deoptimization type to the runtime system. | 1457 // Pass deoptimization type to the runtime system. |
1404 __ push(Immediate(Smi::FromInt(static_cast<int>(type)))); | 1458 __ push(Immediate(Smi::FromInt(static_cast<int>(type)))); |
1405 __ CallRuntime(Runtime::kNotifyDeoptimized); | 1459 __ CallRuntime(Runtime::kNotifyDeoptimized); |
1406 | 1460 |
1407 // Tear down internal frame. | 1461 // Tear down internal frame. |
(...skipping 1849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3257 } | 3311 } |
3258 // Now jump to the instructions of the returned code object. | 3312 // Now jump to the instructions of the returned code object. |
3259 __ jmp(edi); | 3313 __ jmp(edi); |
3260 } | 3314 } |
3261 | 3315 |
3262 #undef __ | 3316 #undef __ |
3263 } // namespace internal | 3317 } // namespace internal |
3264 } // namespace v8 | 3318 } // namespace v8 |
3265 | 3319 |
3266 #endif // V8_TARGET_ARCH_IA32 | 3320 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |