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_S390 | 5 #if V8_TARGET_ARCH_S390 |
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 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1388 | 1388 |
1389 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { | 1389 void Builtins::Generate_CompileOptimized(MacroAssembler* masm) { |
1390 GenerateTailCallToReturnedCode(masm, | 1390 GenerateTailCallToReturnedCode(masm, |
1391 Runtime::kCompileOptimized_NotConcurrent); | 1391 Runtime::kCompileOptimized_NotConcurrent); |
1392 } | 1392 } |
1393 | 1393 |
1394 void Builtins::Generate_CompileOptimizedConcurrent(MacroAssembler* masm) { | 1394 void Builtins::Generate_CompileOptimizedConcurrent(MacroAssembler* masm) { |
1395 GenerateTailCallToReturnedCode(masm, Runtime::kCompileOptimized_Concurrent); | 1395 GenerateTailCallToReturnedCode(masm, Runtime::kCompileOptimized_Concurrent); |
1396 } | 1396 } |
1397 | 1397 |
| 1398 void Builtins::Generate_InstantiateAsmJs(MacroAssembler* masm) { |
| 1399 // ----------- S t a t e ------------- |
| 1400 // -- r2 : argument count (preserved for callee) |
| 1401 // -- r3 : new target (preserved for callee) |
| 1402 // -- r5 : target function (preserved for callee) |
| 1403 // ----------------------------------- |
| 1404 Label failed; |
| 1405 { |
| 1406 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1407 // Push a copy of the target function and the new target. |
| 1408 __ SmiTag(r2); |
| 1409 // Push another copy as a parameter to the runtime call. |
| 1410 __ Push(r2, r3, r5, r3); |
| 1411 |
| 1412 // Copy arguments from caller (stdlib, foreign, heap). |
| 1413 for (int i = 2; i >= 0; --i) { |
| 1414 __ LoadP(r4, MemOperand(fp, StandardFrameConstants::kCallerSPOffset + |
| 1415 i * kPointerSize)); |
| 1416 __ push(r4); |
| 1417 } |
| 1418 // Call runtime, on success unwind frame, and parent frame. |
| 1419 __ CallRuntime(Runtime::kInstantiateAsmJs, 4); |
| 1420 // A smi 0 is returned on failure, an object on success. |
| 1421 __ JumpIfSmi(r2, &failed); |
| 1422 scope.GenerateLeaveFrame(); |
| 1423 __ Drop(4); |
| 1424 __ Ret(); |
| 1425 |
| 1426 __ bind(&failed); |
| 1427 // Restore target function and new target. |
| 1428 __ Pop(r2, r3, r5); |
| 1429 __ SmiUntag(r2); |
| 1430 } |
| 1431 // On failure, tail call into generated baseline code. |
| 1432 GenerateTailCallToReturnedCode(masm, Runtime::kCompileBaseline); |
| 1433 } |
| 1434 |
1398 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) { | 1435 static void GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) { |
1399 // For now, we are relying on the fact that make_code_young doesn't do any | 1436 // For now, we are relying on the fact that make_code_young doesn't do any |
1400 // garbage collection which allows us to save/restore the registers without | 1437 // garbage collection which allows us to save/restore the registers without |
1401 // worrying about which of them contain pointers. We also don't build an | 1438 // worrying about which of them contain pointers. We also don't build an |
1402 // internal frame to make the code faster, since we shouldn't have to do stack | 1439 // internal frame to make the code faster, since we shouldn't have to do stack |
1403 // crawls in MakeCodeYoung. This seems a bit fragile. | 1440 // crawls in MakeCodeYoung. This seems a bit fragile. |
1404 | 1441 |
1405 // Point r2 at the start of the PlatformCodeAge sequence. | 1442 // Point r2 at the start of the PlatformCodeAge sequence. |
1406 __ CleanseP(r14); | 1443 __ CleanseP(r14); |
1407 __ SubP(r14, Operand(kCodeAgingSequenceLength)); | 1444 __ SubP(r14, Operand(kCodeAgingSequenceLength)); |
(...skipping 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2918 __ bkpt(0); | 2955 __ bkpt(0); |
2919 } | 2956 } |
2920 } | 2957 } |
2921 | 2958 |
2922 #undef __ | 2959 #undef __ |
2923 | 2960 |
2924 } // namespace internal | 2961 } // namespace internal |
2925 } // namespace v8 | 2962 } // namespace v8 |
2926 | 2963 |
2927 #endif // V8_TARGET_ARCH_S390 | 2964 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |