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/mips/full-codegen-mips.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/mips/code-stubs-mips.cc ('k') | src/mips/interface-descriptors-mips.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_MIPS 7 #if V8_TARGET_ARCH_MIPS
8 8
9 // Note on Mips implementation: 9 // Note on Mips implementation:
10 // 10 //
(...skipping 3350 matching lines...) Expand 10 before | Expand all | Expand 10 after
3361 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); 3361 PrepareForBailoutForId(expr->ReturnId(), TOS_REG);
3362 context()->Plug(v0); 3362 context()->Plug(v0);
3363 } 3363 }
3364 3364
3365 3365
3366 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { 3366 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) {
3367 SuperCallReference* super_call_ref = 3367 SuperCallReference* super_call_ref =
3368 expr->expression()->AsSuperCallReference(); 3368 expr->expression()->AsSuperCallReference();
3369 DCHECK_NOT_NULL(super_call_ref); 3369 DCHECK_NOT_NULL(super_call_ref);
3370 3370
3371 VariableProxy* new_target_proxy = super_call_ref->new_target_var();
3372 VisitForStackValue(new_target_proxy);
3373
3374 EmitLoadSuperConstructor(super_call_ref); 3371 EmitLoadSuperConstructor(super_call_ref);
3375 __ push(result_register()); 3372 __ push(result_register());
3376 3373
3377 // Push the arguments ("left-to-right") on the stack. 3374 // Push the arguments ("left-to-right") on the stack.
3378 ZoneList<Expression*>* args = expr->arguments(); 3375 ZoneList<Expression*>* args = expr->arguments();
3379 int arg_count = args->length(); 3376 int arg_count = args->length();
3380 for (int i = 0; i < arg_count; i++) { 3377 for (int i = 0; i < arg_count; i++) {
3381 VisitForStackValue(args->at(i)); 3378 VisitForStackValue(args->at(i));
3382 } 3379 }
3383 3380
3384 // Call the construct call builtin that handles allocation and 3381 // Call the construct call builtin that handles allocation and
3385 // constructor invocation. 3382 // constructor invocation.
3386 SetConstructCallPosition(expr); 3383 SetConstructCallPosition(expr);
3387 3384
3385 // Load original constructor into t0.
3386 VisitForAccumulatorValue(super_call_ref->new_target_var());
3387 __ mov(t0, result_register());
3388
3388 // Load function and argument count into a1 and a0. 3389 // Load function and argument count into a1 and a0.
3389 __ li(a0, Operand(arg_count)); 3390 __ li(a0, Operand(arg_count));
3390 __ lw(a1, MemOperand(sp, arg_count * kPointerSize)); 3391 __ lw(a1, MemOperand(sp, arg_count * kPointerSize));
3391 3392
3392 // Record call targets in unoptimized code. 3393 // Record call targets in unoptimized code.
3393 if (FLAG_pretenuring_call_new) { 3394 if (FLAG_pretenuring_call_new) {
3394 UNREACHABLE(); 3395 UNREACHABLE();
3395 /* TODO(dslomov): support pretenuring. 3396 /* TODO(dslomov): support pretenuring.
3396 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot()); 3397 EnsureSlotContainsAllocationSite(expr->AllocationSiteFeedbackSlot());
3397 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() == 3398 DCHECK(expr->AllocationSiteFeedbackSlot().ToInt() ==
3398 expr->CallNewFeedbackSlot().ToInt() + 1); 3399 expr->CallNewFeedbackSlot().ToInt() + 1);
3399 */ 3400 */
3400 } 3401 }
3401 3402
3402 __ li(a2, FeedbackVector()); 3403 __ li(a2, FeedbackVector());
3403 __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackSlot()))); 3404 __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackSlot())));
3404 3405
3405 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET); 3406 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET);
3406 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); 3407 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
3407 3408
3408 __ Drop(1);
3409
3410 RecordJSReturnSite(expr); 3409 RecordJSReturnSite(expr);
3411 3410
3412 EmitInitializeThisAfterSuper(super_call_ref, expr->CallFeedbackICSlot()); 3411 EmitInitializeThisAfterSuper(super_call_ref, expr->CallFeedbackICSlot());
3413 context()->Plug(v0); 3412 context()->Plug(v0);
3414 } 3413 }
3415 3414
3416 3415
3417 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { 3416 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
3418 ZoneList<Expression*>* args = expr->arguments(); 3417 ZoneList<Expression*>* args = expr->arguments();
3419 DCHECK(args->length() == 1); 3418 DCHECK(args->length() == 1);
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
4335 DCHECK(args->length() == 2); 4334 DCHECK(args->length() == 2);
4336 4335
4337 // new.target 4336 // new.target
4338 VisitForStackValue(args->at(0)); 4337 VisitForStackValue(args->at(0));
4339 4338
4340 // .this_function 4339 // .this_function
4341 VisitForStackValue(args->at(1)); 4340 VisitForStackValue(args->at(1));
4342 __ CallRuntime(Runtime::kGetPrototype, 1); 4341 __ CallRuntime(Runtime::kGetPrototype, 1);
4343 __ Push(result_register()); 4342 __ Push(result_register());
4344 4343
4344 // Load original constructor into t0.
4345 __ lw(t0, MemOperand(sp, 1 * kPointerSize));
4346
4345 // Check if the calling frame is an arguments adaptor frame. 4347 // Check if the calling frame is an arguments adaptor frame.
4346 Label adaptor_frame, args_set_up, runtime; 4348 Label adaptor_frame, args_set_up, runtime;
4347 __ lw(a2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); 4349 __ lw(a2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
4348 __ lw(a3, MemOperand(a2, StandardFrameConstants::kContextOffset)); 4350 __ lw(a3, MemOperand(a2, StandardFrameConstants::kContextOffset));
4349 __ Branch(&adaptor_frame, eq, a3, 4351 __ Branch(&adaptor_frame, eq, a3,
4350 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); 4352 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
4351 // default constructor has no arguments, so no adaptor frame means no args. 4353 // default constructor has no arguments, so no adaptor frame means no args.
4352 __ mov(a0, zero_reg); 4354 __ mov(a0, zero_reg);
4353 __ Branch(&args_set_up); 4355 __ Branch(&args_set_up);
4354 4356
(...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after
5596 reinterpret_cast<uint32_t>( 5598 reinterpret_cast<uint32_t>(
5597 isolate->builtins()->OsrAfterStackCheck()->entry())); 5599 isolate->builtins()->OsrAfterStackCheck()->entry()));
5598 return OSR_AFTER_STACK_CHECK; 5600 return OSR_AFTER_STACK_CHECK;
5599 } 5601 }
5600 5602
5601 5603
5602 } // namespace internal 5604 } // namespace internal
5603 } // namespace v8 5605 } // namespace v8
5604 5606
5605 #endif // V8_TARGET_ARCH_MIPS 5607 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | src/mips/interface-descriptors-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698