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 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1181 __ bind(&stack_overflow); | 1181 __ bind(&stack_overflow); |
1182 { | 1182 { |
1183 __ TailCallRuntime(Runtime::kThrowStackOverflow); | 1183 __ TailCallRuntime(Runtime::kThrowStackOverflow); |
1184 // Unreachable code. | 1184 // Unreachable code. |
1185 __ break_(0xCC); | 1185 __ break_(0xCC); |
1186 } | 1186 } |
1187 } | 1187 } |
1188 | 1188 |
1189 // static | 1189 // static |
1190 void Builtins::Generate_InterpreterPushArgsAndConstructImpl( | 1190 void Builtins::Generate_InterpreterPushArgsAndConstructImpl( |
1191 MacroAssembler* masm, CallableType construct_type) { | 1191 MacroAssembler* masm, PushArgsConstructMode mode) { |
1192 // ----------- S t a t e ------------- | 1192 // ----------- S t a t e ------------- |
1193 // -- a0 : argument count (not including receiver) | 1193 // -- a0 : argument count (not including receiver) |
1194 // -- a3 : new target | 1194 // -- a3 : new target |
1195 // -- a1 : constructor to call | 1195 // -- a1 : constructor to call |
1196 // -- a2 : allocation site feedback if available, undefined otherwise. | 1196 // -- a2 : allocation site feedback if available, undefined otherwise. |
1197 // -- a4 : address of the first argument | 1197 // -- a4 : address of the first argument |
1198 // ----------------------------------- | 1198 // ----------------------------------- |
1199 Label stack_overflow; | 1199 Label stack_overflow; |
1200 | 1200 |
1201 // Push a slot for the receiver. | 1201 // Push a slot for the receiver. |
1202 __ push(zero_reg); | 1202 __ push(zero_reg); |
1203 | 1203 |
1204 // This function modifies t0, a4 and a5. | 1204 // This function modifies t0, a4 and a5. |
1205 Generate_InterpreterPushArgs(masm, a0, a4, a5, t0, &stack_overflow); | 1205 Generate_InterpreterPushArgs(masm, a0, a4, a5, t0, &stack_overflow); |
1206 | 1206 |
1207 __ AssertUndefinedOrAllocationSite(a2, t0); | 1207 __ AssertUndefinedOrAllocationSite(a2, t0); |
1208 if (construct_type == CallableType::kJSFunction) { | 1208 if (mode == PushArgsConstructMode::kJSFunction) { |
1209 __ AssertFunction(a1); | 1209 __ AssertFunction(a1); |
1210 | 1210 |
1211 // Tail call to the function-specific construct stub (still in the caller | 1211 // Tail call to the function-specific construct stub (still in the caller |
1212 // context at this point). | 1212 // context at this point). |
1213 __ ld(a4, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); | 1213 __ ld(a4, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
1214 __ ld(a4, FieldMemOperand(a4, SharedFunctionInfo::kConstructStubOffset)); | 1214 __ ld(a4, FieldMemOperand(a4, SharedFunctionInfo::kConstructStubOffset)); |
1215 __ Daddu(at, a4, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1215 __ Daddu(at, a4, Operand(Code::kHeaderSize - kHeapObjectTag)); |
1216 __ Jump(at); | 1216 __ Jump(at); |
| 1217 } else if (mode == PushArgsConstructMode::kWithFinalSpread) { |
| 1218 // Call the constructor with a0, a1, and a3 unmodified. |
| 1219 __ Jump(masm->isolate()->builtins()->ConstructWithSpread(), |
| 1220 RelocInfo::CODE_TARGET); |
1217 } else { | 1221 } else { |
1218 DCHECK_EQ(construct_type, CallableType::kAny); | 1222 DCHECK_EQ(PushArgsConstructMode::kOther, mode); |
1219 // Call the constructor with a0, a1, and a3 unmodified. | 1223 // Call the constructor with a0, a1, and a3 unmodified. |
1220 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); | 1224 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET); |
1221 } | 1225 } |
1222 | 1226 |
1223 __ bind(&stack_overflow); | 1227 __ bind(&stack_overflow); |
1224 { | 1228 { |
1225 __ TailCallRuntime(Runtime::kThrowStackOverflow); | 1229 __ TailCallRuntime(Runtime::kThrowStackOverflow); |
1226 // Unreachable code. | 1230 // Unreachable code. |
1227 __ break_(0xCC); | 1231 __ break_(0xCC); |
1228 } | 1232 } |
(...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2824 } | 2828 } |
2825 | 2829 |
2826 // Called Construct on an Object that doesn't have a [[Construct]] internal | 2830 // Called Construct on an Object that doesn't have a [[Construct]] internal |
2827 // method. | 2831 // method. |
2828 __ bind(&non_constructor); | 2832 __ bind(&non_constructor); |
2829 __ Jump(masm->isolate()->builtins()->ConstructedNonConstructable(), | 2833 __ Jump(masm->isolate()->builtins()->ConstructedNonConstructable(), |
2830 RelocInfo::CODE_TARGET); | 2834 RelocInfo::CODE_TARGET); |
2831 } | 2835 } |
2832 | 2836 |
2833 // static | 2837 // static |
| 2838 void Builtins::Generate_ConstructWithSpread(MacroAssembler* masm) { |
| 2839 // ----------- S t a t e ------------- |
| 2840 // -- a0 : the number of arguments (not including the receiver) |
| 2841 // -- a1 : the constructor to call (can be any Object) |
| 2842 // -- a3 : the new target (either the same as the constructor or |
| 2843 // the JSFunction on which new was invoked initially) |
| 2844 // ----------------------------------- |
| 2845 } |
| 2846 |
| 2847 // static |
2834 void Builtins::Generate_AllocateInNewSpace(MacroAssembler* masm) { | 2848 void Builtins::Generate_AllocateInNewSpace(MacroAssembler* masm) { |
2835 // ----------- S t a t e ------------- | 2849 // ----------- S t a t e ------------- |
2836 // -- a0 : requested object size (untagged) | 2850 // -- a0 : requested object size (untagged) |
2837 // -- ra : return address | 2851 // -- ra : return address |
2838 // ----------------------------------- | 2852 // ----------------------------------- |
2839 __ SmiTag(a0); | 2853 __ SmiTag(a0); |
2840 __ Push(a0); | 2854 __ Push(a0); |
2841 __ Move(cp, Smi::kZero); | 2855 __ Move(cp, Smi::kZero); |
2842 __ TailCallRuntime(Runtime::kAllocateInNewSpace); | 2856 __ TailCallRuntime(Runtime::kAllocateInNewSpace); |
2843 } | 2857 } |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2997 __ break_(0xCC); | 3011 __ break_(0xCC); |
2998 } | 3012 } |
2999 } | 3013 } |
3000 | 3014 |
3001 #undef __ | 3015 #undef __ |
3002 | 3016 |
3003 } // namespace internal | 3017 } // namespace internal |
3004 } // namespace v8 | 3018 } // namespace v8 |
3005 | 3019 |
3006 #endif // V8_TARGET_ARCH_MIPS64 | 3020 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |