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

Side by Side Diff: src/builtins/arm64/builtins-arm64.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/arm/builtins-arm.cc ('k') | src/builtins/ia32/builtins-ia32.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_ARM64 5 #if V8_TARGET_ARCH_ARM64
6 6
7 #include "src/arm64/frames-arm64.h" 7 #include "src/arm64/frames-arm64.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/debug/debug.h" 9 #include "src/debug/debug.h"
10 #include "src/deoptimizer.h" 10 #include "src/deoptimizer.h"
(...skipping 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after
1439 1439
1440 void Builtins::Generate_InstantiateAsmJs(MacroAssembler* masm) { 1440 void Builtins::Generate_InstantiateAsmJs(MacroAssembler* masm) {
1441 // ----------- S t a t e ------------- 1441 // ----------- S t a t e -------------
1442 // -- x0 : argument count (preserved for callee) 1442 // -- x0 : argument count (preserved for callee)
1443 // -- x1 : new target (preserved for callee) 1443 // -- x1 : new target (preserved for callee)
1444 // -- x3 : target function (preserved for callee) 1444 // -- x3 : target function (preserved for callee)
1445 // ----------------------------------- 1445 // -----------------------------------
1446 Label failed; 1446 Label failed;
1447 { 1447 {
1448 FrameScope scope(masm, StackFrame::INTERNAL); 1448 FrameScope scope(masm, StackFrame::INTERNAL);
1449 // Preserve argument count for later compare.
1450 __ Move(x4, x0);
1449 // Push a copy of the target function and the new target. 1451 // Push a copy of the target function and the new target.
1450 __ SmiTag(x0); 1452 __ SmiTag(x0);
1451 // Push another copy as a parameter to the runtime call. 1453 // Push another copy as a parameter to the runtime call.
1452 __ Push(x0, x1, x3, x1); 1454 __ Push(x0, x1, x3, x1);
1453 1455
1454 // Copy arguments from caller (stdlib, foreign, heap). 1456 // Copy arguments from caller (stdlib, foreign, heap).
1455 for (int i = 2; i >= 0; --i) { 1457 Label args_done;
1456 __ ldr(x4, MemOperand(fp, StandardFrameConstants::kCallerSPOffset + 1458 for (int j = 0; j < 4; ++j) {
1457 i * kPointerSize)); 1459 Label over;
1458 __ push(x4); 1460 if (j < 3) {
1461 __ cmp(x4, Operand(j));
1462 __ B(ne, &over);
1463 }
1464 for (int i = j - 1; i >= 0; --i) {
1465 __ ldr(x4, MemOperand(fp, StandardFrameConstants::kCallerSPOffset +
1466 i * kPointerSize));
1467 __ push(x4);
1468 }
1469 for (int i = 0; i < 3 - j; ++i) {
1470 __ PushRoot(Heap::kUndefinedValueRootIndex);
1471 }
1472 if (j < 3) {
1473 __ jmp(&args_done);
1474 __ bind(&over);
1475 }
1459 } 1476 }
1477 __ bind(&args_done);
1478
1460 // Call runtime, on success unwind frame, and parent frame. 1479 // Call runtime, on success unwind frame, and parent frame.
1461 __ CallRuntime(Runtime::kInstantiateAsmJs, 4); 1480 __ CallRuntime(Runtime::kInstantiateAsmJs, 4);
1462 // A smi 0 is returned on failure, an object on success. 1481 // A smi 0 is returned on failure, an object on success.
1463 __ JumpIfSmi(x0, &failed); 1482 __ JumpIfSmi(x0, &failed);
1483
1484 __ Drop(2);
1485 __ pop(x4);
1486 __ SmiUntag(x4);
1464 scope.GenerateLeaveFrame(); 1487 scope.GenerateLeaveFrame();
1465 __ Drop(4); 1488
1489 __ add(x4, x4, Operand(1));
1490 __ Drop(x4);
1466 __ Ret(); 1491 __ Ret();
1467 1492
1468 __ bind(&failed); 1493 __ bind(&failed);
1469 // Restore target function and new target. 1494 // Restore target function and new target.
1470 __ Pop(x3, x1, x0); 1495 __ Pop(x3, x1, x0);
1471 __ SmiUntag(x0); 1496 __ SmiUntag(x0);
1472 } 1497 }
1473 // On failure, tail call back to regular js. 1498 // On failure, tail call back to regular js.
1474 GenerateTailCallToReturnedCode(masm, Runtime::kCompileLazy); 1499 GenerateTailCallToReturnedCode(masm, Runtime::kCompileLazy);
1475 } 1500 }
(...skipping 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after
3010 __ Unreachable(); 3035 __ Unreachable();
3011 } 3036 }
3012 } 3037 }
3013 3038
3014 #undef __ 3039 #undef __
3015 3040
3016 } // namespace internal 3041 } // namespace internal
3017 } // namespace v8 3042 } // namespace v8
3018 3043
3019 #endif // V8_TARGET_ARCH_ARM 3044 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/builtins/arm/builtins-arm.cc ('k') | src/builtins/ia32/builtins-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698