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 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 // -- r3 : argument count (preserved for callee) |
| 1421 // -- r4 : new target (preserved for callee) |
| 1422 // -- r6 : 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 // Push function as parameter to the runtime call. |
| 1429 __ SmiTag(r3); |
| 1430 __ Push(r3, r4, r6, r4); |
| 1431 |
| 1432 // Copy arguments from caller (stdlib, foreign, heap). |
| 1433 for (int i = 2; i >= 0; --i) { |
| 1434 __ LoadP(r4, MemOperand(fp, StandardFrameConstants::kCallerSPOffset + |
| 1435 i * kPointerSize)); |
| 1436 __ push(r4); |
| 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(r3, &failed); |
| 1442 scope.GenerateLeaveFrame(); |
| 1443 __ Drop(4); |
| 1444 __ Ret(); |
| 1445 |
| 1446 __ bind(&failed); |
| 1447 // Restore target function and new target. |
| 1448 __ Pop(r3, r4, r6); |
| 1449 __ SmiUntag(r3); |
| 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 faster, since we shouldn't have to do stack | 1459 // internal frame to make the code faster, 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 // Point r3 at the start of the PlatformCodeAge sequence. | 1462 // Point r3 at the start of the PlatformCodeAge sequence. |
1427 __ mr(r3, ip); | 1463 __ mr(r3, ip); |
(...skipping 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2962 __ bkpt(0); | 2998 __ bkpt(0); |
2963 } | 2999 } |
2964 } | 3000 } |
2965 | 3001 |
2966 | 3002 |
2967 #undef __ | 3003 #undef __ |
2968 } // namespace internal | 3004 } // namespace internal |
2969 } // namespace v8 | 3005 } // namespace v8 |
2970 | 3006 |
2971 #endif // V8_TARGET_ARCH_PPC | 3007 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |