| 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 2144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2155 | 2155 |
| 2156 // Check if argumentsList is an (unmodified) arguments object. | 2156 // Check if argumentsList is an (unmodified) arguments object. |
| 2157 __ ld(at, ContextMemOperand(native_context, | 2157 __ ld(at, ContextMemOperand(native_context, |
| 2158 Context::SLOPPY_ARGUMENTS_MAP_INDEX)); | 2158 Context::SLOPPY_ARGUMENTS_MAP_INDEX)); |
| 2159 __ Branch(&create_arguments, eq, arguments_list_map, Operand(at)); | 2159 __ Branch(&create_arguments, eq, arguments_list_map, Operand(at)); |
| 2160 __ ld(at, ContextMemOperand(native_context, | 2160 __ ld(at, ContextMemOperand(native_context, |
| 2161 Context::STRICT_ARGUMENTS_MAP_INDEX)); | 2161 Context::STRICT_ARGUMENTS_MAP_INDEX)); |
| 2162 __ Branch(&create_arguments, eq, arguments_list_map, Operand(at)); | 2162 __ Branch(&create_arguments, eq, arguments_list_map, Operand(at)); |
| 2163 | 2163 |
| 2164 // Check if argumentsList is a fast JSArray. | 2164 // Check if argumentsList is a fast JSArray. |
| 2165 __ ld(v0, FieldMemOperand(a2, HeapObject::kMapOffset)); | 2165 __ lbu(v0, FieldMemOperand(a2, Map::kInstanceTypeOffset)); |
| 2166 __ lbu(v0, FieldMemOperand(v0, Map::kInstanceTypeOffset)); | |
| 2167 __ Branch(&create_array, eq, v0, Operand(JS_ARRAY_TYPE)); | 2166 __ Branch(&create_array, eq, v0, Operand(JS_ARRAY_TYPE)); |
| 2168 | 2167 |
| 2169 // Ask the runtime to create the list (actually a FixedArray). | 2168 // Ask the runtime to create the list (actually a FixedArray). |
| 2170 __ bind(&create_runtime); | 2169 __ bind(&create_runtime); |
| 2171 { | 2170 { |
| 2172 FrameScope scope(masm, StackFrame::INTERNAL); | 2171 FrameScope scope(masm, StackFrame::INTERNAL); |
| 2173 __ Push(target, new_target, arguments_list); | 2172 __ Push(target, new_target, arguments_list); |
| 2174 __ CallRuntime(Runtime::kCreateListFromArrayLike); | 2173 __ CallRuntime(Runtime::kCreateListFromArrayLike); |
| 2175 __ mov(arguments_list, v0); | 2174 __ mov(arguments_list, v0); |
| 2176 __ Pop(target, new_target); | 2175 __ Pop(target, new_target); |
| 2177 __ lw(len, UntagSmiFieldMemOperand(v0, FixedArray::kLengthOffset)); | 2176 __ lw(len, UntagSmiFieldMemOperand(v0, FixedArray::kLengthOffset)); |
| 2178 } | 2177 } |
| 2179 __ Branch(&done_create); | 2178 __ Branch(&done_create); |
| 2180 | 2179 |
| 2181 // Try to create the list from an arguments object. | 2180 // Try to create the list from an arguments object. |
| 2182 __ bind(&create_arguments); | 2181 __ bind(&create_arguments); |
| 2183 __ lw(len, UntagSmiFieldMemOperand(arguments_list, | 2182 __ lw(len, UntagSmiFieldMemOperand(arguments_list, |
| 2184 JSArgumentsObject::kLengthOffset)); | 2183 JSArgumentsObject::kLengthOffset)); |
| 2185 __ ld(a4, FieldMemOperand(arguments_list, JSObject::kElementsOffset)); | 2184 __ ld(a4, FieldMemOperand(arguments_list, JSObject::kElementsOffset)); |
| 2186 __ lw(at, UntagSmiFieldMemOperand(a4, FixedArray::kLengthOffset)); | 2185 __ lw(at, UntagSmiFieldMemOperand(a4, FixedArray::kLengthOffset)); |
| 2187 __ Branch(&create_runtime, ne, len, Operand(at)); | 2186 __ Branch(&create_runtime, ne, len, Operand(at)); |
| 2188 __ mov(args, a4); | 2187 __ mov(args, a4); |
| 2189 | 2188 |
| 2190 __ Branch(&done_create); | 2189 __ Branch(&done_create); |
| 2191 | 2190 |
| 2192 // For holey JSArrays we need to check that the array prototype chain | 2191 // For holey JSArrays we need to check that the array prototype chain |
| 2193 // protector is intact and our prototype is the Array.prototype actually. | 2192 // protector is intact and our prototype is the Array.prototype actually. |
| 2194 __ bind(&create_holey_array); | 2193 __ bind(&create_holey_array); |
| 2195 __ ld(a2, FieldMemOperand(a2, Map::kPrototypeOffset)); | 2194 __ ld(a2, FieldMemOperand(a2, Map::kPrototypeOffset)); |
| 2196 __ ld(at, ContextMemOperand(t0, Context::INITIAL_ARRAY_PROTOTYPE_INDEX)); | 2195 __ ld(at, ContextMemOperand(native_context, |
| 2196 Context::INITIAL_ARRAY_PROTOTYPE_INDEX)); |
| 2197 __ Branch(&create_runtime, ne, a2, Operand(at)); | 2197 __ Branch(&create_runtime, ne, a2, Operand(at)); |
| 2198 __ LoadRoot(at, Heap::kArrayProtectorRootIndex); | 2198 __ LoadRoot(at, Heap::kArrayProtectorRootIndex); |
| 2199 __ lw(a2, UntagSmiFieldMemOperand(at, PropertyCell::kValueOffset)); | 2199 __ lw(a2, UntagSmiFieldMemOperand(at, PropertyCell::kValueOffset)); |
| 2200 __ Branch(&create_runtime, ne, a2, | 2200 __ Branch(&create_runtime, ne, a2, |
| 2201 Operand(Smi::FromInt(Isolate::kProtectorValid))); | 2201 Operand(Smi::FromInt(Isolate::kProtectorValid))); |
| 2202 __ lw(a2, UntagSmiFieldMemOperand(a0, JSArray::kLengthOffset)); | 2202 __ lw(a2, UntagSmiFieldMemOperand(a0, JSArray::kLengthOffset)); |
| 2203 __ ld(a0, FieldMemOperand(a0, JSArray::kElementsOffset)); | 2203 __ ld(a0, FieldMemOperand(a0, JSArray::kElementsOffset)); |
| 2204 __ Branch(&done_create); | 2204 __ Branch(&done_create); |
| 2205 | 2205 |
| 2206 // Try to create the list from a JSArray object. | 2206 // Try to create the list from a JSArray object. |
| 2207 __ bind(&create_array); | 2207 __ bind(&create_array); |
| 2208 __ ld(a2, FieldMemOperand(a2, Map::kBitField2Offset)); | 2208 __ lbu(t1, FieldMemOperand(a2, Map::kBitField2Offset)); |
| 2209 __ DecodeField<Map::ElementsKindBits>(a2); | 2209 __ DecodeField<Map::ElementsKindBits>(t1); |
| 2210 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0); | 2210 STATIC_ASSERT(FAST_SMI_ELEMENTS == 0); |
| 2211 STATIC_ASSERT(FAST_ELEMENTS == 2); | 2211 STATIC_ASSERT(FAST_ELEMENTS == 2); |
| 2212 STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3); | 2212 STATIC_ASSERT(FAST_HOLEY_ELEMENTS == 3); |
| 2213 __ Branch(&create_holey_array, eq, a2, Operand(FAST_HOLEY_SMI_ELEMENTS)); | 2213 __ Branch(&create_holey_array, eq, t1, Operand(FAST_HOLEY_SMI_ELEMENTS)); |
| 2214 __ Branch(&create_holey_array, eq, a2, Operand(FAST_HOLEY_ELEMENTS)); | 2214 __ Branch(&create_holey_array, eq, t1, Operand(FAST_HOLEY_ELEMENTS)); |
| 2215 __ andi(a2, a2, uint16_t(~FAST_ELEMENTS)); // works if enum ElementsKind | 2215 __ Branch(&create_runtime, hi, t1, Operand(FAST_ELEMENTS)); |
| 2216 // has less than 2^16 elements | |
| 2217 __ Branch(&create_runtime, ne, a2, Operand(int64_t(0))); | |
| 2218 __ lw(a2, UntagSmiFieldMemOperand(arguments_list, JSArray::kLengthOffset)); | 2216 __ lw(a2, UntagSmiFieldMemOperand(arguments_list, JSArray::kLengthOffset)); |
| 2219 __ ld(a0, FieldMemOperand(arguments_list, JSArray::kElementsOffset)); | 2217 __ ld(a0, FieldMemOperand(arguments_list, JSArray::kElementsOffset)); |
| 2220 | 2218 |
| 2221 __ bind(&done_create); | 2219 __ bind(&done_create); |
| 2222 } | 2220 } |
| 2223 | 2221 |
| 2224 // Check for stack overflow. | 2222 // Check for stack overflow. |
| 2225 { | 2223 { |
| 2226 // Check the stack for overflow. We are not trying to catch interruptions | 2224 // Check the stack for overflow. We are not trying to catch interruptions |
| 2227 // (i.e. debug break and preemption) here, so check the "real stack limit". | 2225 // (i.e. debug break and preemption) here, so check the "real stack limit". |
| (...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2988 __ break_(0xCC); | 2986 __ break_(0xCC); |
| 2989 } | 2987 } |
| 2990 } | 2988 } |
| 2991 | 2989 |
| 2992 #undef __ | 2990 #undef __ |
| 2993 | 2991 |
| 2994 } // namespace internal | 2992 } // namespace internal |
| 2995 } // namespace v8 | 2993 } // namespace v8 |
| 2996 | 2994 |
| 2997 #endif // V8_TARGET_ARCH_MIPS64 | 2995 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |