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_ARM | 5 #if V8_TARGET_ARCH_ARM |
6 | 6 |
7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.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 1400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1411 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { | 1411 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { |
1412 GenerateTailCallToReturnedCode(masm, | 1412 GenerateTailCallToReturnedCode(masm, |
1413 Runtime::kCompileOptimized_NotConcurrent); | 1413 Runtime::kCompileOptimized_NotConcurrent); |
1414 } | 1414 } |
1415 | 1415 |
1416 | 1416 |
1417 void Builtins::Generate_CompileOptimizedConcurrent(MacroAssembler* masm) { | 1417 void Builtins::Generate_CompileOptimizedConcurrent(MacroAssembler* masm) { |
1418 GenerateTailCallToReturnedCode(masm, Runtime::kCompileOptimized_Concurrent); | 1418 GenerateTailCallToReturnedCode(masm, Runtime::kCompileOptimized_Concurrent); |
1419 } | 1419 } |
1420 | 1420 |
| 1421 void Builtins::Generate_InstantiateAsmJs(MacroAssembler* masm) { |
| 1422 // ----------- S t a t e ------------- |
| 1423 // -- r0 : argument count (preserved for callee) |
| 1424 // -- r1 : new target (preserved for callee) |
| 1425 // -- r3 : target function (preserved for callee) |
| 1426 // ----------------------------------- |
| 1427 Label failed; |
| 1428 { |
| 1429 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1430 // Push the number of arguments to the callee. |
| 1431 __ SmiTag(r0); |
| 1432 __ push(r0); |
| 1433 // Push a copy of the target function and the new target. |
| 1434 __ push(r1); |
| 1435 __ push(r3); |
| 1436 |
| 1437 // The function. |
| 1438 __ push(r1); |
| 1439 // Copy arguments from caller (stdlib, foreign, heap). |
| 1440 for (int i = 2; i >= 0; --i) { |
| 1441 __ ldr(r4, MemOperand(fp, StandardFrameConstants::kCallerSPOffset + |
| 1442 i * kPointerSize)); |
| 1443 __ push(r4); |
| 1444 } |
| 1445 // Call runtime, on success unwind frame, and parent frame. |
| 1446 __ CallRuntime(Runtime::kInstantiateAsmJs, 4); |
| 1447 // A smi 0 is returned on failure, an object on success. |
| 1448 __ JumpIfSmi(r0, &failed); |
| 1449 scope.GenerateLeaveFrame(); |
| 1450 __ Drop(4); |
| 1451 __ Ret(); |
| 1452 |
| 1453 __ bind(&failed); |
| 1454 // Restore target function and new target. |
| 1455 __ pop(r3); |
| 1456 __ pop(r1); |
| 1457 __ pop(r0); |
| 1458 __ SmiUntag(r0); |
| 1459 } |
| 1460 // On failure, tail call back to regular js. |
| 1461 GenerateTailCallToReturnedCode(masm, Runtime::kCompileLazy); |
| 1462 } |
1421 | 1463 |
1422 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) { | 1464 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) { |
1423 // For now, we are relying on the fact that make_code_young doesn't do any | 1465 // For now, we are relying on the fact that make_code_young doesn't do any |
1424 // garbage collection which allows us to save/restore the registers without | 1466 // garbage collection which allows us to save/restore the registers without |
1425 // worrying about which of them contain pointers. We also don't build an | 1467 // worrying about which of them contain pointers. We also don't build an |
1426 // internal frame to make the code faster, since we shouldn't have to do stack | 1468 // internal frame to make the code faster, since we shouldn't have to do stack |
1427 // crawls in MakeCodeYoung. This seems a bit fragile. | 1469 // crawls in MakeCodeYoung. This seems a bit fragile. |
1428 | 1470 |
1429 // The following registers must be saved and restored when calling through to | 1471 // The following registers must be saved and restored when calling through to |
1430 // the runtime: | 1472 // the runtime: |
(...skipping 1447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2878 } | 2920 } |
2879 } | 2921 } |
2880 | 2922 |
2881 | 2923 |
2882 #undef __ | 2924 #undef __ |
2883 | 2925 |
2884 } // namespace internal | 2926 } // namespace internal |
2885 } // namespace v8 | 2927 } // namespace v8 |
2886 | 2928 |
2887 #endif // V8_TARGET_ARCH_ARM | 2929 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |