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

Side by Side Diff: src/arm64/full-codegen-arm64.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/arm64/code-stubs-arm64.cc ('k') | src/arm64/interface-descriptors-arm64.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_ARM64 7 #if V8_TARGET_ARCH_ARM64
8 8
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 3056 matching lines...) Expand 10 before | Expand all | Expand 10 after
3067 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); 3067 PrepareForBailoutForId(expr->ReturnId(), TOS_REG);
3068 context()->Plug(x0); 3068 context()->Plug(x0);
3069 } 3069 }
3070 3070
3071 3071
3072 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { 3072 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) {
3073 SuperCallReference* super_call_ref = 3073 SuperCallReference* super_call_ref =
3074 expr->expression()->AsSuperCallReference(); 3074 expr->expression()->AsSuperCallReference();
3075 DCHECK_NOT_NULL(super_call_ref); 3075 DCHECK_NOT_NULL(super_call_ref);
3076 3076
3077 VariableProxy* new_target_proxy = super_call_ref->new_target_var();
3078 VisitForStackValue(new_target_proxy);
3079
3080 EmitLoadSuperConstructor(super_call_ref); 3077 EmitLoadSuperConstructor(super_call_ref);
3081 __ push(result_register()); 3078 __ push(result_register());
3082 3079
3083 // Push the arguments ("left-to-right") on the stack. 3080 // Push the arguments ("left-to-right") on the stack.
3084 ZoneList<Expression*>* args = expr->arguments(); 3081 ZoneList<Expression*>* args = expr->arguments();
3085 int arg_count = args->length(); 3082 int arg_count = args->length();
3086 for (int i = 0; i < arg_count; i++) { 3083 for (int i = 0; i < arg_count; i++) {
3087 VisitForStackValue(args->at(i)); 3084 VisitForStackValue(args->at(i));
3088 } 3085 }
3089 3086
3090 // Call the construct call builtin that handles allocation and 3087 // Call the construct call builtin that handles allocation and
3091 // constructor invocation. 3088 // constructor invocation.
3092 SetConstructCallPosition(expr); 3089 SetConstructCallPosition(expr);
3093 3090
3091 // Load original constructor into x4.
3092 VisitForAccumulatorValue(super_call_ref->new_target_var());
3093 __ Mov(x4, result_register());
3094
3094 // Load function and argument count into x1 and x0. 3095 // Load function and argument count into x1 and x0.
3095 __ Mov(x0, arg_count); 3096 __ Mov(x0, arg_count);
3096 __ Peek(x1, arg_count * kXRegSize); 3097 __ Peek(x1, arg_count * kXRegSize);
3097 3098
3098 // Record call targets in unoptimized code. 3099 // Record call targets in unoptimized code.
3099 if (FLAG_pretenuring_call_new) { 3100 if (FLAG_pretenuring_call_new) {
3100 UNREACHABLE(); 3101 UNREACHABLE();
3101 /* TODO(dslomov): support pretenuring. 3102 /* TODO(dslomov): support pretenuring.
3102 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); 3103 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot());
3103 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == 3104 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() ==
3104 expr->CallNewFeedbackSlot().ToInt() + 1); 3105 expr->CallNewFeedbackSlot().ToInt() + 1);
3105 */ 3106 */
3106 } 3107 }
3107 3108
3108 __ LoadObject(x2, FeedbackVector()); 3109 __ LoadObject(x2, FeedbackVector());
3109 __ Mov(x3, SmiFromSlot(expr->CallFeedbackSlot())); 3110 __ Mov(x3, SmiFromSlot(expr->CallFeedbackSlot()));
3110 3111
3111 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET); 3112 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET);
3112 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); 3113 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
3113 3114
3114 __ Drop(1);
3115
3116 RecordJSReturnSite(expr); 3115 RecordJSReturnSite(expr);
3117 3116
3118 EmitInitializeThisAfterSuper(super_call_ref, expr->CallFeedbackICSlot()); 3117 EmitInitializeThisAfterSuper(super_call_ref, expr->CallFeedbackICSlot());
3119 context()->Plug(x0); 3118 context()->Plug(x0);
3120 } 3119 }
3121 3120
3122 3121
3123 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { 3122 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
3124 ZoneList<Expression*>* args = expr->arguments(); 3123 ZoneList<Expression*>* args = expr->arguments();
3125 DCHECK(args->length() == 1); 3124 DCHECK(args->length() == 1);
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after
4036 DCHECK(args->length() == 2); 4035 DCHECK(args->length() == 2);
4037 4036
4038 // new.target 4037 // new.target
4039 VisitForStackValue(args->at(0)); 4038 VisitForStackValue(args->at(0));
4040 4039
4041 // .this_function 4040 // .this_function
4042 VisitForStackValue(args->at(1)); 4041 VisitForStackValue(args->at(1));
4043 __ CallRuntime(Runtime::kGetPrototype, 1); 4042 __ CallRuntime(Runtime::kGetPrototype, 1);
4044 __ Push(result_register()); 4043 __ Push(result_register());
4045 4044
4045 // Load original constructor into x4.
4046 __ Peek(x4, 1 * kPointerSize);
4047
4046 // Check if the calling frame is an arguments adaptor frame. 4048 // Check if the calling frame is an arguments adaptor frame.
4047 Label adaptor_frame, args_set_up, runtime; 4049 Label adaptor_frame, args_set_up, runtime;
4048 __ Ldr(x11, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); 4050 __ Ldr(x11, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
4049 __ Ldr(x12, MemOperand(x11, StandardFrameConstants::kContextOffset)); 4051 __ Ldr(x12, MemOperand(x11, StandardFrameConstants::kContextOffset));
4050 __ Cmp(x12, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); 4052 __ Cmp(x12, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR));
4051 __ B(eq, &adaptor_frame); 4053 __ B(eq, &adaptor_frame);
4052 // default constructor has no arguments, so no adaptor frame means no args. 4054 // default constructor has no arguments, so no adaptor frame means no args.
4053 __ Mov(x0, Operand(0)); 4055 __ Mov(x0, Operand(0));
4054 __ B(&args_set_up); 4056 __ B(&args_set_up);
4055 4057
(...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after
5616 } 5618 }
5617 5619
5618 return INTERRUPT; 5620 return INTERRUPT;
5619 } 5621 }
5620 5622
5621 5623
5622 } // namespace internal 5624 } // namespace internal
5623 } // namespace v8 5625 } // namespace v8
5624 5626
5625 #endif // V8_TARGET_ARCH_ARM64 5627 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm64/code-stubs-arm64.cc ('k') | src/arm64/interface-descriptors-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698