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

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

Issue 2890023004: [turbofan] Avoid allocating rest parameters for spread calls. (Closed)
Patch Set: Created 3 years, 7 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/mips/builtins-mips.cc ('k') | src/builtins/x64/builtins-x64.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 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_MIPS64 5 #if V8_TARGET_ARCH_MIPS64
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 2191 matching lines...) Expand 10 before | Expand all | Expand 10 after
2202 Label construct; 2202 Label construct;
2203 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); 2203 __ LoadRoot(at, Heap::kUndefinedValueRootIndex);
2204 __ Branch(&construct, ne, a3, Operand(at)); 2204 __ Branch(&construct, ne, a3, Operand(at));
2205 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); 2205 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
2206 __ bind(&construct); 2206 __ bind(&construct);
2207 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); 2207 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET);
2208 } 2208 }
2209 } 2209 }
2210 2210
2211 // static 2211 // static
2212 void Builtins::Generate_CallForwardVarargs(MacroAssembler* masm, 2212 void Builtins::Generate_ForwardVarargs(MacroAssembler* masm,
2213 Handle<Code> code) { 2213 Handle<Code> code) {
2214 // ----------- S t a t e ------------- 2214 // ----------- S t a t e -------------
2215 // -- a1 : the target to call (can be any Object) 2215 // -- a0 : the number of arguments (not including the receiver)
2216 // -- a2 : start index (to support rest parameters) 2216 // -- a3 : the new.target (for [[Construct]] calls)
2217 // -- ra : return address. 2217 // -- a1 : the target to call (can be any Object)
2218 // -- sp[0] : thisArgument 2218 // -- a2 : start index (to support rest parameters)
2219 // ----------------------------------- 2219 // -----------------------------------
2220 2220
2221 // Check if we have an arguments adaptor frame below the function frame. 2221 // Check if we have an arguments adaptor frame below the function frame.
2222 Label arguments_adaptor, arguments_done; 2222 Label arguments_adaptor, arguments_done;
2223 __ Ld(a3, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); 2223 __ Ld(a6, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
2224 __ Ld(a0, MemOperand(a3, CommonFrameConstants::kContextOrFrameTypeOffset)); 2224 __ Ld(a7, MemOperand(a6, CommonFrameConstants::kContextOrFrameTypeOffset));
2225 __ Branch(&arguments_adaptor, eq, a0, 2225 __ Branch(&arguments_adaptor, eq, a7,
2226 Operand(StackFrame::TypeToMarker(StackFrame::ARGUMENTS_ADAPTOR))); 2226 Operand(StackFrame::TypeToMarker(StackFrame::ARGUMENTS_ADAPTOR)));
2227 { 2227 {
2228 __ Ld(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 2228 __ Ld(a7, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
2229 __ Ld(a0, FieldMemOperand(a0, JSFunction::kSharedFunctionInfoOffset)); 2229 __ Ld(a7, FieldMemOperand(a7, JSFunction::kSharedFunctionInfoOffset));
2230 __ Lw(a0, 2230 __ Lw(a7,
2231 FieldMemOperand(a0, SharedFunctionInfo::kFormalParameterCountOffset)); 2231 FieldMemOperand(a7, SharedFunctionInfo::kFormalParameterCountOffset));
2232 __ mov(a3, fp); 2232 __ mov(a6, fp);
2233 } 2233 }
2234 __ Branch(&arguments_done); 2234 __ Branch(&arguments_done);
2235 __ bind(&arguments_adaptor); 2235 __ bind(&arguments_adaptor);
2236 { 2236 {
2237 // Just get the length from the ArgumentsAdaptorFrame. 2237 // Just get the length from the ArgumentsAdaptorFrame.
2238 __ Lw(a0, UntagSmiMemOperand( 2238 __ Lw(a7, UntagSmiMemOperand(
2239 a3, ArgumentsAdaptorFrameConstants::kLengthOffset)); 2239 a6, ArgumentsAdaptorFrameConstants::kLengthOffset));
2240 } 2240 }
2241 __ bind(&arguments_done); 2241 __ bind(&arguments_done);
2242 2242
2243 Label stack_empty, stack_done, stack_overflow; 2243 Label stack_done, stack_overflow;
2244 __ Subu(a0, a0, a2); 2244 __ Subu(a7, a7, a2);
2245 __ Branch(&stack_empty, le, a0, Operand(zero_reg)); 2245 __ Branch(&stack_done, le, a7, Operand(zero_reg));
2246 { 2246 {
2247 // Check for stack overflow. 2247 // Check for stack overflow.
2248 Generate_StackOverflowCheck(masm, a0, a4, a5, &stack_overflow); 2248 Generate_StackOverflowCheck(masm, a7, a4, a5, &stack_overflow);
2249 2249
2250 // Forward the arguments from the caller frame. 2250 // Forward the arguments from the caller frame.
2251 { 2251 {
2252 Label loop; 2252 Label loop;
2253 __ mov(a2, a0); 2253 __ Daddu(a0, a0, a7);
2254 __ bind(&loop); 2254 __ bind(&loop);
2255 { 2255 {
2256 __ Dlsa(at, a3, a2, kPointerSizeLog2); 2256 __ Dlsa(at, a6, a7, kPointerSizeLog2);
2257 __ Ld(at, MemOperand(at, 1 * kPointerSize)); 2257 __ Ld(at, MemOperand(at, 1 * kPointerSize));
2258 __ push(at); 2258 __ push(at);
2259 __ Subu(a2, a2, Operand(1)); 2259 __ Subu(a7, a7, Operand(1));
2260 __ Branch(&loop, ne, a2, Operand(zero_reg)); 2260 __ Branch(&loop, ne, a7, Operand(zero_reg));
2261 } 2261 }
2262 } 2262 }
2263 } 2263 }
2264 __ Branch(&stack_done); 2264 __ Branch(&stack_done);
2265 __ bind(&stack_overflow); 2265 __ bind(&stack_overflow);
2266 __ TailCallRuntime(Runtime::kThrowStackOverflow); 2266 __ TailCallRuntime(Runtime::kThrowStackOverflow);
2267 __ bind(&stack_empty);
2268 {
2269 // We just pass the receiver, which is already on the stack.
2270 __ mov(a0, zero_reg);
2271 }
2272 __ bind(&stack_done); 2267 __ bind(&stack_done);
2273 2268
2269 // Tail-call to the {code} handler.
2274 __ Jump(code, RelocInfo::CODE_TARGET); 2270 __ Jump(code, RelocInfo::CODE_TARGET);
2275 } 2271 }
2276 2272
2277 namespace { 2273 namespace {
2278 2274
2279 // Drops top JavaScript frame and an arguments adaptor frame below it (if 2275 // Drops top JavaScript frame and an arguments adaptor frame below it (if
2280 // present) preserving all the arguments prepared for current call. 2276 // present) preserving all the arguments prepared for current call.
2281 // Does nothing if debugger is currently active. 2277 // Does nothing if debugger is currently active.
2282 // ES6 14.6.3. PrepareForTailCall 2278 // ES6 14.6.3. PrepareForTailCall
2283 // 2279 //
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
3155 __ Daddu(at, v0, Operand(Code::kHeaderSize - kHeapObjectTag)); 3151 __ Daddu(at, v0, Operand(Code::kHeaderSize - kHeapObjectTag));
3156 __ Jump(at); 3152 __ Jump(at);
3157 } 3153 }
3158 3154
3159 #undef __ 3155 #undef __
3160 3156
3161 } // namespace internal 3157 } // namespace internal
3162 } // namespace v8 3158 } // namespace v8
3163 3159
3164 #endif // V8_TARGET_ARCH_MIPS64 3160 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW
« no previous file with comments | « src/builtins/mips/builtins-mips.cc ('k') | src/builtins/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698