OLD | NEW |
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 2283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2294 { | 2294 { |
2295 Label construct; | 2295 Label construct; |
2296 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); | 2296 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
2297 __ Branch(&construct, ne, a3, Operand(at)); | 2297 __ Branch(&construct, ne, a3, Operand(at)); |
2298 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 2298 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
2299 __ bind(&construct); | 2299 __ bind(&construct); |
2300 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | 2300 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
2301 } | 2301 } |
2302 } | 2302 } |
2303 | 2303 |
| 2304 // static |
| 2305 void Builtins::Generate_CallForwardVarargs(MacroAssembler* masm, |
| 2306 Handle<Code> code) { |
| 2307 // ----------- S t a t e ------------- |
| 2308 // -- a1 : the target to call (can be any Object) |
| 2309 // -- a2 : start index (to support rest parameters) |
| 2310 // -- ra : return address. |
| 2311 // -- sp[0] : thisArgument |
| 2312 // ----------------------------------- |
| 2313 |
| 2314 // Check if we have an arguments adaptor frame below the function frame. |
| 2315 Label arguments_adaptor, arguments_done; |
| 2316 __ ld(a3, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
| 2317 __ ld(a0, MemOperand(a3, CommonFrameConstants::kContextOrFrameTypeOffset)); |
| 2318 __ Branch(&arguments_adaptor, eq, a0, |
| 2319 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
| 2320 { |
| 2321 __ ld(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 2322 __ ld(a0, FieldMemOperand(a0, JSFunction::kSharedFunctionInfoOffset)); |
| 2323 __ lw(a0, |
| 2324 FieldMemOperand(a0, SharedFunctionInfo::kFormalParameterCountOffset)); |
| 2325 __ mov(a3, fp); |
| 2326 } |
| 2327 __ Branch(&arguments_done); |
| 2328 __ bind(&arguments_adaptor); |
| 2329 { |
| 2330 // Just get the length from the ArgumentsAdaptorFrame. |
| 2331 __ lw(a0, UntagSmiMemOperand( |
| 2332 a3, ArgumentsAdaptorFrameConstants::kLengthOffset)); |
| 2333 } |
| 2334 __ bind(&arguments_done); |
| 2335 |
| 2336 Label stack_empty, stack_done, stack_overflow; |
| 2337 __ Subu(a0, a0, a2); |
| 2338 __ Branch(&stack_empty, le, a0, Operand(zero_reg)); |
| 2339 { |
| 2340 // Check for stack overflow. |
| 2341 Generate_StackOverflowCheck(masm, a0, a4, a5, &stack_overflow); |
| 2342 |
| 2343 // Forward the arguments from the caller frame. |
| 2344 { |
| 2345 Label loop; |
| 2346 __ mov(a2, a0); |
| 2347 __ bind(&loop); |
| 2348 { |
| 2349 __ Dlsa(at, a3, a2, kPointerSizeLog2); |
| 2350 __ ld(at, MemOperand(at, 1 * kPointerSize)); |
| 2351 __ push(at); |
| 2352 __ Subu(a2, a2, Operand(1)); |
| 2353 __ Branch(&loop, ne, a2, Operand(zero_reg)); |
| 2354 } |
| 2355 } |
| 2356 } |
| 2357 __ Branch(&stack_done); |
| 2358 __ bind(&stack_overflow); |
| 2359 __ TailCallRuntime(Runtime::kThrowStackOverflow); |
| 2360 __ bind(&stack_empty); |
| 2361 { |
| 2362 // We just pass the receiver, which is already on the stack. |
| 2363 __ mov(a0, zero_reg); |
| 2364 } |
| 2365 __ bind(&stack_done); |
| 2366 |
| 2367 __ Jump(code, RelocInfo::CODE_TARGET); |
| 2368 } |
| 2369 |
2304 namespace { | 2370 namespace { |
2305 | 2371 |
2306 // Drops top JavaScript frame and an arguments adaptor frame below it (if | 2372 // Drops top JavaScript frame and an arguments adaptor frame below it (if |
2307 // present) preserving all the arguments prepared for current call. | 2373 // present) preserving all the arguments prepared for current call. |
2308 // Does nothing if debugger is currently active. | 2374 // Does nothing if debugger is currently active. |
2309 // ES6 14.6.3. PrepareForTailCall | 2375 // ES6 14.6.3. PrepareForTailCall |
2310 // | 2376 // |
2311 // Stack structure for the function g() tail calling f(): | 2377 // Stack structure for the function g() tail calling f(): |
2312 // | 2378 // |
2313 // ------- Caller frame: ------- | 2379 // ------- Caller frame: ------- |
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3153 __ break_(0xCC); | 3219 __ break_(0xCC); |
3154 } | 3220 } |
3155 } | 3221 } |
3156 | 3222 |
3157 #undef __ | 3223 #undef __ |
3158 | 3224 |
3159 } // namespace internal | 3225 } // namespace internal |
3160 } // namespace v8 | 3226 } // namespace v8 |
3161 | 3227 |
3162 #endif // V8_TARGET_ARCH_MIPS64 | 3228 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |