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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
8 | 8 |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 2126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2137 __ Addu(t5, t5, Operand(t6)); | 2137 __ Addu(t5, t5, Operand(t6)); |
2138 __ Addu(t5, t5, Operand(FixedArray::kHeaderSize)); | 2138 __ Addu(t5, t5, Operand(FixedArray::kHeaderSize)); |
2139 | 2139 |
2140 // 3. Arguments object. | 2140 // 3. Arguments object. |
2141 __ Addu(t5, t5, Operand(Heap::kSloppyArgumentsObjectSize)); | 2141 __ Addu(t5, t5, Operand(Heap::kSloppyArgumentsObjectSize)); |
2142 | 2142 |
2143 // Do the allocation of all three objects in one go. | 2143 // Do the allocation of all three objects in one go. |
2144 __ Allocate(t5, v0, a3, t0, &runtime, TAG_OBJECT); | 2144 __ Allocate(t5, v0, a3, t0, &runtime, TAG_OBJECT); |
2145 | 2145 |
2146 // v0 = address of new object(s) (tagged) | 2146 // v0 = address of new object(s) (tagged) |
2147 // a2 = argument count (tagged) | 2147 // a2 = argument count (smi-tagged) |
2148 // Get the arguments boilerplate from the current native context into t0. | 2148 // Get the arguments boilerplate from the current native context into t0. |
2149 const int kNormalOffset = | 2149 const int kNormalOffset = |
2150 Context::SlotOffset(Context::SLOPPY_ARGUMENTS_BOILERPLATE_INDEX); | 2150 Context::SlotOffset(Context::SLOPPY_ARGUMENTS_MAP_INDEX); |
2151 const int kAliasedOffset = | 2151 const int kAliasedOffset = |
2152 Context::SlotOffset(Context::ALIASED_ARGUMENTS_BOILERPLATE_INDEX); | 2152 Context::SlotOffset(Context::ALIASED_ARGUMENTS_MAP_INDEX); |
2153 | 2153 |
2154 __ lw(t0, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 2154 __ lw(t0, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
2155 __ lw(t0, FieldMemOperand(t0, GlobalObject::kNativeContextOffset)); | 2155 __ lw(t0, FieldMemOperand(t0, GlobalObject::kNativeContextOffset)); |
2156 Label skip2_ne, skip2_eq; | 2156 Label skip2_ne, skip2_eq; |
2157 __ Branch(&skip2_ne, ne, a1, Operand(zero_reg)); | 2157 __ Branch(&skip2_ne, ne, a1, Operand(zero_reg)); |
2158 __ lw(t0, MemOperand(t0, kNormalOffset)); | 2158 __ lw(t0, MemOperand(t0, kNormalOffset)); |
2159 __ bind(&skip2_ne); | 2159 __ bind(&skip2_ne); |
2160 | 2160 |
2161 __ Branch(&skip2_eq, eq, a1, Operand(zero_reg)); | 2161 __ Branch(&skip2_eq, eq, a1, Operand(zero_reg)); |
2162 __ lw(t0, MemOperand(t0, kAliasedOffset)); | 2162 __ lw(t0, MemOperand(t0, kAliasedOffset)); |
2163 __ bind(&skip2_eq); | 2163 __ bind(&skip2_eq); |
2164 | 2164 |
2165 // v0 = address of new object (tagged) | 2165 // v0 = address of new object (tagged) |
2166 // a1 = mapped parameter count (tagged) | 2166 // a1 = mapped parameter count (tagged) |
2167 // a2 = argument count (tagged) | 2167 // a2 = argument count (smi-tagged) |
2168 // t0 = address of boilerplate object (tagged) | 2168 // t0 = address of arguments map (tagged) |
2169 // Copy the JS object part. | 2169 __ sw(t0, FieldMemOperand(v0, JSObject::kMapOffset)); |
2170 for (int i = 0; i < JSObject::kHeaderSize; i += kPointerSize) { | 2170 __ LoadRoot(a3, Heap::kEmptyFixedArrayRootIndex); |
2171 __ lw(a3, FieldMemOperand(t0, i)); | 2171 __ sw(a3, FieldMemOperand(v0, JSObject::kPropertiesOffset)); |
2172 __ sw(a3, FieldMemOperand(v0, i)); | 2172 __ sw(a3, FieldMemOperand(v0, JSObject::kElementsOffset)); |
2173 } | |
2174 | 2173 |
2175 // Set up the callee in-object property. | 2174 // Set up the callee in-object property. |
2176 STATIC_ASSERT(Heap::kArgumentsCalleeIndex == 1); | 2175 STATIC_ASSERT(Heap::kArgumentsCalleeIndex == 1); |
2177 __ lw(a3, MemOperand(sp, 2 * kPointerSize)); | 2176 __ lw(a3, MemOperand(sp, 2 * kPointerSize)); |
| 2177 __ AssertNotSmi(a3); |
2178 const int kCalleeOffset = JSObject::kHeaderSize + | 2178 const int kCalleeOffset = JSObject::kHeaderSize + |
2179 Heap::kArgumentsCalleeIndex * kPointerSize; | 2179 Heap::kArgumentsCalleeIndex * kPointerSize; |
2180 __ sw(a3, FieldMemOperand(v0, kCalleeOffset)); | 2180 __ sw(a3, FieldMemOperand(v0, kCalleeOffset)); |
2181 | 2181 |
2182 // Use the length (smi tagged) and set that as an in-object property too. | 2182 // Use the length (smi tagged) and set that as an in-object property too. |
| 2183 __ AssertSmi(a2); |
2183 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); | 2184 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); |
2184 const int kLengthOffset = JSObject::kHeaderSize + | 2185 const int kLengthOffset = JSObject::kHeaderSize + |
2185 Heap::kArgumentsLengthIndex * kPointerSize; | 2186 Heap::kArgumentsLengthIndex * kPointerSize; |
2186 __ sw(a2, FieldMemOperand(v0, kLengthOffset)); | 2187 __ sw(a2, FieldMemOperand(v0, kLengthOffset)); |
2187 | 2188 |
2188 // Set up the elements pointer in the allocated arguments object. | 2189 // Set up the elements pointer in the allocated arguments object. |
2189 // If we allocated a parameter map, t0 will point there, otherwise | 2190 // If we allocated a parameter map, t0 will point there, otherwise |
2190 // it will point to the backing store. | 2191 // it will point to the backing store. |
2191 __ Addu(t0, v0, Operand(Heap::kSloppyArgumentsObjectSize)); | 2192 __ Addu(t0, v0, Operand(Heap::kSloppyArgumentsObjectSize)); |
2192 __ sw(t0, FieldMemOperand(v0, JSObject::kElementsOffset)); | 2193 __ sw(t0, FieldMemOperand(v0, JSObject::kElementsOffset)); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2331 __ bind(&add_arguments_object); | 2332 __ bind(&add_arguments_object); |
2332 __ Addu(a1, a1, Operand(Heap::kStrictArgumentsObjectSize / kPointerSize)); | 2333 __ Addu(a1, a1, Operand(Heap::kStrictArgumentsObjectSize / kPointerSize)); |
2333 | 2334 |
2334 // Do the allocation of both objects in one go. | 2335 // Do the allocation of both objects in one go. |
2335 __ Allocate(a1, v0, a2, a3, &runtime, | 2336 __ Allocate(a1, v0, a2, a3, &runtime, |
2336 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS)); | 2337 static_cast<AllocationFlags>(TAG_OBJECT | SIZE_IN_WORDS)); |
2337 | 2338 |
2338 // Get the arguments boilerplate from the current native context. | 2339 // Get the arguments boilerplate from the current native context. |
2339 __ lw(t0, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); | 2340 __ lw(t0, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX))); |
2340 __ lw(t0, FieldMemOperand(t0, GlobalObject::kNativeContextOffset)); | 2341 __ lw(t0, FieldMemOperand(t0, GlobalObject::kNativeContextOffset)); |
2341 __ lw(t0, MemOperand(t0, Context::SlotOffset( | 2342 __ lw(t0, MemOperand( |
2342 Context::STRICT_ARGUMENTS_BOILERPLATE_INDEX))); | 2343 t0, Context::SlotOffset(Context::STRICT_ARGUMENTS_MAP_INDEX))); |
2343 | 2344 |
2344 // Copy the JS object part. | 2345 __ sw(t0, FieldMemOperand(v0, JSObject::kMapOffset)); |
2345 __ CopyFields(v0, t0, a3.bit(), JSObject::kHeaderSize / kPointerSize); | 2346 __ LoadRoot(a3, Heap::kEmptyFixedArrayRootIndex); |
| 2347 __ sw(a3, FieldMemOperand(v0, JSObject::kPropertiesOffset)); |
| 2348 __ sw(a3, FieldMemOperand(v0, JSObject::kElementsOffset)); |
2346 | 2349 |
2347 // Get the length (smi tagged) and set that as an in-object property too. | 2350 // Get the length (smi tagged) and set that as an in-object property too. |
2348 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); | 2351 STATIC_ASSERT(Heap::kArgumentsLengthIndex == 0); |
2349 __ lw(a1, MemOperand(sp, 0 * kPointerSize)); | 2352 __ lw(a1, MemOperand(sp, 0 * kPointerSize)); |
| 2353 __ AssertSmi(a1); |
2350 __ sw(a1, FieldMemOperand(v0, JSObject::kHeaderSize + | 2354 __ sw(a1, FieldMemOperand(v0, JSObject::kHeaderSize + |
2351 Heap::kArgumentsLengthIndex * kPointerSize)); | 2355 Heap::kArgumentsLengthIndex * kPointerSize)); |
2352 | 2356 |
2353 Label done; | 2357 Label done; |
2354 __ Branch(&done, eq, a1, Operand(zero_reg)); | 2358 __ Branch(&done, eq, a1, Operand(zero_reg)); |
2355 | 2359 |
2356 // Get the parameters pointer from the stack. | 2360 // Get the parameters pointer from the stack. |
2357 __ lw(a2, MemOperand(sp, 1 * kPointerSize)); | 2361 __ lw(a2, MemOperand(sp, 1 * kPointerSize)); |
2358 | 2362 |
2359 // Set up the elements pointer in the allocated arguments object and | 2363 // Set up the elements pointer in the allocated arguments object and |
(...skipping 2939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5299 MemOperand(fp, 6 * kPointerSize), | 5303 MemOperand(fp, 6 * kPointerSize), |
5300 NULL); | 5304 NULL); |
5301 } | 5305 } |
5302 | 5306 |
5303 | 5307 |
5304 #undef __ | 5308 #undef __ |
5305 | 5309 |
5306 } } // namespace v8::internal | 5310 } } // namespace v8::internal |
5307 | 5311 |
5308 #endif // V8_TARGET_ARCH_MIPS | 5312 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |