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