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

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

Issue 2057403003: Hooking up asm-wasm conversion. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 4 years, 5 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
« src/runtime/runtime-compiler.cc ('K') | « src/wasm/wasm-js.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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_X64 5 #if V8_TARGET_ARCH_X64
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/codegen.h" 8 #include "src/codegen.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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 // Restore target function and new target. 83 // Restore target function and new target.
84 __ Pop(rdx); 84 __ Pop(rdx);
85 __ Pop(rdi); 85 __ Pop(rdi);
86 __ Pop(rax); 86 __ Pop(rax);
87 __ SmiToInteger32(rax, rax); 87 __ SmiToInteger32(rax, rax);
88 } 88 }
89 __ leap(rbx, FieldOperand(rbx, Code::kHeaderSize)); 89 __ leap(rbx, FieldOperand(rbx, Code::kHeaderSize));
90 __ jmp(rbx); 90 __ jmp(rbx);
91 } 91 }
92 92
93 void Builtins::Generate_InstantiateAsmJs(MacroAssembler* masm) {
94 // ----------- S t a t e -------------
95 // -- rax : argument count (preserved for callee)
96 // -- rdx : new target (preserved for callee)
97 // -- rdi : target function (preserved for callee)
98 // -----------------------------------
99 Label failed;
100 {
101 FrameScope scope(masm, StackFrame::INTERNAL);
102 // Push the number of arguments to the callee.
103 __ Integer32ToSmi(rax, rax);
104 __ Push(rax);
105 // Push a copy of the target function and the new target.
106 __ Push(rdi);
107 __ Push(rdx);
108
109 // The function.
110 __ Push(rdi);
111 // Pick the 'stdlib' from the parent frame.
112 __ Push(Operand(rsp, 10 * kPointerSize));
Michael Starzinger 2016/06/29 08:29:23 nit: Magic constant '10' is being magic. Can we ex
bradn 2016/06/30 07:59:36 Done.
113 // Pick the 'foreign' from the parent frame.
114 __ Push(Operand(rsp, 10 * kPointerSize));
115 // Pick the 'heap' from the parent frame.
116 __ Push(Operand(rsp, 10 * kPointerSize));
117 // Call runtime, on success unwind frame, and parent frame.
118 __ CallRuntime(Runtime::kInstantiateAsmJs, 4);
119 // A smi 0 is returned on failure, an object on success.
120 __ JumpIfSmi(rax, &failed, Label::kNear);
121 scope.GenerateLeaveFrame();
122 __ ret(4 * kPointerSize);
123
124 __ bind(&failed);
125 // Restore target function and new target.
126 __ Pop(rdx);
127 __ Pop(rdi);
128 __ Pop(rax);
129 __ SmiToInteger32(rax, rax);
130 }
131 // On failure, tail call into generated baseline code.
132 GenerateTailCallToReturnedCode(masm, Runtime::kCompileBaseline);
133 }
93 134
94 void Builtins::Generate_InOptimizationQueue(MacroAssembler* masm) { 135 void Builtins::Generate_InOptimizationQueue(MacroAssembler* masm) {
95 // Checking whether the queued function is ready for install is optional, 136 // Checking whether the queued function is ready for install is optional,
96 // since we come across interrupts and stack checks elsewhere. However, 137 // since we come across interrupts and stack checks elsewhere. However,
97 // not checking may delay installing ready functions, and always checking 138 // not checking may delay installing ready functions, and always checking
98 // would be quite expensive. A good compromise is to first check against 139 // would be quite expensive. A good compromise is to first check against
99 // stack limit as a cue for an interrupt signal. 140 // stack limit as a cue for an interrupt signal.
100 Label ok; 141 Label ok;
101 __ CompareRoot(rsp, Heap::kStackLimitRootIndex); 142 __ CompareRoot(rsp, Heap::kStackLimitRootIndex);
102 __ j(above_equal, &ok); 143 __ j(above_equal, &ok);
(...skipping 2937 matching lines...) Expand 10 before | Expand all | Expand 10 after
3040 __ ret(0); 3081 __ ret(0);
3041 } 3082 }
3042 3083
3043 3084
3044 #undef __ 3085 #undef __
3045 3086
3046 } // namespace internal 3087 } // namespace internal
3047 } // namespace v8 3088 } // namespace v8
3048 3089
3049 #endif // V8_TARGET_ARCH_X64 3090 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/runtime/runtime-compiler.cc ('K') | « src/wasm/wasm-js.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698