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_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
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 // -- a0 : argument count (preserved for callee) |
| 1419 // -- a1 : new target (preserved for callee) |
| 1420 // -- a3 : 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(a0); |
| 1428 __ Push(a0, a1, a3, a1); |
| 1429 |
| 1430 // Copy arguments from caller (stdlib, foreign, heap). |
| 1431 for (int i = 2; i >= 0; --i) { |
| 1432 __ lw(a3, MemOperand(fp, StandardFrameConstants::kCallerSPOffset + |
| 1433 i * kPointerSize)); |
| 1434 __ push(a3); |
| 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(a0, &failed); |
| 1440 scope.GenerateLeaveFrame(); |
| 1441 __ Drop(4); |
| 1442 __ Ret(); |
| 1443 |
| 1444 __ bind(&failed); |
| 1445 // Restore target function and new target. |
| 1446 __ Pop(a0, a1, a3); |
| 1447 __ SmiUntag(a0); |
| 1448 } |
| 1449 // On failure, tail call back to regular js. |
| 1450 GenerateTailCallToReturnedCode(masm, Runtime::kCompileLazy); |
| 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 // Set a0 to point to the head of the PlatformCodeAge sequence. | 1460 // Set a0 to point to the head of the PlatformCodeAge sequence. |
1425 __ Subu(a0, a0, | 1461 __ Subu(a0, a0, |
(...skipping 1546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2972 } | 3008 } |
2973 } | 3009 } |
2974 | 3010 |
2975 | 3011 |
2976 #undef __ | 3012 #undef __ |
2977 | 3013 |
2978 } // namespace internal | 3014 } // namespace internal |
2979 } // namespace v8 | 3015 } // namespace v8 |
2980 | 3016 |
2981 #endif // V8_TARGET_ARCH_MIPS | 3017 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |