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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
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 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1390 | 1390 |
1391 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { | 1391 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { |
1392 GenerateTailCallToReturnedCode(masm, | 1392 GenerateTailCallToReturnedCode(masm, |
1393 Runtime::kCompileOptimized_NotConcurrent); | 1393 Runtime::kCompileOptimized_NotConcurrent); |
1394 } | 1394 } |
1395 | 1395 |
1396 void Builtins::Generate_CompileOptimizedConcurrent(MacroAssembler* masm) { | 1396 void Builtins::Generate_CompileOptimizedConcurrent(MacroAssembler* masm) { |
1397 GenerateTailCallToReturnedCode(masm, Runtime::kCompileOptimized_Concurrent); | 1397 GenerateTailCallToReturnedCode(masm, Runtime::kCompileOptimized_Concurrent); |
1398 } | 1398 } |
1399 | 1399 |
| 1400 void Builtins::Generate_InstantiateAsmJs(MacroAssembler* masm) { |
| 1401 // ----------- S t a t e ------------- |
| 1402 // -- a0 : argument count (preserved for callee) |
| 1403 // -- a1 : new target (preserved for callee) |
| 1404 // -- a3 : target function (preserved for callee) |
| 1405 // ----------------------------------- |
| 1406 Label failed; |
| 1407 { |
| 1408 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1409 // Push a copy of the target function and the new target. |
| 1410 // Push function as parameter to the runtime call. |
| 1411 __ SmiTag(a0); |
| 1412 __ Push(a0, a1, a3, a1); |
| 1413 |
| 1414 // Copy arguments from caller (stdlib, foreign, heap). |
| 1415 for (int i = 2; i >= 0; --i) { |
| 1416 __ lw(a3, MemOperand(fp, StandardFrameConstants::kCallerSPOffset + |
| 1417 i * kPointerSize)); |
| 1418 __ push(a3); |
| 1419 } |
| 1420 // Call runtime, on success unwind frame, and parent frame. |
| 1421 __ CallRuntime(Runtime::kInstantiateAsmJs, 4); |
| 1422 // A smi 0 is returned on failure, an object on success. |
| 1423 __ JumpIfSmi(a0, &failed); |
| 1424 scope.GenerateLeaveFrame(); |
| 1425 __ Drop(4); |
| 1426 __ Ret(); |
| 1427 |
| 1428 __ bind(&failed); |
| 1429 // Restore target function and new target. |
| 1430 __ Pop(a0, a1, a3); |
| 1431 __ SmiUntag(a0); |
| 1432 } |
| 1433 // On failure, tail call back to regular js. |
| 1434 GenerateTailCallToReturnedCode(masm, Runtime::kCompileLazy); |
| 1435 } |
1400 | 1436 |
1401 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) { | 1437 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) { |
1402 // For now, we are relying on the fact that make_code_young doesn't do any | 1438 // For now, we are relying on the fact that make_code_young doesn't do any |
1403 // garbage collection which allows us to save/restore the registers without | 1439 // garbage collection which allows us to save/restore the registers without |
1404 // worrying about which of them contain pointers. We also don't build an | 1440 // worrying about which of them contain pointers. We also don't build an |
1405 // internal frame to make the code faster, since we shouldn't have to do stack | 1441 // internal frame to make the code faster, since we shouldn't have to do stack |
1406 // crawls in MakeCodeYoung. This seems a bit fragile. | 1442 // crawls in MakeCodeYoung. This seems a bit fragile. |
1407 | 1443 |
1408 // Set a0 to point to the head of the PlatformCodeAge sequence. | 1444 // Set a0 to point to the head of the PlatformCodeAge sequence. |
1409 __ Dsubu(a0, a0, | 1445 __ Dsubu(a0, a0, |
(...skipping 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2960 } | 2996 } |
2961 } | 2997 } |
2962 | 2998 |
2963 | 2999 |
2964 #undef __ | 3000 #undef __ |
2965 | 3001 |
2966 } // namespace internal | 3002 } // namespace internal |
2967 } // namespace v8 | 3003 } // namespace v8 |
2968 | 3004 |
2969 #endif // V8_TARGET_ARCH_MIPS64 | 3005 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |