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_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 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1190 __ bind(&stack_overflow); | 1190 __ bind(&stack_overflow); |
1191 { | 1191 { |
1192 __ TailCallRuntime(Runtime::kThrowStackOverflow); | 1192 __ TailCallRuntime(Runtime::kThrowStackOverflow); |
1193 // Unreachable code. | 1193 // Unreachable code. |
1194 __ break_(0xCC); | 1194 __ break_(0xCC); |
1195 } | 1195 } |
1196 } | 1196 } |
1197 | 1197 |
1198 // static | 1198 // static |
1199 void Builtins::Generate_InterpreterPushArgsAndConstructImpl( | 1199 void Builtins::Generate_InterpreterPushArgsAndConstructImpl( |
1200 MacroAssembler* masm, CallableType construct_type) { | 1200 MacroAssembler* masm, PushArgsConstructMode mode) { |
1201 // ----------- S t a t e ------------- | 1201 // ----------- S t a t e ------------- |
1202 // -- a0 : argument count (not including receiver) | 1202 // -- a0 : argument count (not including receiver) |
1203 // -- a3 : new target | 1203 // -- a3 : new target |
1204 // -- a1 : constructor to call | 1204 // -- a1 : constructor to call |
1205 // -- a2 : allocation site feedback if available, undefined otherwise. | 1205 // -- a2 : allocation site feedback if available, undefined otherwise. |
1206 // -- t4 : address of the first argument | 1206 // -- t4 : address of the first argument |
1207 // ----------------------------------- | 1207 // ----------------------------------- |
1208 Label stack_overflow; | 1208 Label stack_overflow; |
1209 | 1209 |
1210 // Push a slot for the receiver. | 1210 // Push a slot for the receiver. |
1211 __ push(zero_reg); | 1211 __ push(zero_reg); |
1212 | 1212 |
1213 // This function modified t4, t1 and t0. | 1213 // This function modified t4, t1 and t0. |
1214 Generate_InterpreterPushArgs(masm, a0, t4, t1, t0, &stack_overflow); | 1214 Generate_InterpreterPushArgs(masm, a0, t4, t1, t0, &stack_overflow); |
1215 | 1215 |
1216 __ AssertUndefinedOrAllocationSite(a2, t0); | 1216 __ AssertUndefinedOrAllocationSite(a2, t0); |
1217 if (construct_type == CallableType::kJSFunction) { | 1217 if (mode == PushArgsConstructMode::kJSFunction) { |
1218 __ AssertFunction(a1); | 1218 __ AssertFunction(a1); |
1219 | 1219 |
1220 // Tail call to the function-specific construct stub (still in the caller | 1220 // Tail call to the function-specific construct stub (still in the caller |
1221 // context at this point). | 1221 // context at this point). |
1222 __ lw(t0, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); | 1222 __ lw(t0, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
1223 __ lw(t0, FieldMemOperand(t0, SharedFunctionInfo::kConstructStubOffset)); | 1223 __ lw(t0, FieldMemOperand(t0, SharedFunctionInfo::kConstructStubOffset)); |
1224 __ Addu(at, t0, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1224 __ Addu(at, t0, Operand(Code::kHeaderSize - kHeapObjectTag)); |
1225 __ Jump(at); | 1225 __ Jump(at); |
| 1226 } else if (mode == PushArgsConstructMode::kWithFinalSpread) { |
| 1227 // Call the constructor with a0, a1, and a3 unmodified. |
| 1228 __ Jump(masm->isolate()->builtins()->ConstructWithSpread(), |
| 1229 RelocInfo::CODE_TARGET); |
1226 } else { | 1230 } else { |
1227 DCHECK_EQ(construct_type, CallableType::kAny); | 1231 DCHECK_EQ(PushArgsConstructMode::kOther, mode); |
1228 // Call the constructor with a0, a1, and a3 unmodified. | 1232 // Call the constructor with a0, a1, and a3 unmodified. |
1229 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | 1233 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
1230 } | 1234 } |
1231 | 1235 |
1232 __ bind(&stack_overflow); | 1236 __ bind(&stack_overflow); |
1233 { | 1237 { |
1234 __ TailCallRuntime(Runtime::kThrowStackOverflow); | 1238 __ TailCallRuntime(Runtime::kThrowStackOverflow); |
1235 // Unreachable code. | 1239 // Unreachable code. |
1236 __ break_(0xCC); | 1240 __ break_(0xCC); |
1237 } | 1241 } |
(...skipping 1562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2800 } | 2804 } |
2801 | 2805 |
2802 // Called Construct on an Object that doesn't have a [[Construct]] internal | 2806 // Called Construct on an Object that doesn't have a [[Construct]] internal |
2803 // method. | 2807 // method. |
2804 __ bind(&non_constructor); | 2808 __ bind(&non_constructor); |
2805 __ Jump(masm->isolate()->builtins()->ConstructedNonConstructable(), | 2809 __ Jump(masm->isolate()->builtins()->ConstructedNonConstructable(), |
2806 RelocInfo::CODE_TARGET); | 2810 RelocInfo::CODE_TARGET); |
2807 } | 2811 } |
2808 | 2812 |
2809 // static | 2813 // static |
| 2814 void Builtins::Generate_ConstructWithSpread(MacroAssembler* masm) { |
| 2815 // ----------- S t a t e ------------- |
| 2816 // -- a0 : the number of arguments (not including the receiver) |
| 2817 // -- a1 : the constructor to call (can be any Object) |
| 2818 // -- a3 : the new target (either the same as the constructor or |
| 2819 // the JSFunction on which new was invoked initially) |
| 2820 // ----------------------------------- |
| 2821 } |
| 2822 |
| 2823 // static |
2810 void Builtins::Generate_AllocateInNewSpace(MacroAssembler* masm) { | 2824 void Builtins::Generate_AllocateInNewSpace(MacroAssembler* masm) { |
2811 // ----------- S t a t e ------------- | 2825 // ----------- S t a t e ------------- |
2812 // -- a0 : requested object size (untagged) | 2826 // -- a0 : requested object size (untagged) |
2813 // -- ra : return address | 2827 // -- ra : return address |
2814 // ----------------------------------- | 2828 // ----------------------------------- |
2815 __ SmiTag(a0); | 2829 __ SmiTag(a0); |
2816 __ Push(a0); | 2830 __ Push(a0); |
2817 __ Move(cp, Smi::kZero); | 2831 __ Move(cp, Smi::kZero); |
2818 __ TailCallRuntime(Runtime::kAllocateInNewSpace); | 2832 __ TailCallRuntime(Runtime::kAllocateInNewSpace); |
2819 } | 2833 } |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2971 __ break_(0xCC); | 2985 __ break_(0xCC); |
2972 } | 2986 } |
2973 } | 2987 } |
2974 | 2988 |
2975 #undef __ | 2989 #undef __ |
2976 | 2990 |
2977 } // namespace internal | 2991 } // namespace internal |
2978 } // namespace v8 | 2992 } // namespace v8 |
2979 | 2993 |
2980 #endif // V8_TARGET_ARCH_MIPS | 2994 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |