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

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

Issue 1362573002: X87: [builtins] Add support for NewTarget to Execution::New. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « no previous file | src/x87/builtins-x87.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 #if V8_TARGET_ARCH_X87 5 #if V8_TARGET_ARCH_X87
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 3889 matching lines...) Expand 10 before | Expand all | Expand 10 after
3900 3900
3901 3901
3902 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { 3902 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) {
3903 ZoneList<Expression*>* args = expr->arguments(); 3903 ZoneList<Expression*>* args = expr->arguments();
3904 DCHECK(args->length() == 2); 3904 DCHECK(args->length() == 2);
3905 3905
3906 // Evaluate new.target and super constructor. 3906 // Evaluate new.target and super constructor.
3907 VisitForStackValue(args->at(0)); 3907 VisitForStackValue(args->at(0));
3908 VisitForStackValue(args->at(1)); 3908 VisitForStackValue(args->at(1));
3909 3909
3910 // Load original constructor into ecx.
3911 __ mov(ecx, Operand(esp, 1 * kPointerSize));
3912
3913 // Check if the calling frame is an arguments adaptor frame. 3910 // Check if the calling frame is an arguments adaptor frame.
3914 Label adaptor_frame, args_set_up, runtime; 3911 Label adaptor_frame, args_set_up, runtime;
3915 __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); 3912 __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset));
3916 __ mov(ebx, Operand(edx, StandardFrameConstants::kContextOffset)); 3913 __ mov(ebx, Operand(edx, StandardFrameConstants::kContextOffset));
3917 __ cmp(ebx, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); 3914 __ cmp(ebx, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
3918 __ j(equal, &adaptor_frame); 3915 __ j(equal, &adaptor_frame);
3919 // default constructor has no arguments, so no adaptor frame means no args. 3916 // default constructor has no arguments, so no adaptor frame means no args.
3920 __ mov(eax, Immediate(0)); 3917 __ mov(eax, Immediate(0));
3921 __ jmp(&args_set_up); 3918 __ jmp(&args_set_up);
3922 3919
3923 // Copy arguments from adaptor frame. 3920 // Copy arguments from adaptor frame.
3924 { 3921 {
3925 __ bind(&adaptor_frame); 3922 __ bind(&adaptor_frame);
3926 __ mov(ebx, Operand(edx, ArgumentsAdaptorFrameConstants::kLengthOffset)); 3923 __ mov(ebx, Operand(edx, ArgumentsAdaptorFrameConstants::kLengthOffset));
3927 __ SmiUntag(ebx); 3924 __ SmiUntag(ebx);
3928 3925
3929 __ mov(eax, ebx); 3926 __ mov(eax, ebx);
3930 __ lea(edx, Operand(edx, ebx, times_pointer_size, 3927 __ lea(edx, Operand(edx, ebx, times_pointer_size,
3931 StandardFrameConstants::kCallerSPOffset)); 3928 StandardFrameConstants::kCallerSPOffset));
3932 Label loop; 3929 Label loop;
3933 __ bind(&loop); 3930 __ bind(&loop);
3934 __ push(Operand(edx, -1 * kPointerSize)); 3931 __ push(Operand(edx, -1 * kPointerSize));
3935 __ sub(edx, Immediate(kPointerSize)); 3932 __ sub(edx, Immediate(kPointerSize));
3936 __ dec(ebx); 3933 __ dec(ebx);
3937 __ j(not_zero, &loop); 3934 __ j(not_zero, &loop);
3938 } 3935 }
3939 3936
3940 __ bind(&args_set_up); 3937 __ bind(&args_set_up);
3941 3938
3942 __ mov(edi, Operand(esp, eax, times_pointer_size, 0)); 3939 __ mov(edx, Operand(esp, eax, times_pointer_size, 1 * kPointerSize));
3943 __ mov(ebx, Immediate(isolate()->factory()->undefined_value())); 3940 __ mov(edi, Operand(esp, eax, times_pointer_size, 0 * kPointerSize));
3944 CallConstructStub stub(isolate(), SUPER_CONSTRUCTOR_CALL); 3941 __ Call(isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL);
3945 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
3946 3942
3947 // Restore context register. 3943 // Restore context register.
3948 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 3944 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
3949 3945
3950 context()->DropAndPlug(1, eax); 3946 context()->DropAndPlug(1, eax);
3951 } 3947 }
3952 3948
3953 3949
3954 void FullCodeGenerator::EmitRegExpConstructResult(CallRuntime* expr) { 3950 void FullCodeGenerator::EmitRegExpConstructResult(CallRuntime* expr) {
3955 // Load the arguments on the stack and call the stub. 3951 // Load the arguments on the stack and call the stub.
(...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after
5127 Assembler::target_address_at(call_target_address, 5123 Assembler::target_address_at(call_target_address,
5128 unoptimized_code)); 5124 unoptimized_code));
5129 return OSR_AFTER_STACK_CHECK; 5125 return OSR_AFTER_STACK_CHECK;
5130 } 5126 }
5131 5127
5132 5128
5133 } // namespace internal 5129 } // namespace internal
5134 } // namespace v8 5130 } // namespace v8
5135 5131
5136 #endif // V8_TARGET_ARCH_X87 5132 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « no previous file | src/x87/builtins-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698