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

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

Issue 1235273003: X87: Switch CallConstructStub to take new.target in register. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/x87/code-stubs-x87.cc ('k') | src/x87/interface-descriptors-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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_X87 7 #if V8_TARGET_ARCH_X87
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 3244 matching lines...) Expand 10 before | Expand all | Expand 10 after
3255 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); 3255 PrepareForBailoutForId(expr->ReturnId(), TOS_REG);
3256 context()->Plug(eax); 3256 context()->Plug(eax);
3257 } 3257 }
3258 3258
3259 3259
3260 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { 3260 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) {
3261 SuperCallReference* super_call_ref = 3261 SuperCallReference* super_call_ref =
3262 expr->expression()->AsSuperCallReference(); 3262 expr->expression()->AsSuperCallReference();
3263 DCHECK_NOT_NULL(super_call_ref); 3263 DCHECK_NOT_NULL(super_call_ref);
3264 3264
3265 VariableProxy* new_target_proxy = super_call_ref->new_target_var();
3266 VisitForStackValue(new_target_proxy);
3267
3268 EmitLoadSuperConstructor(super_call_ref); 3265 EmitLoadSuperConstructor(super_call_ref);
3269 __ push(result_register()); 3266 __ push(result_register());
3270 3267
3271 // Push the arguments ("left-to-right") on the stack. 3268 // Push the arguments ("left-to-right") on the stack.
3272 ZoneList<Expression*>* args = expr->arguments(); 3269 ZoneList<Expression*>* args = expr->arguments();
3273 int arg_count = args->length(); 3270 int arg_count = args->length();
3274 for (int i = 0; i < arg_count; i++) { 3271 for (int i = 0; i < arg_count; i++) {
3275 VisitForStackValue(args->at(i)); 3272 VisitForStackValue(args->at(i));
3276 } 3273 }
3277 3274
3278 // Call the construct call builtin that handles allocation and 3275 // Call the construct call builtin that handles allocation and
3279 // constructor invocation. 3276 // constructor invocation.
3280 SetConstructCallPosition(expr); 3277 SetConstructCallPosition(expr);
3281 3278
3279 // Load original constructor into ecx.
3280 VisitForAccumulatorValue(super_call_ref->new_target_var());
3281 __ mov(ecx, result_register());
3282
3282 // Load function and argument count into edi and eax. 3283 // Load function and argument count into edi and eax.
3283 __ Move(eax, Immediate(arg_count)); 3284 __ Move(eax, Immediate(arg_count));
3284 __ mov(edi, Operand(esp, arg_count * kPointerSize)); 3285 __ mov(edi, Operand(esp, arg_count * kPointerSize));
3285 3286
3286 // Record call targets in unoptimized code. 3287 // Record call targets in unoptimized code.
3287 if (FLAG_pretenuring_call_new) { 3288 if (FLAG_pretenuring_call_new) {
3288 UNREACHABLE(); 3289 UNREACHABLE();
3289 /* TODO(dslomov): support pretenuring. 3290 /* TODO(dslomov): support pretenuring.
3290 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); 3291 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot());
3291 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == 3292 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() ==
3292 expr->CallNewFeedbackSlot().ToInt() + 1); 3293 expr->CallNewFeedbackSlot().ToInt() + 1);
3293 */ 3294 */
3294 } 3295 }
3295 3296
3296 __ LoadHeapObject(ebx, FeedbackVector()); 3297 __ LoadHeapObject(ebx, FeedbackVector());
3297 __ mov(edx, Immediate(SmiFromSlot(expr->CallFeedbackSlot()))); 3298 __ mov(edx, Immediate(SmiFromSlot(expr->CallFeedbackSlot())));
3298 3299
3299 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET); 3300 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET);
3300 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); 3301 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
3301 3302
3302 __ Drop(1);
3303
3304 RecordJSReturnSite(expr); 3303 RecordJSReturnSite(expr);
3305 3304
3306 EmitInitializeThisAfterSuper(super_call_ref, expr->CallFeedbackICSlot()); 3305 EmitInitializeThisAfterSuper(super_call_ref, expr->CallFeedbackICSlot());
3307 context()->Plug(eax); 3306 context()->Plug(eax);
3308 } 3307 }
3309 3308
3310 3309
3311 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { 3310 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
3312 ZoneList<Expression*>* args = expr->arguments(); 3311 ZoneList<Expression*>* args = expr->arguments();
3313 DCHECK(args->length() == 1); 3312 DCHECK(args->length() == 1);
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
4218 DCHECK(args->length() == 2); 4217 DCHECK(args->length() == 2);
4219 4218
4220 // new.target 4219 // new.target
4221 VisitForStackValue(args->at(0)); 4220 VisitForStackValue(args->at(0));
4222 4221
4223 // .this_function 4222 // .this_function
4224 VisitForStackValue(args->at(1)); 4223 VisitForStackValue(args->at(1));
4225 __ CallRuntime(Runtime::kGetPrototype, 1); 4224 __ CallRuntime(Runtime::kGetPrototype, 1);
4226 __ push(result_register()); 4225 __ push(result_register());
4227 4226
4227 // Load original constructor into ecx.
4228 __ mov(ecx, Operand(esp, 1 * kPointerSize));
4229
4228 // Check if the calling frame is an arguments adaptor frame. 4230 // Check if the calling frame is an arguments adaptor frame.
4229 Label adaptor_frame, args_set_up, runtime; 4231 Label adaptor_frame, args_set_up, runtime;
4230 __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); 4232 __ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset));
4231 __ mov(ecx, Operand(edx, StandardFrameConstants::kContextOffset)); 4233 __ mov(ebx, Operand(edx, StandardFrameConstants::kContextOffset));
4232 __ cmp(ecx, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); 4234 __ cmp(ebx, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
4233 __ j(equal, &adaptor_frame); 4235 __ j(equal, &adaptor_frame);
4234 // default constructor has no arguments, so no adaptor frame means no args. 4236 // default constructor has no arguments, so no adaptor frame means no args.
4235 __ mov(eax, Immediate(0)); 4237 __ mov(eax, Immediate(0));
4236 __ jmp(&args_set_up); 4238 __ jmp(&args_set_up);
4237 4239
4238 // Copy arguments from adaptor frame. 4240 // Copy arguments from adaptor frame.
4239 { 4241 {
4240 __ bind(&adaptor_frame); 4242 __ bind(&adaptor_frame);
4241 __ mov(ecx, Operand(edx, ArgumentsAdaptorFrameConstants::kLengthOffset)); 4243 __ mov(ebx, Operand(edx, ArgumentsAdaptorFrameConstants::kLengthOffset));
4242 __ SmiUntag(ecx); 4244 __ SmiUntag(ebx);
4243 4245
4244 __ mov(eax, ecx); 4246 __ mov(eax, ebx);
4245 __ lea(edx, Operand(edx, ecx, times_pointer_size, 4247 __ lea(edx, Operand(edx, ebx, times_pointer_size,
4246 StandardFrameConstants::kCallerSPOffset)); 4248 StandardFrameConstants::kCallerSPOffset));
4247 Label loop; 4249 Label loop;
4248 __ bind(&loop); 4250 __ bind(&loop);
4249 __ push(Operand(edx, -1 * kPointerSize)); 4251 __ push(Operand(edx, -1 * kPointerSize));
4250 __ sub(edx, Immediate(kPointerSize)); 4252 __ sub(edx, Immediate(kPointerSize));
4251 __ dec(ecx); 4253 __ dec(ebx);
4252 __ j(not_zero, &loop); 4254 __ j(not_zero, &loop);
4253 } 4255 }
4254 4256
4255 __ bind(&args_set_up); 4257 __ bind(&args_set_up);
4256 4258
4257 __ mov(edi, Operand(esp, eax, times_pointer_size, 0)); 4259 __ mov(edi, Operand(esp, eax, times_pointer_size, 0));
4258 __ mov(ebx, Immediate(isolate()->factory()->undefined_value())); 4260 __ mov(ebx, Immediate(isolate()->factory()->undefined_value()));
4259 CallConstructStub stub(isolate(), SUPER_CONSTRUCTOR_CALL); 4261 CallConstructStub stub(isolate(), SUPER_CONSTRUCTOR_CALL);
4260 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); 4262 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
4261 4263
(...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after
5501 Assembler::target_address_at(call_target_address, 5503 Assembler::target_address_at(call_target_address,
5502 unoptimized_code)); 5504 unoptimized_code));
5503 return OSR_AFTER_STACK_CHECK; 5505 return OSR_AFTER_STACK_CHECK;
5504 } 5506 }
5505 5507
5506 5508
5507 } // namespace internal 5509 } // namespace internal
5508 } // namespace v8 5510 } // namespace v8
5509 5511
5510 #endif // V8_TARGET_ARCH_X87 5512 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x87/code-stubs-x87.cc ('k') | src/x87/interface-descriptors-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698