OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
6 | 6 |
7 #include "src/arm64/frames-arm64.h" | 7 #include "src/arm64/frames-arm64.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
(...skipping 1397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1408 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { | 1408 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { |
1409 GenerateTailCallToReturnedCode(masm, | 1409 GenerateTailCallToReturnedCode(masm, |
1410 Runtime::kCompileOptimized_NotConcurrent); | 1410 Runtime::kCompileOptimized_NotConcurrent); |
1411 } | 1411 } |
1412 | 1412 |
1413 | 1413 |
1414 void Builtins::Generate_CompileOptimizedConcurrent(MacroAssembler* masm) { | 1414 void Builtins::Generate_CompileOptimizedConcurrent(MacroAssembler* masm) { |
1415 GenerateTailCallToReturnedCode(masm, Runtime::kCompileOptimized_Concurrent); | 1415 GenerateTailCallToReturnedCode(masm, Runtime::kCompileOptimized_Concurrent); |
1416 } | 1416 } |
1417 | 1417 |
| 1418 void Builtins::Generate_InstantiateAsmJs(MacroAssembler* masm) { |
| 1419 // ----------- S t a t e ------------- |
| 1420 // -- x0 : argument count (preserved for callee) |
| 1421 // -- x1 : new target (preserved for callee) |
| 1422 // -- x3 : target function (preserved for callee) |
| 1423 // ----------------------------------- |
| 1424 Label failed; |
| 1425 { |
| 1426 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1427 // Push a copy of the target function and the new target. |
| 1428 __ SmiTag(x0); |
| 1429 // Push another copy as a parameter to the runtime call. |
| 1430 __ Push(x0, x1, x3, x1); |
| 1431 |
| 1432 // Copy arguments from caller (stdlib, foreign, heap). |
| 1433 for (int i = 2; i >= 0; --i) { |
| 1434 __ ldr(x4, MemOperand(fp, StandardFrameConstants::kCallerSPOffset + |
| 1435 i * kPointerSize)); |
| 1436 __ push(x4); |
| 1437 } |
| 1438 // Call runtime, on success unwind frame, and parent frame. |
| 1439 __ CallRuntime(Runtime::kInstantiateAsmJs, 4); |
| 1440 // A smi 0 is returned on failure, an object on success. |
| 1441 __ JumpIfSmi(x0, &failed); |
| 1442 scope.GenerateLeaveFrame(); |
| 1443 __ Drop(4); |
| 1444 __ Ret(); |
| 1445 |
| 1446 __ bind(&failed); |
| 1447 // Restore target function and new target. |
| 1448 __ Pop(x3, x1, x0); |
| 1449 __ SmiUntag(x0); |
| 1450 } |
| 1451 // On failure, tail call back to regular js. |
| 1452 GenerateTailCallToReturnedCode(masm, Runtime::kCompileLazy); |
| 1453 } |
1418 | 1454 |
1419 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) { | 1455 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) { |
1420 // For now, we are relying on the fact that make_code_young doesn't do any | 1456 // For now, we are relying on the fact that make_code_young doesn't do any |
1421 // garbage collection which allows us to save/restore the registers without | 1457 // garbage collection which allows us to save/restore the registers without |
1422 // worrying about which of them contain pointers. We also don't build an | 1458 // worrying about which of them contain pointers. We also don't build an |
1423 // internal frame to make the code fast, since we shouldn't have to do stack | 1459 // internal frame to make the code fast, since we shouldn't have to do stack |
1424 // crawls in MakeCodeYoung. This seems a bit fragile. | 1460 // crawls in MakeCodeYoung. This seems a bit fragile. |
1425 | 1461 |
1426 // The following caller-saved registers must be saved and restored when | 1462 // The following caller-saved registers must be saved and restored when |
1427 // calling through to the runtime: | 1463 // calling through to the runtime: |
(...skipping 1573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3001 } | 3037 } |
3002 } | 3038 } |
3003 | 3039 |
3004 | 3040 |
3005 #undef __ | 3041 #undef __ |
3006 | 3042 |
3007 } // namespace internal | 3043 } // namespace internal |
3008 } // namespace v8 | 3044 } // namespace v8 |
3009 | 3045 |
3010 #endif // V8_TARGET_ARCH_ARM | 3046 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |