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 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1344 } | 1344 } |
1345 | 1345 |
1346 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) { | 1346 void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) { |
1347 Generate_NotifyStubFailureHelper(masm, kDontSaveFPRegs); | 1347 Generate_NotifyStubFailureHelper(masm, kDontSaveFPRegs); |
1348 } | 1348 } |
1349 | 1349 |
1350 void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) { | 1350 void Builtins::Generate_NotifyStubFailureSaveDoubles(MacroAssembler* masm) { |
1351 Generate_NotifyStubFailureHelper(masm, kSaveFPRegs); | 1351 Generate_NotifyStubFailureHelper(masm, kSaveFPRegs); |
1352 } | 1352 } |
1353 | 1353 |
| 1354 void Builtins::Generate_NotifyBuiltinContinuation(MacroAssembler* masm) { |
| 1355 // Enter an internal frame. |
| 1356 { |
| 1357 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1358 |
| 1359 // Preserve registers across notification, this is important for compiled |
| 1360 // stubs that tail call the runtime on deopts passing their parameters in |
| 1361 // registers. |
| 1362 __ Pushad(); |
| 1363 __ CallRuntime(Runtime::kNotifyStubFailure, false); |
| 1364 __ Popad(); |
| 1365 // Tear down internal frame. |
| 1366 } |
| 1367 |
| 1368 __ DropUnderReturnAddress(1); // Ignore state offset |
| 1369 __ ret(0); // Return to IC Miss stub, continuation still on stack. |
| 1370 } |
| 1371 |
| 1372 namespace { |
| 1373 static void Generate_ContinueToBuiltinHelper(MacroAssembler* masm, |
| 1374 bool java_script_builtin, |
| 1375 bool with_result) { |
| 1376 const RegisterConfiguration* config(RegisterConfiguration::Turbofan()); |
| 1377 int allocatable_register_count = config->num_allocatable_general_registers(); |
| 1378 if (with_result) { |
| 1379 __ movq(Operand(rsp, |
| 1380 config->num_allocatable_general_registers() * kPointerSize + |
| 1381 TYPED_FRAME_SIZE(1)), |
| 1382 rax); |
| 1383 } |
| 1384 for (int i = allocatable_register_count - 1; i >= 0; --i) { |
| 1385 int code = config->GetAllocatableGeneralCode(i); |
| 1386 __ popq(Register::from_code(code)); |
| 1387 if (java_script_builtin && code == kJavaScriptCallArgCountRegister.code()) { |
| 1388 __ SmiToInteger32(Register::from_code(code), Register::from_code(code)); |
| 1389 } |
| 1390 } |
| 1391 __ movq(rbp, Operand(rsp, 2 * kPointerSize)); |
| 1392 __ popq(Operand(rsp, TYPED_FRAME_SIZE_FROM_SP(0))); |
| 1393 __ addq(rsp, Immediate(kPointerSize)); |
| 1394 __ addq(Operand(rsp, 0), Immediate(Code::kHeaderSize - kHeapObjectTag)); |
| 1395 __ Ret(); |
| 1396 } |
| 1397 } // namespace |
| 1398 |
| 1399 void Builtins::Generate_ContinueToCodeStubBuiltin(MacroAssembler* masm) { |
| 1400 Generate_ContinueToBuiltinHelper(masm, false, false); |
| 1401 } |
| 1402 |
| 1403 void Builtins::Generate_ContinueToCodeStubBuiltinWithResult( |
| 1404 MacroAssembler* masm) { |
| 1405 Generate_ContinueToBuiltinHelper(masm, false, true); |
| 1406 } |
| 1407 |
| 1408 void Builtins::Generate_ContinueToJavaScriptBuiltin(MacroAssembler* masm) { |
| 1409 Generate_ContinueToBuiltinHelper(masm, true, false); |
| 1410 } |
| 1411 |
| 1412 void Builtins::Generate_ContinueToJavaScriptBuiltinWithResult( |
| 1413 MacroAssembler* masm) { |
| 1414 Generate_ContinueToBuiltinHelper(masm, true, true); |
| 1415 } |
| 1416 |
1354 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, | 1417 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, |
1355 Deoptimizer::BailoutType type) { | 1418 Deoptimizer::BailoutType type) { |
1356 // Enter an internal frame. | 1419 // Enter an internal frame. |
1357 { | 1420 { |
1358 FrameScope scope(masm, StackFrame::INTERNAL); | 1421 FrameScope scope(masm, StackFrame::INTERNAL); |
1359 | 1422 |
1360 // Pass the deoptimization type to the runtime system. | 1423 // Pass the deoptimization type to the runtime system. |
1361 __ Push(Smi::FromInt(static_cast<int>(type))); | 1424 __ Push(Smi::FromInt(static_cast<int>(type))); |
1362 | 1425 |
1363 __ CallRuntime(Runtime::kNotifyDeoptimized); | 1426 __ CallRuntime(Runtime::kNotifyDeoptimized); |
(...skipping 1801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3165 // Now jump to the instructions of the returned code object. | 3228 // Now jump to the instructions of the returned code object. |
3166 __ jmp(r11); | 3229 __ jmp(r11); |
3167 } | 3230 } |
3168 | 3231 |
3169 #undef __ | 3232 #undef __ |
3170 | 3233 |
3171 } // namespace internal | 3234 } // namespace internal |
3172 } // namespace v8 | 3235 } // namespace v8 |
3173 | 3236 |
3174 #endif // V8_TARGET_ARCH_X64 | 3237 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |