Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: src/arm/code-stubs-arm.cc

Issue 1237813002: Switch CallConstructStub to take new.target in register. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Ported to all architectures. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_ARM 7 #if V8_TARGET_ARCH_ARM
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 2589 matching lines...) Expand 10 before | Expand all | Expand 10 after
2600 2600
2601 void CallFunctionStub::Generate(MacroAssembler* masm) { 2601 void CallFunctionStub::Generate(MacroAssembler* masm) {
2602 CallFunctionNoFeedback(masm, argc(), NeedsChecks(), CallAsMethod()); 2602 CallFunctionNoFeedback(masm, argc(), NeedsChecks(), CallAsMethod());
2603 } 2603 }
2604 2604
2605 2605
2606 void CallConstructStub::Generate(MacroAssembler* masm) { 2606 void CallConstructStub::Generate(MacroAssembler* masm) {
2607 // r0 : number of arguments 2607 // r0 : number of arguments
2608 // r1 : the function to call 2608 // r1 : the function to call
2609 // r2 : feedback vector 2609 // r2 : feedback vector
2610 // r3 : (only if r2 is not the megamorphic symbol) slot in feedback 2610 // r3 : slot in feedback vector (Smi, for RecordCallTarget)
2611 // vector (Smi) 2611 // r4 : original constructor (for IsSuperConstructorCall)
2612 Label slow, non_function_call; 2612 Label slow, non_function_call;
2613 2613
2614 // Check that the function is not a smi. 2614 // Check that the function is not a smi.
2615 __ JumpIfSmi(r1, &non_function_call); 2615 __ JumpIfSmi(r1, &non_function_call);
2616 // Check that the function is a JSFunction. 2616 // Check that the function is a JSFunction.
2617 __ CompareObjectType(r1, r4, r4, JS_FUNCTION_TYPE); 2617 __ CompareObjectType(r1, r5, r5, JS_FUNCTION_TYPE);
2618 __ b(ne, &slow); 2618 __ b(ne, &slow);
2619 2619
2620 if (RecordCallTarget()) { 2620 if (RecordCallTarget()) {
2621 if (IsSuperConstructorCall()) {
2622 __ push(r4);
Michael Starzinger 2015/07/14 15:02:47 Potentially applies to all architectures: Note tha
jbramley 2015/07/14 16:57:35 A TODO is probably a good idea, but it's up to you
Michael Starzinger 2015/07/15 07:36:36 Done. Added a TODO here.
2623 }
2621 GenerateRecordCallTarget(masm); 2624 GenerateRecordCallTarget(masm);
2625 if (IsSuperConstructorCall()) {
2626 __ pop(r4);
2627 }
2622 2628
2623 __ add(r5, r2, Operand::PointerOffsetFromSmiKey(r3)); 2629 __ add(r5, r2, Operand::PointerOffsetFromSmiKey(r3));
2624 if (FLAG_pretenuring_call_new) { 2630 if (FLAG_pretenuring_call_new) {
2625 // Put the AllocationSite from the feedback vector into r2. 2631 // Put the AllocationSite from the feedback vector into r2.
2626 // By adding kPointerSize we encode that we know the AllocationSite 2632 // By adding kPointerSize we encode that we know the AllocationSite
2627 // entry is at the feedback vector slot given by r3 + 1. 2633 // entry is at the feedback vector slot given by r3 + 1.
2628 __ ldr(r2, FieldMemOperand(r5, FixedArray::kHeaderSize + kPointerSize)); 2634 __ ldr(r2, FieldMemOperand(r5, FixedArray::kHeaderSize + kPointerSize));
2629 } else { 2635 } else {
2630 Label feedback_register_initialized; 2636 Label feedback_register_initialized;
2631 // Put the AllocationSite from the feedback vector into r2, or undefined. 2637 // Put the AllocationSite from the feedback vector into r2, or undefined.
2632 __ ldr(r2, FieldMemOperand(r5, FixedArray::kHeaderSize)); 2638 __ ldr(r2, FieldMemOperand(r5, FixedArray::kHeaderSize));
2633 __ ldr(r5, FieldMemOperand(r2, AllocationSite::kMapOffset)); 2639 __ ldr(r5, FieldMemOperand(r2, AllocationSite::kMapOffset));
2634 __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex); 2640 __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex);
2635 __ b(eq, &feedback_register_initialized); 2641 __ b(eq, &feedback_register_initialized);
2636 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); 2642 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex);
2637 __ bind(&feedback_register_initialized); 2643 __ bind(&feedback_register_initialized);
2638 } 2644 }
2639 2645
2640 __ AssertUndefinedOrAllocationSite(r2, r5); 2646 __ AssertUndefinedOrAllocationSite(r2, r5);
2641 } 2647 }
2642 2648
2643 // Pass function as original constructor. 2649 // Pass function as original constructor.
2644 if (IsSuperConstructorCall()) { 2650 if (IsSuperConstructorCall()) {
2645 __ mov(r4, Operand(1 * kPointerSize)); 2651 __ mov(r3, r4);
2646 __ add(r4, r4, Operand(r0, LSL, kPointerSizeLog2));
2647 __ ldr(r3, MemOperand(sp, r4));
2648 } else { 2652 } else {
2649 __ mov(r3, r1); 2653 __ mov(r3, r1);
2650 } 2654 }
2651 2655
2652 // Jump to the function-specific construct stub. 2656 // Jump to the function-specific construct stub.
2653 Register jmp_reg = r4; 2657 Register jmp_reg = r4;
2654 __ ldr(jmp_reg, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); 2658 __ ldr(jmp_reg, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
2655 __ ldr(jmp_reg, FieldMemOperand(jmp_reg, 2659 __ ldr(jmp_reg, FieldMemOperand(jmp_reg,
2656 SharedFunctionInfo::kConstructStubOffset)); 2660 SharedFunctionInfo::kConstructStubOffset));
2657 __ add(pc, jmp_reg, Operand(Code::kHeaderSize - kHeapObjectTag)); 2661 __ add(pc, jmp_reg, Operand(Code::kHeaderSize - kHeapObjectTag));
2658 2662
2659 // r0: number of arguments 2663 // r0: number of arguments
2660 // r1: called object 2664 // r1: called object
2661 // r4: object type 2665 // r5: object type
2662 Label do_call; 2666 Label do_call;
2663 __ bind(&slow); 2667 __ bind(&slow);
2664 __ cmp(r4, Operand(JS_FUNCTION_PROXY_TYPE)); 2668 __ cmp(r5, Operand(JS_FUNCTION_PROXY_TYPE));
2665 __ b(ne, &non_function_call); 2669 __ b(ne, &non_function_call);
2666 __ GetBuiltinFunction(r1, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR); 2670 __ GetBuiltinFunction(r1, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR);
2667 __ jmp(&do_call); 2671 __ jmp(&do_call);
2668 2672
2669 __ bind(&non_function_call); 2673 __ bind(&non_function_call);
2670 __ GetBuiltinFunction(r1, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); 2674 __ GetBuiltinFunction(r1, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR);
2671 __ bind(&do_call); 2675 __ bind(&do_call);
2672 // Set expected number of arguments to zero (not changing r0). 2676 // Set expected number of arguments to zero (not changing r0).
2673 __ mov(r2, Operand::Zero()); 2677 __ mov(r2, Operand::Zero());
2674 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 2678 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
(...skipping 2691 matching lines...) Expand 10 before | Expand all | Expand 10 after
5366 MemOperand(fp, 6 * kPointerSize), NULL); 5370 MemOperand(fp, 6 * kPointerSize), NULL);
5367 } 5371 }
5368 5372
5369 5373
5370 #undef __ 5374 #undef __
5371 5375
5372 } // namespace internal 5376 } // namespace internal
5373 } // namespace v8 5377 } // namespace v8
5374 5378
5375 #endif // V8_TARGET_ARCH_ARM 5379 #endif // V8_TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698