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

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: file change 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
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 __ pop(r5);
1497 __ pop(r5);
1498 __ pop(r5);
1499 __ SmiUntag(r5);
1476 scope.GenerateLeaveFrame(); 1500 scope.GenerateLeaveFrame();
1477 __ Drop(4); 1501
1502 __ Drop(r5);
1478 __ Ret(); 1503 __ Ret();
1479 1504
1480 __ bind(&failed); 1505 __ bind(&failed);
1481 // Restore target function and new target. 1506 // Restore target function and new target.
1482 __ Pop(r3, r4, r6); 1507 __ Pop(r3, r4, r6);
1483 __ SmiUntag(r3); 1508 __ SmiUntag(r3);
1484 } 1509 }
1485 // On failure, tail call back to regular js. 1510 // On failure, tail call back to regular js.
1486 GenerateTailCallToReturnedCode(masm, Runtime::kCompileLazy); 1511 GenerateTailCallToReturnedCode(masm, Runtime::kCompileLazy);
1487 } 1512 }
(...skipping 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after
3004 __ CallRuntime(Runtime::kThrowStackOverflow); 3029 __ CallRuntime(Runtime::kThrowStackOverflow);
3005 __ bkpt(0); 3030 __ bkpt(0);
3006 } 3031 }
3007 } 3032 }
3008 3033
3009 #undef __ 3034 #undef __
3010 } // namespace internal 3035 } // namespace internal
3011 } // namespace v8 3036 } // namespace v8
3012 3037
3013 #endif // V8_TARGET_ARCH_PPC 3038 #endif // V8_TARGET_ARCH_PPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698