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

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

Issue 2655233002: [turbofan] Introduce JSCallForwardVarargs operator. (Closed)
Patch Set: Fix formatting. Created 3 years, 11 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/ia32/builtins-ia32.cc ('k') | src/builtins/mips64/builtins-mips64.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_MIPS 5 #if V8_TARGET_ARCH_MIPS
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 2252 matching lines...) Expand 10 before | Expand all | Expand 10 after
2263 { 2263 {
2264 Label construct; 2264 Label construct;
2265 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); 2265 __ LoadRoot(at, Heap::kUndefinedValueRootIndex);
2266 __ Branch(&construct, ne, a3, Operand(at)); 2266 __ Branch(&construct, ne, a3, Operand(at));
2267 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); 2267 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
2268 __ bind(&construct); 2268 __ bind(&construct);
2269 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); 2269 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET);
2270 } 2270 }
2271 } 2271 }
2272 2272
2273 // static
2274 void Builtins::Generate_CallForwardVarargs(MacroAssembler* masm,
2275 Handle<Code> code) {
2276 // ----------- S t a t e -------------
2277 // -- a1 : the target to call (can be any Object)
2278 // -- a2 : start index (to support rest parameters)
2279 // -- ra : return address.
2280 // -- sp[0] : thisArgument
2281 // -----------------------------------
2282
2283 // Check if we have an arguments adaptor frame below the function frame.
2284 Label arguments_adaptor, arguments_done;
2285 __ lw(a3, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
2286 __ lw(a0, MemOperand(a3, CommonFrameConstants::kContextOrFrameTypeOffset));
2287 __ Branch(&arguments_adaptor, eq, a0,
2288 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
2289 {
2290 __ lw(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
2291 __ lw(a0, FieldMemOperand(a0, JSFunction::kSharedFunctionInfoOffset));
2292 __ lw(a0,
2293 FieldMemOperand(a0, SharedFunctionInfo::kFormalParameterCountOffset));
2294 __ mov(a3, fp);
2295 }
2296 __ Branch(&arguments_done);
2297 __ bind(&arguments_adaptor);
2298 {
2299 // Just get the length from the ArgumentsAdaptorFrame.
2300 __ lw(a0, MemOperand(a3, ArgumentsAdaptorFrameConstants::kLengthOffset));
2301 }
2302 __ bind(&arguments_done);
2303
2304 Label stack_empty, stack_done, stack_overflow;
2305 __ SmiUntag(a0);
2306 __ Subu(a0, a0, a2);
2307 __ Branch(&stack_empty, le, a0, Operand(zero_reg));
2308 {
2309 // Check for stack overflow.
2310 Generate_StackOverflowCheck(masm, a0, t0, t1, &stack_overflow);
2311
2312 // Forward the arguments from the caller frame.
2313 {
2314 Label loop;
2315 __ mov(a2, a0);
2316 __ bind(&loop);
2317 {
2318 __ Lsa(at, a3, a2, kPointerSizeLog2);
2319 __ lw(at, MemOperand(at, 1 * kPointerSize));
2320 __ push(at);
2321 __ Subu(a2, a2, Operand(1));
2322 __ Branch(&loop, ne, a2, Operand(zero_reg));
2323 }
2324 }
2325 }
2326 __ Branch(&stack_done);
2327 __ bind(&stack_overflow);
2328 __ TailCallRuntime(Runtime::kThrowStackOverflow);
2329 __ bind(&stack_empty);
2330 {
2331 // We just pass the receiver, which is already on the stack.
2332 __ li(a0, Operand(0));
2333 }
2334 __ bind(&stack_done);
2335
2336 __ Jump(code, RelocInfo::CODE_TARGET);
2337 }
2338
2273 namespace { 2339 namespace {
2274 2340
2275 // Drops top JavaScript frame and an arguments adaptor frame below it (if 2341 // Drops top JavaScript frame and an arguments adaptor frame below it (if
2276 // present) preserving all the arguments prepared for current call. 2342 // present) preserving all the arguments prepared for current call.
2277 // Does nothing if debugger is currently active. 2343 // Does nothing if debugger is currently active.
2278 // ES6 14.6.3. PrepareForTailCall 2344 // ES6 14.6.3. PrepareForTailCall
2279 // 2345 //
2280 // Stack structure for the function g() tail calling f(): 2346 // Stack structure for the function g() tail calling f():
2281 // 2347 //
2282 // ------- Caller frame: ------- 2348 // ------- Caller frame: -------
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after
3129 __ break_(0xCC); 3195 __ break_(0xCC);
3130 } 3196 }
3131 } 3197 }
3132 3198
3133 #undef __ 3199 #undef __
3134 3200
3135 } // namespace internal 3201 } // namespace internal
3136 } // namespace v8 3202 } // namespace v8
3137 3203
3138 #endif // V8_TARGET_ARCH_MIPS 3204 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/builtins/ia32/builtins-ia32.cc ('k') | src/builtins/mips64/builtins-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698