Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: src/builtins/ppc/builtins-ppc.cc

Issue 2229723002: [wasm] Support validation of asm.js modules with != 3 args. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: mips and more Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/builtins/mips64/builtins-mips64.cc ('k') | src/builtins/s390/builtins-s390.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1440 matching lines...) Expand 10 before | Expand all | Expand 10 after
1451 1451
1452 void Builtins::Generate_InstantiateAsmJs(MacroAssembler* masm) { 1452 void Builtins::Generate_InstantiateAsmJs(MacroAssembler* masm) {
1453 // ----------- S t a t e ------------- 1453 // ----------- S t a t e -------------
1454 // -- r3 : argument count (preserved for callee) 1454 // -- r3 : argument count (preserved for callee)
1455 // -- r4 : new target (preserved for callee) 1455 // -- r4 : new target (preserved for callee)
1456 // -- r6 : target function (preserved for callee) 1456 // -- r6 : target function (preserved for callee)
1457 // ----------------------------------- 1457 // -----------------------------------
1458 Label failed; 1458 Label failed;
1459 { 1459 {
1460 FrameScope scope(masm, StackFrame::INTERNAL); 1460 FrameScope scope(masm, StackFrame::INTERNAL);
1461 // Preserve argument count for later compare.
1462 __ Move(r5, r3);
1461 // Push a copy of the target function and the new target. 1463 // Push a copy of the target function and the new target.
1462 // Push function as parameter to the runtime call. 1464 // Push function as parameter to the runtime call.
1463 __ SmiTag(r3); 1465 __ SmiTag(r3);
1464 __ Push(r3, r4, r6, r4); 1466 __ Push(r3, r4, r6, r4);
1465 1467
1466 // Copy arguments from caller (stdlib, foreign, heap). 1468 // Copy arguments from caller (stdlib, foreign, heap).
1467 for (int i = 2; i >= 0; --i) { 1469 Label args_done;
1468 __ LoadP(r4, MemOperand(fp, StandardFrameConstants::kCallerSPOffset + 1470 for (int j = 0; j < 4; ++j) {
1469 i * kPointerSize)); 1471 Label over;
1470 __ push(r4); 1472 if (j < 3) {
1473 __ cmpi(r5, Operand(j));
1474 __ bne(&over);
1475 }
1476 for (int i = j - 1; i >= 0; --i) {
1477 __ LoadP(r5, MemOperand(fp, StandardFrameConstants::kCallerSPOffset +
1478 i * kPointerSize));
1479 __ push(r5);
1480 }
1481 for (int i = 0; i < 3 - j; ++i) {
1482 __ PushRoot(Heap::kUndefinedValueRootIndex);
1483 }
1484 if (j < 3) {
1485 __ jmp(&args_done);
1486 __ bind(&over);
1487 }
1471 } 1488 }
1489 __ bind(&args_done);
1490
1472 // Call runtime, on success unwind frame, and parent frame. 1491 // Call runtime, on success unwind frame, and parent frame.
1473 __ CallRuntime(Runtime::kInstantiateAsmJs, 4); 1492 __ CallRuntime(Runtime::kInstantiateAsmJs, 4);
1474 // A smi 0 is returned on failure, an object on success. 1493 // A smi 0 is returned on failure, an object on success.
1475 __ JumpIfSmi(r3, &failed); 1494 __ JumpIfSmi(r3, &failed);
1495
1496 __ Drop(2);
1497 __ pop(r5);
1498 __ SmiUntag(r5);
1476 scope.GenerateLeaveFrame(); 1499 scope.GenerateLeaveFrame();
1477 __ Drop(4); 1500
1501 __ Drop(r5);
1478 __ Ret(); 1502 __ Ret();
1479 1503
1480 __ bind(&failed); 1504 __ bind(&failed);
1481 // Restore target function and new target. 1505 // Restore target function and new target.
1482 __ Pop(r3, r4, r6); 1506 __ Pop(r3, r4, r6);
1483 __ SmiUntag(r3); 1507 __ SmiUntag(r3);
1484 } 1508 }
1485 // On failure, tail call back to regular js. 1509 // On failure, tail call back to regular js.
1486 GenerateTailCallToReturnedCode(masm, Runtime::kCompileLazy); 1510 GenerateTailCallToReturnedCode(masm, Runtime::kCompileLazy);
1487 } 1511 }
(...skipping 1491 matching lines...) Expand 10 before | Expand all | Expand 10 after
2979 __ CallRuntime(Runtime::kThrowStackOverflow); 3003 __ CallRuntime(Runtime::kThrowStackOverflow);
2980 __ bkpt(0); 3004 __ bkpt(0);
2981 } 3005 }
2982 } 3006 }
2983 3007
2984 #undef __ 3008 #undef __
2985 } // namespace internal 3009 } // namespace internal
2986 } // namespace v8 3010 } // namespace v8
2987 3011
2988 #endif // V8_TARGET_ARCH_PPC 3012 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/builtins/mips64/builtins-mips64.cc ('k') | src/builtins/s390/builtins-s390.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698