OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 5 #if V8_TARGET_ARCH_PPC |
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 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1406 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { | 1406 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { |
1407 GenerateTailCallToReturnedCode(masm, | 1407 GenerateTailCallToReturnedCode(masm, |
1408 Runtime::kCompileOptimized_NotConcurrent); | 1408 Runtime::kCompileOptimized_NotConcurrent); |
1409 } | 1409 } |
1410 | 1410 |
1411 | 1411 |
1412 void Builtins::Generate_CompileOptimizedConcurrent(MacroAssembler* masm) { | 1412 void Builtins::Generate_CompileOptimizedConcurrent(MacroAssembler* masm) { |
1413 GenerateTailCallToReturnedCode(masm, Runtime::kCompileOptimized_Concurrent); | 1413 GenerateTailCallToReturnedCode(masm, Runtime::kCompileOptimized_Concurrent); |
1414 } | 1414 } |
1415 | 1415 |
| 1416 void Builtins::Generate_InstantiateAsmJs(MacroAssembler* masm) { |
| 1417 // ----------- S t a t e ------------- |
| 1418 // -- r3 : argument count (preserved for callee) |
| 1419 // -- r4 : new target (preserved for callee) |
| 1420 // -- r6 : target function (preserved for callee) |
| 1421 // ----------------------------------- |
| 1422 Label failed; |
| 1423 { |
| 1424 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1425 // Push a copy of the target function and the new target. |
| 1426 // Push function as parameter to the runtime call. |
| 1427 __ SmiTag(r3); |
| 1428 __ Push(r3, r4, r6, r4); |
| 1429 |
| 1430 // Copy arguments from caller (stdlib, foreign, heap). |
| 1431 for (int i = 2; i >= 0; --i) { |
| 1432 __ LoadP(r4, MemOperand(fp, StandardFrameConstants::kCallerSPOffset + |
| 1433 i * kPointerSize)); |
| 1434 __ push(r4); |
| 1435 } |
| 1436 // Call runtime, on success unwind frame, and parent frame. |
| 1437 __ CallRuntime(Runtime::kInstantiateAsmJs, 4); |
| 1438 // A smi 0 is returned on failure, an object on success. |
| 1439 __ JumpIfSmi(r3, &failed); |
| 1440 scope.GenerateLeaveFrame(); |
| 1441 __ Drop(4); |
| 1442 __ Ret(); |
| 1443 |
| 1444 __ bind(&failed); |
| 1445 // Restore target function and new target. |
| 1446 __ Pop(r3, r4, r6); |
| 1447 __ SmiUntag(r3); |
| 1448 } |
| 1449 // On failure, tail call into generated baseline code. |
| 1450 GenerateTailCallToReturnedCode(masm, Runtime::kCompileBaseline); |
| 1451 } |
1416 | 1452 |
1417 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) { | 1453 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) { |
1418 // For now, we are relying on the fact that make_code_young doesn't do any | 1454 // For now, we are relying on the fact that make_code_young doesn't do any |
1419 // garbage collection which allows us to save/restore the registers without | 1455 // garbage collection which allows us to save/restore the registers without |
1420 // worrying about which of them contain pointers. We also don't build an | 1456 // worrying about which of them contain pointers. We also don't build an |
1421 // internal frame to make the code faster, since we shouldn't have to do stack | 1457 // internal frame to make the code faster, since we shouldn't have to do stack |
1422 // crawls in MakeCodeYoung. This seems a bit fragile. | 1458 // crawls in MakeCodeYoung. This seems a bit fragile. |
1423 | 1459 |
1424 // Point r3 at the start of the PlatformCodeAge sequence. | 1460 // Point r3 at the start of the PlatformCodeAge sequence. |
1425 __ mr(r3, ip); | 1461 __ mr(r3, ip); |
(...skipping 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2960 __ bkpt(0); | 2996 __ bkpt(0); |
2961 } | 2997 } |
2962 } | 2998 } |
2963 | 2999 |
2964 | 3000 |
2965 #undef __ | 3001 #undef __ |
2966 } // namespace internal | 3002 } // namespace internal |
2967 } // namespace v8 | 3003 } // namespace v8 |
2968 | 3004 |
2969 #endif // V8_TARGET_ARCH_PPC | 3005 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |