| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 5 #if V8_TARGET_ARCH_PPC |
| 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 ToStringStub stub(masm->isolate()); | 257 ToStringStub stub(masm->isolate()); |
| 258 __ Push(r4, r6); | 258 __ Push(r4, r6); |
| 259 __ mr(r3, r5); | 259 __ mr(r3, r5); |
| 260 __ CallStub(&stub); | 260 __ CallStub(&stub); |
| 261 __ mr(r5, r3); | 261 __ mr(r5, r3); |
| 262 __ Pop(r4, r6); | 262 __ Pop(r4, r6); |
| 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 __ cmp(r4, r6); |
| 270 __ bne(&new_object); |
| 271 |
| 272 // 4. Allocate a JSValue wrapper for the string. |
| 268 { | 273 { |
| 269 // ----------- S t a t e ------------- | 274 // ----------- S t a t e ------------- |
| 270 // -- r5 : the first argument | 275 // -- r5 : the first argument |
| 271 // -- r4 : constructor function | 276 // -- r4 : constructor function |
| 272 // -- r6 : original constructor | 277 // -- r6 : original constructor |
| 273 // -- lr : return address | 278 // -- lr : return address |
| 274 // ----------------------------------- | 279 // ----------------------------------- |
| 275 | 280 __ Allocate(JSValue::kSize, r3, r7, r8, &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 __ cmp(r4, r6); | |
| 280 __ bne(&rt_call); | |
| 281 | |
| 282 __ Allocate(JSValue::kSize, r3, r6, r7, &allocate, TAG_OBJECT); | |
| 283 __ bind(&done_allocate); | |
| 284 | 281 |
| 285 // Initialize the JSValue in r3. | 282 // Initialize the JSValue in r3. |
| 286 __ LoadGlobalFunctionInitialMap(r4, r6, r7); | 283 __ LoadGlobalFunctionInitialMap(r4, r6, r7); |
| 287 __ StoreP(r6, FieldMemOperand(r3, HeapObject::kMapOffset), r0); | 284 __ StoreP(r6, FieldMemOperand(r3, HeapObject::kMapOffset), r0); |
| 288 __ LoadRoot(r6, Heap::kEmptyFixedArrayRootIndex); | 285 __ LoadRoot(r6, Heap::kEmptyFixedArrayRootIndex); |
| 289 __ StoreP(r6, FieldMemOperand(r3, JSObject::kPropertiesOffset), r0); | 286 __ StoreP(r6, FieldMemOperand(r3, JSObject::kPropertiesOffset), r0); |
| 290 __ StoreP(r6, FieldMemOperand(r3, JSObject::kElementsOffset), r0); | 287 __ StoreP(r6, FieldMemOperand(r3, JSObject::kElementsOffset), r0); |
| 291 __ StoreP(r5, FieldMemOperand(r3, JSValue::kValueOffset), r0); | 288 __ StoreP(r5, FieldMemOperand(r3, JSValue::kValueOffset), r0); |
| 292 STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize); | 289 STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize); |
| 293 __ Ret(); | 290 __ Ret(); |
| 291 } |
| 294 | 292 |
| 295 // Fallback to the runtime to allocate in new space. | 293 // 5. Fallback to the runtime to create new object. |
| 296 __ bind(&allocate); | 294 __ bind(&new_object); |
| 297 { | 295 { |
| 298 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 296 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 299 __ LoadSmiLiteral(r6, Smi::FromInt(JSValue::kSize)); | 297 __ Push(r5, r4, r6); // first argument, constructor, original constructor |
| 300 __ Push(r4, r5, r6); | 298 __ CallRuntime(Runtime::kNewObject, 2); |
| 301 __ CallRuntime(Runtime::kAllocateInNewSpace, 1); | 299 __ Pop(r5); |
| 302 __ Pop(r4, r5); | |
| 303 } | |
| 304 __ b(&done_allocate); | |
| 305 | |
| 306 // Fallback to the runtime to create new object. | |
| 307 __ bind(&rt_call); | |
| 308 { | |
| 309 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | |
| 310 __ Push(r4, r5, r4, r6); // constructor function, original constructor | |
| 311 __ CallRuntime(Runtime::kNewObject, 2); | |
| 312 __ Pop(r4, r5); | |
| 313 } | |
| 314 __ StoreP(r5, FieldMemOperand(r3, JSValue::kValueOffset), r0); | |
| 315 __ Ret(); | |
| 316 } | 300 } |
| 301 __ StoreP(r5, FieldMemOperand(r3, JSValue::kValueOffset), r0); |
| 302 __ Ret(); |
| 317 } | 303 } |
| 318 | 304 |
| 319 | 305 |
| 320 static void CallRuntimePassFunction(MacroAssembler* masm, | 306 static void CallRuntimePassFunction(MacroAssembler* masm, |
| 321 Runtime::FunctionId function_id) { | 307 Runtime::FunctionId function_id) { |
| 322 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 308 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 323 // Push a copy of the function onto the stack. | 309 // Push a copy of the function onto the stack. |
| 324 // Push function as parameter to the runtime call. | 310 // Push function as parameter to the runtime call. |
| 325 __ Push(r4, r4); | 311 __ Push(r4, r4); |
| 326 | 312 |
| (...skipping 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1977 __ bkpt(0); | 1963 __ bkpt(0); |
| 1978 } | 1964 } |
| 1979 } | 1965 } |
| 1980 | 1966 |
| 1981 | 1967 |
| 1982 #undef __ | 1968 #undef __ |
| 1983 } // namespace internal | 1969 } // namespace internal |
| 1984 } // namespace v8 | 1970 } // namespace v8 |
| 1985 | 1971 |
| 1986 #endif // V8_TARGET_ARCH_PPC | 1972 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |