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

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: Addressed comments about ARM and MIPS. 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
« no previous file with comments | « src/arm/builtins-arm.cc ('k') | src/arm/full-codegen-arm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
2623 }
2624 // TODO(mstarzinger): Consider tweaking target recording to avoid push/pop.
2621 GenerateRecordCallTarget(masm); 2625 GenerateRecordCallTarget(masm);
2626 if (IsSuperConstructorCall()) {
2627 __ pop(r4);
2628 }
2622 2629
2623 __ add(r5, r2, Operand::PointerOffsetFromSmiKey(r3)); 2630 __ add(r5, r2, Operand::PointerOffsetFromSmiKey(r3));
2624 if (FLAG_pretenuring_call_new) { 2631 if (FLAG_pretenuring_call_new) {
2625 // Put the AllocationSite from the feedback vector into r2. 2632 // Put the AllocationSite from the feedback vector into r2.
2626 // By adding kPointerSize we encode that we know the AllocationSite 2633 // By adding kPointerSize we encode that we know the AllocationSite
2627 // entry is at the feedback vector slot given by r3 + 1. 2634 // entry is at the feedback vector slot given by r3 + 1.
2628 __ ldr(r2, FieldMemOperand(r5, FixedArray::kHeaderSize + kPointerSize)); 2635 __ ldr(r2, FieldMemOperand(r5, FixedArray::kHeaderSize + kPointerSize));
2629 } else { 2636 } else {
2630 Label feedback_register_initialized; 2637 Label feedback_register_initialized;
2631 // Put the AllocationSite from the feedback vector into r2, or undefined. 2638 // Put the AllocationSite from the feedback vector into r2, or undefined.
2632 __ ldr(r2, FieldMemOperand(r5, FixedArray::kHeaderSize)); 2639 __ ldr(r2, FieldMemOperand(r5, FixedArray::kHeaderSize));
2633 __ ldr(r5, FieldMemOperand(r2, AllocationSite::kMapOffset)); 2640 __ ldr(r5, FieldMemOperand(r2, AllocationSite::kMapOffset));
2634 __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex); 2641 __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex);
2635 __ b(eq, &feedback_register_initialized); 2642 __ b(eq, &feedback_register_initialized);
2636 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); 2643 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex);
2637 __ bind(&feedback_register_initialized); 2644 __ bind(&feedback_register_initialized);
2638 } 2645 }
2639 2646
2640 __ AssertUndefinedOrAllocationSite(r2, r5); 2647 __ AssertUndefinedOrAllocationSite(r2, r5);
2641 } 2648 }
2642 2649
2643 // Pass function as original constructor. 2650 // Pass function as original constructor.
2644 if (IsSuperConstructorCall()) { 2651 if (IsSuperConstructorCall()) {
2645 __ mov(r4, Operand(1 * kPointerSize)); 2652 __ mov(r3, r4);
2646 __ add(r4, r4, Operand(r0, LSL, kPointerSizeLog2));
2647 __ ldr(r3, MemOperand(sp, r4));
2648 } else { 2653 } else {
2649 __ mov(r3, r1); 2654 __ mov(r3, r1);
2650 } 2655 }
2651 2656
2652 // Jump to the function-specific construct stub. 2657 // Jump to the function-specific construct stub.
2653 Register jmp_reg = r4; 2658 Register jmp_reg = r4;
2654 __ ldr(jmp_reg, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); 2659 __ ldr(jmp_reg, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
2655 __ ldr(jmp_reg, FieldMemOperand(jmp_reg, 2660 __ ldr(jmp_reg, FieldMemOperand(jmp_reg,
2656 SharedFunctionInfo::kConstructStubOffset)); 2661 SharedFunctionInfo::kConstructStubOffset));
2657 __ add(pc, jmp_reg, Operand(Code::kHeaderSize - kHeapObjectTag)); 2662 __ add(pc, jmp_reg, Operand(Code::kHeaderSize - kHeapObjectTag));
2658 2663
2659 // r0: number of arguments 2664 // r0: number of arguments
2660 // r1: called object 2665 // r1: called object
2661 // r4: object type 2666 // r5: object type
2662 Label do_call; 2667 Label do_call;
2663 __ bind(&slow); 2668 __ bind(&slow);
2664 __ cmp(r4, Operand(JS_FUNCTION_PROXY_TYPE)); 2669 __ cmp(r5, Operand(JS_FUNCTION_PROXY_TYPE));
2665 __ b(ne, &non_function_call); 2670 __ b(ne, &non_function_call);
2666 __ GetBuiltinFunction(r1, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR); 2671 __ GetBuiltinFunction(r1, Builtins::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR);
2667 __ jmp(&do_call); 2672 __ jmp(&do_call);
2668 2673
2669 __ bind(&non_function_call); 2674 __ bind(&non_function_call);
2670 __ GetBuiltinFunction(r1, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); 2675 __ GetBuiltinFunction(r1, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR);
2671 __ bind(&do_call); 2676 __ bind(&do_call);
2672 // Set expected number of arguments to zero (not changing r0). 2677 // Set expected number of arguments to zero (not changing r0).
2673 __ mov(r2, Operand::Zero()); 2678 __ mov(r2, Operand::Zero());
2674 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 2679 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
(...skipping 2691 matching lines...) Expand 10 before | Expand all | Expand 10 after
5366 MemOperand(fp, 6 * kPointerSize), NULL); 5371 MemOperand(fp, 6 * kPointerSize), NULL);
5367 } 5372 }
5368 5373
5369 5374
5370 #undef __ 5375 #undef __
5371 5376
5372 } // namespace internal 5377 } // namespace internal
5373 } // namespace v8 5378 } // namespace v8
5374 5379
5375 #endif // V8_TARGET_ARCH_ARM 5380 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/builtins-arm.cc ('k') | src/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698