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

Unified Diff: src/builtins/mips64/builtins-mips64.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/builtins/mips/builtins-mips.cc ('k') | src/builtins/ppc/builtins-ppc.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/mips64/builtins-mips64.cc
diff --git a/src/builtins/mips64/builtins-mips64.cc b/src/builtins/mips64/builtins-mips64.cc
index 1a190f5a9934e42f999b297d9b14c8a4ee02f39f..cbbe5415264ddb8131cf9764c4f5745c5c29a377 100644
--- a/src/builtins/mips64/builtins-mips64.cc
+++ b/src/builtins/mips64/builtins-mips64.cc
@@ -1438,21 +1438,44 @@ void Builtins::Generate_InstantiateAsmJs(MacroAssembler* masm) {
FrameScope scope(masm, StackFrame::INTERNAL);
// Push a copy of the target function and the new target.
// Push function as parameter to the runtime call.
+ __ Move(t2, a0);
__ SmiTag(a0);
__ Push(a0, a1, a3, a1);
// Copy arguments from caller (stdlib, foreign, heap).
- for (int i = 2; i >= 0; --i) {
- __ lw(a3, MemOperand(fp, StandardFrameConstants::kCallerSPOffset +
- i * kPointerSize));
- __ push(a3);
+ Label args_done;
+ for (int j = 0; j < 4; ++j) {
+ Label over;
+ if (j < 3) {
+ __ Branch(&over, ne, t2, Operand(j));
+ }
+ for (int i = j - 1; i >= 0; --i) {
+ __ lw(t2, MemOperand(fp, StandardFrameConstants::kCallerSPOffset +
+ i * kPointerSize));
+ __ push(t2);
+ }
+ for (int i = 0; i < 3 - j; ++i) {
+ __ PushRoot(Heap::kUndefinedValueRootIndex);
+ }
+ if (j < 3) {
+ __ jmp(&args_done);
+ __ bind(&over);
+ }
}
+ __ bind(&args_done);
+
// Call runtime, on success unwind frame, and parent frame.
__ CallRuntime(Runtime::kInstantiateAsmJs, 4);
// A smi 0 is returned on failure, an object on success.
- __ JumpIfSmi(a0, &failed);
+ __ JumpIfSmi(v0, &failed);
+
+ __ Drop(2);
+ __ pop(t2);
+ __ SmiUntag(t2);
scope.GenerateLeaveFrame();
- __ Drop(4);
+
+ __ Addu(t2, t2, Operand(1));
+ __ Lsa(sp, sp, t2, kPointerSizeLog2);
__ Ret();
__ bind(&failed);
« no previous file with comments | « src/builtins/mips/builtins-mips.cc ('k') | src/builtins/ppc/builtins-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698