| 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 __ TailCallRuntime(Runtime::kSymbolDescriptiveString, 1, 1); | 215 __ TailCallRuntime(Runtime::kSymbolDescriptiveString, 1, 1); |
| 216 } | 216 } |
| 217 } | 217 } |
| 218 | 218 |
| 219 | 219 |
| 220 // static | 220 // static |
| 221 void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) { | 221 void Builtins::Generate_StringConstructor_ConstructStub(MacroAssembler* masm) { |
| 222 // ----------- S t a t e ------------- | 222 // ----------- S t a t e ------------- |
| 223 // -- r3 : number of arguments | 223 // -- r3 : number of arguments |
| 224 // -- r4 : constructor function | 224 // -- r4 : constructor function |
| 225 // -- r6 : original constructor | 225 // -- r6 : new target |
| 226 // -- lr : return address | 226 // -- lr : return address |
| 227 // -- sp[(argc - n - 1) * 4] : arg[n] (zero based) | 227 // -- sp[(argc - n - 1) * 4] : arg[n] (zero based) |
| 228 // -- sp[argc * 4] : receiver | 228 // -- sp[argc * 4] : receiver |
| 229 // ----------------------------------- | 229 // ----------------------------------- |
| 230 | 230 |
| 231 // 1. Load the first argument into r5 and get rid of the rest (including the | 231 // 1. Load the first argument into r5 and get rid of the rest (including the |
| 232 // receiver). | 232 // receiver). |
| 233 { | 233 { |
| 234 Label no_arguments, done; | 234 Label no_arguments, done; |
| 235 __ cmpi(r3, Operand::Zero()); | 235 __ cmpi(r3, Operand::Zero()); |
| (...skipping 21 matching lines...) Expand all 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. Check if original constructor and constructor differ. | 267 // 3. Check if new target and constructor differ. |
| 268 Label new_object; | 268 Label new_object; |
| 269 __ cmp(r4, r6); | 269 __ cmp(r4, r6); |
| 270 __ bne(&new_object); | 270 __ bne(&new_object); |
| 271 | 271 |
| 272 // 4. Allocate a JSValue wrapper for the string. | 272 // 4. Allocate a JSValue wrapper for the string. |
| 273 { | 273 { |
| 274 // ----------- S t a t e ------------- | 274 // ----------- S t a t e ------------- |
| 275 // -- r5 : the first argument | 275 // -- r5 : the first argument |
| 276 // -- r4 : constructor function | 276 // -- r4 : constructor function |
| 277 // -- r6 : original constructor | 277 // -- r6 : new target |
| 278 // -- lr : return address | 278 // -- lr : return address |
| 279 // ----------------------------------- | 279 // ----------------------------------- |
| 280 __ Allocate(JSValue::kSize, r3, r7, r8, &new_object, TAG_OBJECT); | 280 __ Allocate(JSValue::kSize, r3, r7, r8, &new_object, TAG_OBJECT); |
| 281 | 281 |
| 282 // Initialize the JSValue in r3. | 282 // Initialize the JSValue in r3. |
| 283 __ LoadGlobalFunctionInitialMap(r4, r6, r7); | 283 __ LoadGlobalFunctionInitialMap(r4, r6, r7); |
| 284 __ StoreP(r6, FieldMemOperand(r3, HeapObject::kMapOffset), r0); | 284 __ StoreP(r6, FieldMemOperand(r3, HeapObject::kMapOffset), r0); |
| 285 __ LoadRoot(r6, Heap::kEmptyFixedArrayRootIndex); | 285 __ LoadRoot(r6, Heap::kEmptyFixedArrayRootIndex); |
| 286 __ StoreP(r6, FieldMemOperand(r3, JSObject::kPropertiesOffset), r0); | 286 __ StoreP(r6, FieldMemOperand(r3, JSObject::kPropertiesOffset), r0); |
| 287 __ StoreP(r6, FieldMemOperand(r3, JSObject::kElementsOffset), r0); | 287 __ StoreP(r6, FieldMemOperand(r3, JSObject::kElementsOffset), r0); |
| 288 __ StoreP(r5, FieldMemOperand(r3, JSValue::kValueOffset), r0); | 288 __ StoreP(r5, FieldMemOperand(r3, JSValue::kValueOffset), r0); |
| 289 STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize); | 289 STATIC_ASSERT(JSValue::kSize == 4 * kPointerSize); |
| 290 __ Ret(); | 290 __ Ret(); |
| 291 } | 291 } |
| 292 | 292 |
| 293 // 5. Fallback to the runtime to create new object. | 293 // 5. Fallback to the runtime to create new object. |
| 294 __ bind(&new_object); | 294 __ bind(&new_object); |
| 295 { | 295 { |
| 296 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | 296 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
| 297 __ Push(r5, r4, r6); // first argument, constructor, original constructor | 297 __ Push(r5, r4, r6); // first argument, constructor, new target |
| 298 __ CallRuntime(Runtime::kNewObject, 2); | 298 __ CallRuntime(Runtime::kNewObject, 2); |
| 299 __ Pop(r5); | 299 __ Pop(r5); |
| 300 } | 300 } |
| 301 __ StoreP(r5, FieldMemOperand(r3, JSValue::kValueOffset), r0); | 301 __ StoreP(r5, FieldMemOperand(r3, JSValue::kValueOffset), r0); |
| 302 __ Ret(); | 302 __ Ret(); |
| 303 } | 303 } |
| 304 | 304 |
| 305 | 305 |
| 306 static void CallRuntimePassFunction(MacroAssembler* masm, | 306 static void CallRuntimePassFunction(MacroAssembler* masm, |
| 307 Runtime::FunctionId function_id) { | 307 Runtime::FunctionId function_id) { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 GenerateTailCallToSharedCode(masm); | 348 GenerateTailCallToSharedCode(masm); |
| 349 } | 349 } |
| 350 | 350 |
| 351 | 351 |
| 352 static void Generate_JSConstructStubHelper(MacroAssembler* masm, | 352 static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
| 353 bool is_api_function) { | 353 bool is_api_function) { |
| 354 // ----------- S t a t e ------------- | 354 // ----------- S t a t e ------------- |
| 355 // -- r3 : number of arguments | 355 // -- r3 : number of arguments |
| 356 // -- r4 : constructor function | 356 // -- r4 : constructor function |
| 357 // -- r5 : allocation site or undefined | 357 // -- r5 : allocation site or undefined |
| 358 // -- r6 : original constructor | 358 // -- r6 : new target |
| 359 // -- lr : return address | 359 // -- lr : return address |
| 360 // -- sp[...]: constructor arguments | 360 // -- sp[...]: constructor arguments |
| 361 // ----------------------------------- | 361 // ----------------------------------- |
| 362 | 362 |
| 363 Isolate* isolate = masm->isolate(); | 363 Isolate* isolate = masm->isolate(); |
| 364 | 364 |
| 365 // Enter a construct frame. | 365 // Enter a construct frame. |
| 366 { | 366 { |
| 367 FrameAndConstantPoolScope scope(masm, StackFrame::CONSTRUCT); | 367 FrameAndConstantPoolScope scope(masm, StackFrame::CONSTRUCT); |
| 368 | 368 |
| 369 // Preserve the incoming parameters on the stack. | 369 // Preserve the incoming parameters on the stack. |
| 370 __ AssertUndefinedOrAllocationSite(r5, r7); | 370 __ AssertUndefinedOrAllocationSite(r5, r7); |
| 371 __ SmiTag(r3); | 371 __ SmiTag(r3); |
| 372 __ Push(r5, r3, r4, r6); | 372 __ Push(r5, r3, r4, r6); |
| 373 | 373 |
| 374 // Try to allocate the object without transitioning into C code. If any of | 374 // Try to allocate the object without transitioning into C code. If any of |
| 375 // the preconditions is not met, the code bails out to the runtime call. | 375 // the preconditions is not met, the code bails out to the runtime call. |
| 376 Label rt_call, allocated; | 376 Label rt_call, allocated; |
| 377 if (FLAG_inline_new) { | 377 if (FLAG_inline_new) { |
| 378 ExternalReference debug_step_in_fp = | 378 ExternalReference debug_step_in_fp = |
| 379 ExternalReference::debug_step_in_fp_address(isolate); | 379 ExternalReference::debug_step_in_fp_address(isolate); |
| 380 __ mov(r5, Operand(debug_step_in_fp)); | 380 __ mov(r5, Operand(debug_step_in_fp)); |
| 381 __ LoadP(r5, MemOperand(r5)); | 381 __ LoadP(r5, MemOperand(r5)); |
| 382 __ cmpi(r5, Operand::Zero()); | 382 __ cmpi(r5, Operand::Zero()); |
| 383 __ bne(&rt_call); | 383 __ bne(&rt_call); |
| 384 | 384 |
| 385 // Verify that the original constructor is a JSFunction. | 385 // Verify that the new target is a JSFunction. |
| 386 __ CompareObjectType(r6, r8, r7, JS_FUNCTION_TYPE); | 386 __ CompareObjectType(r6, r8, r7, JS_FUNCTION_TYPE); |
| 387 __ bne(&rt_call); | 387 __ bne(&rt_call); |
| 388 | 388 |
| 389 // Load the initial map and verify that it is in fact a map. | 389 // Load the initial map and verify that it is in fact a map. |
| 390 // r6: original constructor | 390 // r6: new target |
| 391 __ LoadP(r5, | 391 __ LoadP(r5, |
| 392 FieldMemOperand(r6, JSFunction::kPrototypeOrInitialMapOffset)); | 392 FieldMemOperand(r6, JSFunction::kPrototypeOrInitialMapOffset)); |
| 393 __ JumpIfSmi(r5, &rt_call); | 393 __ JumpIfSmi(r5, &rt_call); |
| 394 __ CompareObjectType(r5, r8, r7, MAP_TYPE); | 394 __ CompareObjectType(r5, r8, r7, MAP_TYPE); |
| 395 __ bne(&rt_call); | 395 __ bne(&rt_call); |
| 396 | 396 |
| 397 // Fall back to runtime if the expected base constructor and base | 397 // Fall back to runtime if the expected base constructor and base |
| 398 // constructor differ. | 398 // constructor differ. |
| 399 __ LoadP(r8, FieldMemOperand(r5, Map::kConstructorOrBackPointerOffset)); | 399 __ LoadP(r8, FieldMemOperand(r5, Map::kConstructorOrBackPointerOffset)); |
| 400 __ cmp(r4, r8); | 400 __ cmp(r4, r8); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 __ InitializeFieldsWithFiller(r8, r9, r10); | 502 __ InitializeFieldsWithFiller(r8, r9, r10); |
| 503 | 503 |
| 504 // Add the object tag to make the JSObject real, so that we can continue | 504 // Add the object tag to make the JSObject real, so that we can continue |
| 505 // and jump into the continuation code at any time from now on. | 505 // and jump into the continuation code at any time from now on. |
| 506 __ addi(r7, r7, Operand(kHeapObjectTag)); | 506 __ addi(r7, r7, Operand(kHeapObjectTag)); |
| 507 | 507 |
| 508 // Continue with JSObject being successfully allocated | 508 // Continue with JSObject being successfully allocated |
| 509 // r7: JSObject | 509 // r7: JSObject |
| 510 __ b(&allocated); | 510 __ b(&allocated); |
| 511 | 511 |
| 512 // Reload the original constructor and fall-through. | 512 // Reload the new target and fall-through. |
| 513 __ bind(&rt_call_reload_new_target); | 513 __ bind(&rt_call_reload_new_target); |
| 514 __ LoadP(r6, MemOperand(sp, 0 * kPointerSize)); | 514 __ LoadP(r6, MemOperand(sp, 0 * kPointerSize)); |
| 515 } | 515 } |
| 516 | 516 |
| 517 // Allocate the new receiver object using the runtime call. | 517 // Allocate the new receiver object using the runtime call. |
| 518 // r4: constructor function | 518 // r4: constructor function |
| 519 // r6: original constructor | 519 // r6: new target |
| 520 __ bind(&rt_call); | 520 __ bind(&rt_call); |
| 521 __ Push(r4, r6); // constructor function, original constructor | 521 __ Push(r4, r6); // constructor function, new target |
| 522 __ CallRuntime(Runtime::kNewObject, 2); | 522 __ CallRuntime(Runtime::kNewObject, 2); |
| 523 __ mr(r7, r3); | 523 __ mr(r7, r3); |
| 524 | 524 |
| 525 // Receiver for constructor call allocated. | 525 // Receiver for constructor call allocated. |
| 526 // r7: JSObject | 526 // r7: JSObject |
| 527 __ bind(&allocated); | 527 __ bind(&allocated); |
| 528 | 528 |
| 529 // Restore the parameters. | 529 // Restore the parameters. |
| 530 __ Pop(r4, ip); | 530 __ Pop(r4, ip); |
| 531 | 531 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 // Throw away the result of the constructor invocation and use the | 604 // Throw away the result of the constructor invocation and use the |
| 605 // on-stack receiver as the result. | 605 // on-stack receiver as the result. |
| 606 __ bind(&use_receiver); | 606 __ bind(&use_receiver); |
| 607 __ LoadP(r3, MemOperand(sp)); | 607 __ LoadP(r3, MemOperand(sp)); |
| 608 | 608 |
| 609 // Remove receiver from the stack, remove caller arguments, and | 609 // Remove receiver from the stack, remove caller arguments, and |
| 610 // return. | 610 // return. |
| 611 __ bind(&exit); | 611 __ bind(&exit); |
| 612 // r3: result | 612 // r3: result |
| 613 // sp[0]: receiver (newly allocated object) | 613 // sp[0]: receiver (newly allocated object) |
| 614 // sp[1]: new.target (original constructor) | 614 // sp[1]: new.target (new target) |
| 615 // sp[2]: number of arguments (smi-tagged) | 615 // sp[2]: number of arguments (smi-tagged) |
| 616 __ LoadP(r4, MemOperand(sp, 2 * kPointerSize)); | 616 __ LoadP(r4, MemOperand(sp, 2 * kPointerSize)); |
| 617 | 617 |
| 618 // Leave construct frame. | 618 // Leave construct frame. |
| 619 } | 619 } |
| 620 | 620 |
| 621 __ SmiToPtrArrayOffset(r4, r4); | 621 __ SmiToPtrArrayOffset(r4, r4); |
| 622 __ add(sp, sp, r4); | 622 __ add(sp, sp, r4); |
| 623 __ addi(sp, sp, Operand(kPointerSize)); | 623 __ addi(sp, sp, Operand(kPointerSize)); |
| 624 __ IncrementCounter(isolate->counters()->constructed_objects(), 1, r4, r5); | 624 __ IncrementCounter(isolate->counters()->constructed_objects(), 1, r4, r5); |
| 625 __ blr(); | 625 __ blr(); |
| 626 } | 626 } |
| 627 | 627 |
| 628 | 628 |
| 629 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { | 629 void Builtins::Generate_JSConstructStubGeneric(MacroAssembler* masm) { |
| 630 Generate_JSConstructStubHelper(masm, false); | 630 Generate_JSConstructStubHelper(masm, false); |
| 631 } | 631 } |
| 632 | 632 |
| 633 | 633 |
| 634 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { | 634 void Builtins::Generate_JSConstructStubApi(MacroAssembler* masm) { |
| 635 Generate_JSConstructStubHelper(masm, true); | 635 Generate_JSConstructStubHelper(masm, true); |
| 636 } | 636 } |
| 637 | 637 |
| 638 | 638 |
| 639 void Builtins::Generate_JSConstructStubForDerived(MacroAssembler* masm) { | 639 void Builtins::Generate_JSConstructStubForDerived(MacroAssembler* masm) { |
| 640 // ----------- S t a t e ------------- | 640 // ----------- S t a t e ------------- |
| 641 // -- r3 : number of arguments | 641 // -- r3 : number of arguments |
| 642 // -- r4 : constructor function | 642 // -- r4 : constructor function |
| 643 // -- r5 : allocation site or undefined | 643 // -- r5 : allocation site or undefined |
| 644 // -- r6 : original constructor | 644 // -- r6 : new target |
| 645 // -- lr : return address | 645 // -- lr : return address |
| 646 // -- sp[...]: constructor arguments | 646 // -- sp[...]: constructor arguments |
| 647 // ----------------------------------- | 647 // ----------------------------------- |
| 648 | 648 |
| 649 { | 649 { |
| 650 FrameAndConstantPoolScope scope(masm, StackFrame::CONSTRUCT); | 650 FrameAndConstantPoolScope scope(masm, StackFrame::CONSTRUCT); |
| 651 | 651 |
| 652 __ AssertUndefinedOrAllocationSite(r5, r7); | 652 __ AssertUndefinedOrAllocationSite(r5, r7); |
| 653 | 653 |
| 654 // Smi-tagged arguments count. | 654 // Smi-tagged arguments count. |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1004 | 1004 |
| 1005 // Call the target. | 1005 // Call the target. |
| 1006 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1006 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
| 1007 } | 1007 } |
| 1008 | 1008 |
| 1009 | 1009 |
| 1010 // static | 1010 // static |
| 1011 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { | 1011 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { |
| 1012 // ----------- S t a t e ------------- | 1012 // ----------- S t a t e ------------- |
| 1013 // -- r3 : argument count (not including receiver) | 1013 // -- r3 : argument count (not including receiver) |
| 1014 // -- r6 : original constructor | 1014 // -- r6 : new target |
| 1015 // -- r4 : constructor to call | 1015 // -- r4 : constructor to call |
| 1016 // -- r5 : address of the first argument | 1016 // -- r5 : address of the first argument |
| 1017 // ----------------------------------- | 1017 // ----------------------------------- |
| 1018 | 1018 |
| 1019 // Push a slot for the receiver to be constructed. | 1019 // Push a slot for the receiver to be constructed. |
| 1020 __ push(r3); | 1020 __ push(r3); |
| 1021 | 1021 |
| 1022 // Push the arguments (skip if none). | 1022 // Push the arguments (skip if none). |
| 1023 Label skip; | 1023 Label skip; |
| 1024 __ cmpi(r3, Operand::Zero()); | 1024 __ cmpi(r3, Operand::Zero()); |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1725 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1); | 1725 __ CallRuntime(Runtime::kThrowCalledNonCallable, 1); |
| 1726 } | 1726 } |
| 1727 } | 1727 } |
| 1728 | 1728 |
| 1729 | 1729 |
| 1730 // static | 1730 // static |
| 1731 void Builtins::Generate_ConstructFunction(MacroAssembler* masm) { | 1731 void Builtins::Generate_ConstructFunction(MacroAssembler* masm) { |
| 1732 // ----------- S t a t e ------------- | 1732 // ----------- S t a t e ------------- |
| 1733 // -- r3 : the number of arguments (not including the receiver) | 1733 // -- r3 : the number of arguments (not including the receiver) |
| 1734 // -- r4 : the constructor to call (checked to be a JSFunction) | 1734 // -- r4 : the constructor to call (checked to be a JSFunction) |
| 1735 // -- r6 : the original constructor (checked to be a JSFunction) | 1735 // -- r6 : the new target (checked to be a JSFunction) |
| 1736 // ----------------------------------- | 1736 // ----------------------------------- |
| 1737 __ AssertFunction(r4); | 1737 __ AssertFunction(r4); |
| 1738 __ AssertFunction(r6); | 1738 __ AssertFunction(r6); |
| 1739 | 1739 |
| 1740 // Calling convention for function specific ConstructStubs require | 1740 // Calling convention for function specific ConstructStubs require |
| 1741 // r5 to contain either an AllocationSite or undefined. | 1741 // r5 to contain either an AllocationSite or undefined. |
| 1742 __ LoadRoot(r5, Heap::kUndefinedValueRootIndex); | 1742 __ LoadRoot(r5, Heap::kUndefinedValueRootIndex); |
| 1743 | 1743 |
| 1744 // Tail call to the function-specific construct stub (still in the caller | 1744 // Tail call to the function-specific construct stub (still in the caller |
| 1745 // context at this point). | 1745 // context at this point). |
| 1746 __ LoadP(r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); | 1746 __ LoadP(r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); |
| 1747 __ LoadP(r7, FieldMemOperand(r7, SharedFunctionInfo::kConstructStubOffset)); | 1747 __ LoadP(r7, FieldMemOperand(r7, SharedFunctionInfo::kConstructStubOffset)); |
| 1748 __ addi(ip, r7, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1748 __ addi(ip, r7, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1749 __ JumpToJSEntry(ip); | 1749 __ JumpToJSEntry(ip); |
| 1750 } | 1750 } |
| 1751 | 1751 |
| 1752 | 1752 |
| 1753 // static | 1753 // static |
| 1754 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { | 1754 void Builtins::Generate_ConstructProxy(MacroAssembler* masm) { |
| 1755 // ----------- S t a t e ------------- | 1755 // ----------- S t a t e ------------- |
| 1756 // -- r3 : the number of arguments (not including the receiver) | 1756 // -- r3 : the number of arguments (not including the receiver) |
| 1757 // -- r4 : the constructor to call (checked to be a JSFunctionProxy) | 1757 // -- r4 : the constructor to call (checked to be a JSFunctionProxy) |
| 1758 // -- r6 : the original constructor (either the same as the constructor or | 1758 // -- r6 : the new target (either the same as the constructor or |
| 1759 // the JSFunction on which new was invoked initially) | 1759 // the JSFunction on which new was invoked initially) |
| 1760 // ----------------------------------- | 1760 // ----------------------------------- |
| 1761 | 1761 |
| 1762 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. | 1762 // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies. |
| 1763 __ LoadP(r4, FieldMemOperand(r4, JSFunctionProxy::kConstructTrapOffset)); | 1763 __ LoadP(r4, FieldMemOperand(r4, JSFunctionProxy::kConstructTrapOffset)); |
| 1764 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1764 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
| 1765 } | 1765 } |
| 1766 | 1766 |
| 1767 | 1767 |
| 1768 // static | 1768 // static |
| 1769 void Builtins::Generate_Construct(MacroAssembler* masm) { | 1769 void Builtins::Generate_Construct(MacroAssembler* masm) { |
| 1770 // ----------- S t a t e ------------- | 1770 // ----------- S t a t e ------------- |
| 1771 // -- r3 : the number of arguments (not including the receiver) | 1771 // -- r3 : the number of arguments (not including the receiver) |
| 1772 // -- r4 : the constructor to call (can be any Object) | 1772 // -- r4 : the constructor to call (can be any Object) |
| 1773 // -- r6 : the original constructor (either the same as the constructor or | 1773 // -- r6 : the new target (either the same as the constructor or |
| 1774 // the JSFunction on which new was invoked initially) | 1774 // the JSFunction on which new was invoked initially) |
| 1775 // ----------------------------------- | 1775 // ----------------------------------- |
| 1776 | 1776 |
| 1777 // Check if target has a [[Construct]] internal method. | 1777 // Check if target has a [[Construct]] internal method. |
| 1778 Label non_constructor; | 1778 Label non_constructor; |
| 1779 __ JumpIfSmi(r4, &non_constructor); | 1779 __ JumpIfSmi(r4, &non_constructor); |
| 1780 __ LoadP(r7, FieldMemOperand(r4, HeapObject::kMapOffset)); | 1780 __ LoadP(r7, FieldMemOperand(r4, HeapObject::kMapOffset)); |
| 1781 __ lbz(r5, FieldMemOperand(r7, Map::kBitFieldOffset)); | 1781 __ lbz(r5, FieldMemOperand(r7, Map::kBitFieldOffset)); |
| 1782 __ TestBit(r5, Map::kIsConstructor, r0); | 1782 __ TestBit(r5, Map::kIsConstructor, r0); |
| 1783 __ beq(&non_constructor, cr0); | 1783 __ beq(&non_constructor, cr0); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1963 __ bkpt(0); | 1963 __ bkpt(0); |
| 1964 } | 1964 } |
| 1965 } | 1965 } |
| 1966 | 1966 |
| 1967 | 1967 |
| 1968 #undef __ | 1968 #undef __ |
| 1969 } // namespace internal | 1969 } // namespace internal |
| 1970 } // namespace v8 | 1970 } // namespace v8 |
| 1971 | 1971 |
| 1972 #endif // V8_TARGET_ARCH_PPC | 1972 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |