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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 FrameScope scope(masm, StackFrame::INTERNAL); | 257 FrameScope scope(masm, StackFrame::INTERNAL); |
258 ToStringStub stub(masm->isolate()); | 258 ToStringStub stub(masm->isolate()); |
259 __ Push(a1, a3); | 259 __ Push(a1, a3); |
260 __ CallStub(&stub); | 260 __ CallStub(&stub); |
261 __ Move(a0, v0); | 261 __ Move(a0, v0); |
262 __ Pop(a1, a3); | 262 __ Pop(a1, a3); |
263 } | 263 } |
264 __ bind(&done_convert); | 264 __ bind(&done_convert); |
265 } | 265 } |
266 | 266 |
267 // 3. Allocate a JSValue wrapper for the string. | 267 // 3. Check if original constructor and constructor differ. |
| 268 Label new_object; |
| 269 __ Branch(&new_object, ne, a1, Operand(a3)); |
| 270 |
| 271 // 4. Allocate a JSValue wrapper for the string. |
268 { | 272 { |
269 // ----------- S t a t e ------------- | 273 // ----------- S t a t e ------------- |
270 // -- a0 : the first argument | 274 // -- a0 : the first argument |
271 // -- a1 : constructor function | 275 // -- a1 : constructor function |
272 // -- a3 : original constructor | 276 // -- a3 : original constructor |
273 // -- ra : return address | 277 // -- ra : return address |
274 // ----------------------------------- | 278 // ----------------------------------- |
275 | 279 __ Allocate(JSValue::kSize, v0, a2, t0, &new_object, TAG_OBJECT); |
276 Label allocate, done_allocate, rt_call; | |
277 | |
278 // Fall back to runtime if the original constructor and function differ. | |
279 __ Branch(&rt_call, ne, a1, Operand(a3)); | |
280 | |
281 __ Allocate(JSValue::kSize, v0, a2, a3, &allocate, TAG_OBJECT); | |
282 __ bind(&done_allocate); | |
283 | 280 |
284 // Initialize the JSValue in eax. | 281 // Initialize the JSValue in eax. |
285 __ LoadGlobalFunctionInitialMap(a1, a2, a3); | 282 __ LoadGlobalFunctionInitialMap(a1, a2, a3); |
286 __ sd(a2, FieldMemOperand(v0, HeapObject::kMapOffset)); | 283 __ sd(a2, FieldMemOperand(v0, HeapObject::kMapOffset)); |
287 __ LoadRoot(a3, Heap::kEmptyFixedArrayRootIndex); | 284 __ LoadRoot(a3, Heap::kEmptyFixedArrayRootIndex); |
288 __ sd(a3, FieldMemOperand(v0, JSObject::kPropertiesOffset)); | 285 __ sd(a3, FieldMemOperand(v0, JSObject::kPropertiesOffset)); |
289 __ sd(a3, FieldMemOperand(v0, JSObject::kElementsOffset)); | 286 __ sd(a3, FieldMemOperand(v0, JSObject::kElementsOffset)); |
290 __ sd(a0, FieldMemOperand(v0, JSValue::kValueOffset)); | 287 __ sd(a0, FieldMemOperand(v0, JSValue::kValueOffset)); |
291 STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize); | 288 STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize); |
292 __ Ret(); | 289 __ Ret(); |
| 290 } |
293 | 291 |
294 // Fallback to the runtime to allocate in new space. | 292 // 5. Fallback to the runtime to create new object. |
295 __ bind(&allocate); | 293 __ bind(&new_object); |
296 { | 294 { |
297 FrameScope scope(masm, StackFrame::INTERNAL); | 295 FrameScope scope(masm, StackFrame::INTERNAL); |
298 __ Move(a2, Smi::FromInt(JSValue::kSize)); | 296 __ Push(a0, a1, a3); // first argument, constructor, original constructor |
299 __ Push(a0, a1, a2); | 297 __ CallRuntime(Runtime::kNewObject, 2); |
300 __ CallRuntime(Runtime::kAllocateInNewSpace, 1); | 298 __ Pop(a0); |
301 __ Pop(a0, a1); | |
302 } | |
303 __ jmp(&done_allocate); | |
304 | |
305 // Fallback to the runtime to create new object. | |
306 __ bind(&rt_call); | |
307 { | |
308 FrameScope scope(masm, StackFrame::INTERNAL); | |
309 __ Push(a0, a1, a1, a3); // constructor function, original constructor | |
310 __ CallRuntime(Runtime::kNewObject, 2); | |
311 __ Pop(a0, a1); | |
312 } | |
313 __ sd(a0, FieldMemOperand(v0, JSValue::kValueOffset)); | |
314 __ Ret(); | |
315 } | 299 } |
| 300 __ sd(a0, FieldMemOperand(v0, JSValue::kValueOffset)); |
| 301 __ Ret(); |
316 } | 302 } |
317 | 303 |
318 | 304 |
319 static void CallRuntimePassFunction( | 305 static void CallRuntimePassFunction( |
320 MacroAssembler* masm, Runtime::FunctionId function_id) { | 306 MacroAssembler* masm, Runtime::FunctionId function_id) { |
321 FrameScope scope(masm, StackFrame::INTERNAL); | 307 FrameScope scope(masm, StackFrame::INTERNAL); |
322 // Push a copy of the function onto the stack. | 308 // Push a copy of the function onto the stack. |
323 // Push call kind information and function as parameter to the runtime call. | 309 // Push call kind information and function as parameter to the runtime call. |
324 __ Push(a1, a1); | 310 __ Push(a1, a1); |
325 | 311 |
(...skipping 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1963 } | 1949 } |
1964 } | 1950 } |
1965 | 1951 |
1966 | 1952 |
1967 #undef __ | 1953 #undef __ |
1968 | 1954 |
1969 } // namespace internal | 1955 } // namespace internal |
1970 } // namespace v8 | 1956 } // namespace v8 |
1971 | 1957 |
1972 #endif // V8_TARGET_ARCH_MIPS64 | 1958 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |