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

Side by Side Diff: src/arm/full-codegen-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/code-stubs-arm.cc ('k') | src/arm/interface-descriptors-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/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 3368 matching lines...) Expand 10 before | Expand all | Expand 10 after
3379 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); 3379 PrepareForBailoutForId(expr->ReturnId(), TOS_REG);
3380 context()->Plug(r0); 3380 context()->Plug(r0);
3381 } 3381 }
3382 3382
3383 3383
3384 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { 3384 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) {
3385 SuperCallReference* super_call_ref = 3385 SuperCallReference* super_call_ref =
3386 expr->expression()->AsSuperCallReference(); 3386 expr->expression()->AsSuperCallReference();
3387 DCHECK_NOT_NULL(super_call_ref); 3387 DCHECK_NOT_NULL(super_call_ref);
3388 3388
3389 VariableProxy* new_target_proxy = super_call_ref->new_target_var();
3390 VisitForStackValue(new_target_proxy);
3391
3392 EmitLoadSuperConstructor(super_call_ref); 3389 EmitLoadSuperConstructor(super_call_ref);
3393 __ push(result_register()); 3390 __ push(result_register());
3394 3391
3395 // Push the arguments ("left-to-right") on the stack. 3392 // Push the arguments ("left-to-right") on the stack.
3396 ZoneList<Expression*>* args = expr->arguments(); 3393 ZoneList<Expression*>* args = expr->arguments();
3397 int arg_count = args->length(); 3394 int arg_count = args->length();
3398 for (int i = 0; i < arg_count; i++) { 3395 for (int i = 0; i < arg_count; i++) {
3399 VisitForStackValue(args->at(i)); 3396 VisitForStackValue(args->at(i));
3400 } 3397 }
3401 3398
3402 // Call the construct call builtin that handles allocation and 3399 // Call the construct call builtin that handles allocation and
3403 // constructor invocation. 3400 // constructor invocation.
3404 SetConstructCallPosition(expr); 3401 SetConstructCallPosition(expr);
3405 3402
3403 // Load original constructor into r4.
3404 VisitForAccumulatorValue(super_call_ref->new_target_var());
3405 __ mov(r4, result_register());
3406
3406 // Load function and argument count into r1 and r0. 3407 // Load function and argument count into r1 and r0.
3407 __ mov(r0, Operand(arg_count)); 3408 __ mov(r0, Operand(arg_count));
3408 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize)); 3409 __ ldr(r1, MemOperand(sp, arg_count * kPointerSize));
3409 3410
3410 // Record call targets in unoptimized code. 3411 // Record call targets in unoptimized code.
3411 if (FLAG_pretenuring_call_new) { 3412 if (FLAG_pretenuring_call_new) {
3412 UNREACHABLE(); 3413 UNREACHABLE();
3413 /* TODO(dslomov): support pretenuring. 3414 /* TODO(dslomov): support pretenuring.
3414 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); 3415 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot());
3415 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == 3416 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() ==
3416 expr->CallNewFeedbackSlot().ToInt() + 1); 3417 expr->CallNewFeedbackSlot().ToInt() + 1);
3417 */ 3418 */
3418 } 3419 }
3419 3420
3420 __ Move(r2, FeedbackVector()); 3421 __ Move(r2, FeedbackVector());
3421 __ mov(r3, Operand(SmiFromSlot(expr->CallFeedbackSlot()))); 3422 __ mov(r3, Operand(SmiFromSlot(expr->CallFeedbackSlot())));
3422 3423
3423 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET); 3424 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET);
3424 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); 3425 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
3425 3426
3426 __ Drop(1);
3427
3428 RecordJSReturnSite(expr); 3427 RecordJSReturnSite(expr);
3429 3428
3430 EmitInitializeThisAfterSuper(super_call_ref, expr->CallFeedbackICSlot()); 3429 EmitInitializeThisAfterSuper(super_call_ref, expr->CallFeedbackICSlot());
3431 context()->Plug(r0); 3430 context()->Plug(r0);
3432 } 3431 }
3433 3432
3434 3433
3435 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { 3434 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
3436 ZoneList<Expression*>* args = expr->arguments(); 3435 ZoneList<Expression*>* args = expr->arguments();
3437 DCHECK(args->length() == 1); 3436 DCHECK(args->length() == 1);
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
4328 DCHECK(args->length() == 2); 4327 DCHECK(args->length() == 2);
4329 4328
4330 // new.target 4329 // new.target
4331 VisitForStackValue(args->at(0)); 4330 VisitForStackValue(args->at(0));
4332 4331
4333 // .this_function 4332 // .this_function
4334 VisitForStackValue(args->at(1)); 4333 VisitForStackValue(args->at(1));
4335 __ CallRuntime(Runtime::kGetPrototype, 1); 4334 __ CallRuntime(Runtime::kGetPrototype, 1);
4336 __ Push(result_register()); 4335 __ Push(result_register());
4337 4336
4337 // Load original constructor into r4.
4338 __ ldr(r4, MemOperand(sp, 1 * kPointerSize));
4339
4338 // Check if the calling frame is an arguments adaptor frame. 4340 // Check if the calling frame is an arguments adaptor frame.
4339 Label adaptor_frame, args_set_up, runtime; 4341 Label adaptor_frame, args_set_up, runtime;
4340 __ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); 4342 __ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
4341 __ ldr(r3, MemOperand(r2, StandardFrameConstants::kContextOffset)); 4343 __ ldr(r3, MemOperand(r2, StandardFrameConstants::kContextOffset));
4342 __ cmp(r3, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); 4344 __ cmp(r3, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
4343 __ b(eq, &adaptor_frame); 4345 __ b(eq, &adaptor_frame);
4344 // default constructor has no arguments, so no adaptor frame means no args. 4346 // default constructor has no arguments, so no adaptor frame means no args.
4345 __ mov(r0, Operand::Zero()); 4347 __ mov(r0, Operand::Zero());
4346 __ b(&args_set_up); 4348 __ b(&args_set_up);
4347 4349
(...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after
5639 DCHECK(interrupt_address == 5641 DCHECK(interrupt_address ==
5640 isolate->builtins()->OsrAfterStackCheck()->entry()); 5642 isolate->builtins()->OsrAfterStackCheck()->entry());
5641 return OSR_AFTER_STACK_CHECK; 5643 return OSR_AFTER_STACK_CHECK;
5642 } 5644 }
5643 5645
5644 5646
5645 } // namespace internal 5647 } // namespace internal
5646 } // namespace v8 5648 } // namespace v8
5647 5649
5648 #endif // V8_TARGET_ARCH_ARM 5650 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/arm/interface-descriptors-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698