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

Side by Side Diff: src/full-codegen/x64/full-codegen-x64.cc

Issue 1359583002: [builtins] Add support for NewTarget to Execution::New. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Merge mips and mips64 ports. Created 5 years, 3 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/full-codegen/mips64/full-codegen-mips64.cc ('k') | src/globals.h » ('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 #if V8_TARGET_ARCH_X64 5 #if V8_TARGET_ARCH_X64
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/code-stubs.h" 8 #include "src/code-stubs.h"
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/compiler.h" 10 #include "src/compiler.h"
(...skipping 3932 matching lines...) Expand 10 before | Expand all | Expand 10 after
3943 3943
3944 3944
3945 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { 3945 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) {
3946 ZoneList<Expression*>* args = expr->arguments(); 3946 ZoneList<Expression*>* args = expr->arguments();
3947 DCHECK(args->length() == 2); 3947 DCHECK(args->length() == 2);
3948 3948
3949 // Evaluate new.target and super constructor. 3949 // Evaluate new.target and super constructor.
3950 VisitForStackValue(args->at(0)); 3950 VisitForStackValue(args->at(0));
3951 VisitForStackValue(args->at(1)); 3951 VisitForStackValue(args->at(1));
3952 3952
3953 // Load original constructor into rcx.
3954 __ movp(rcx, Operand(rsp, 1 * kPointerSize));
3955
3956 // Check if the calling frame is an arguments adaptor frame. 3953 // Check if the calling frame is an arguments adaptor frame.
3957 Label adaptor_frame, args_set_up, runtime; 3954 Label adaptor_frame, args_set_up, runtime;
3958 __ movp(rdx, Operand(rbp, StandardFrameConstants::kCallerFPOffset)); 3955 __ movp(rdx, Operand(rbp, StandardFrameConstants::kCallerFPOffset));
3959 __ movp(rbx, Operand(rdx, StandardFrameConstants::kContextOffset)); 3956 __ movp(rbx, Operand(rdx, StandardFrameConstants::kContextOffset));
3960 __ Cmp(rbx, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); 3957 __ Cmp(rbx, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR));
3961 __ j(equal, &adaptor_frame); 3958 __ j(equal, &adaptor_frame);
3962 // default constructor has no arguments, so no adaptor frame means no args. 3959 // default constructor has no arguments, so no adaptor frame means no args.
3963 __ movp(rax, Immediate(0)); 3960 __ movp(rax, Immediate(0));
3964 __ jmp(&args_set_up); 3961 __ jmp(&args_set_up);
3965 3962
3966 // Copy arguments from adaptor frame. 3963 // Copy arguments from adaptor frame.
3967 { 3964 {
3968 __ bind(&adaptor_frame); 3965 __ bind(&adaptor_frame);
3969 __ movp(rbx, Operand(rdx, ArgumentsAdaptorFrameConstants::kLengthOffset)); 3966 __ movp(rbx, Operand(rdx, ArgumentsAdaptorFrameConstants::kLengthOffset));
3970 __ SmiToInteger64(rbx, rbx); 3967 __ SmiToInteger64(rbx, rbx);
3971 3968
3972 __ movp(rax, rbx); 3969 __ movp(rax, rbx);
3973 __ leap(rdx, Operand(rdx, rbx, times_pointer_size, 3970 __ leap(rdx, Operand(rdx, rbx, times_pointer_size,
3974 StandardFrameConstants::kCallerSPOffset)); 3971 StandardFrameConstants::kCallerSPOffset));
3975 Label loop; 3972 Label loop;
3976 __ bind(&loop); 3973 __ bind(&loop);
3977 __ Push(Operand(rdx, -1 * kPointerSize)); 3974 __ Push(Operand(rdx, -1 * kPointerSize));
3978 __ subp(rdx, Immediate(kPointerSize)); 3975 __ subp(rdx, Immediate(kPointerSize));
3979 __ decp(rbx); 3976 __ decp(rbx);
3980 __ j(not_zero, &loop); 3977 __ j(not_zero, &loop);
3981 } 3978 }
3982 3979
3983 __ bind(&args_set_up); 3980 __ bind(&args_set_up);
3984 __ movp(rdi, Operand(rsp, rax, times_pointer_size, 0)); 3981 __ movp(rdx, Operand(rsp, rax, times_pointer_size, 1 * kPointerSize));
3985 __ LoadRoot(rbx, Heap::kUndefinedValueRootIndex); 3982 __ movp(rdi, Operand(rsp, rax, times_pointer_size, 0 * kPointerSize));
3986 3983 __ Call(isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL);
3987 CallConstructStub stub(isolate(), SUPER_CONSTRUCTOR_CALL);
3988 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
3989 3984
3990 // Restore context register. 3985 // Restore context register.
3991 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); 3986 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
3992 3987
3993 context()->DropAndPlug(1, rax); 3988 context()->DropAndPlug(1, rax);
3994 } 3989 }
3995 3990
3996 3991
3997 void FullCodeGenerator::EmitRegExpConstructResult(CallRuntime* expr) { 3992 void FullCodeGenerator::EmitRegExpConstructResult(CallRuntime* expr) {
3998 RegExpConstructResultStub stub(isolate()); 3993 RegExpConstructResultStub stub(isolate());
(...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after
5190 Assembler::target_address_at(call_target_address, 5185 Assembler::target_address_at(call_target_address,
5191 unoptimized_code)); 5186 unoptimized_code));
5192 return OSR_AFTER_STACK_CHECK; 5187 return OSR_AFTER_STACK_CHECK;
5193 } 5188 }
5194 5189
5195 5190
5196 } // namespace internal 5191 } // namespace internal
5197 } // namespace v8 5192 } // namespace v8
5198 5193
5199 #endif // V8_TARGET_ARCH_X64 5194 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/full-codegen/mips64/full-codegen-mips64.cc ('k') | src/globals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698