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

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

Issue 1073983004: MIPS port for implement spread calls (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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 | no next file » | 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 3071 matching lines...) Expand 10 before | Expand all | Expand 10 after
3082 } 3082 }
3083 3083
3084 3084
3085 void FullCodeGenerator::EmitLoadSuperConstructor() { 3085 void FullCodeGenerator::EmitLoadSuperConstructor() {
3086 __ lw(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 3086 __ lw(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
3087 __ Push(a0); 3087 __ Push(a0);
3088 __ CallRuntime(Runtime::kGetPrototype, 1); 3088 __ CallRuntime(Runtime::kGetPrototype, 1);
3089 } 3089 }
3090 3090
3091 3091
3092 void FullCodeGenerator::EmitInitializeThisAfterSuper(
3093 SuperReference* super_ref) {
3094 Variable* this_var = super_ref->this_var()->var();
3095 GetVar(a1, this_var);
3096 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
3097 Label uninitialized_this;
3098 __ Branch(&uninitialized_this, eq, a1, Operand(at));
3099 __ li(a0, Operand(this_var->name()));
3100 __ Push(a0);
3101 __ CallRuntime(Runtime::kThrowReferenceError, 1);
3102 __ bind(&uninitialized_this);
3103
3104 EmitVariableAssignment(this_var, Token::INIT_CONST);
3105 }
3106
3107
3092 void FullCodeGenerator::VisitCall(Call* expr) { 3108 void FullCodeGenerator::VisitCall(Call* expr) {
3093 #ifdef DEBUG 3109 #ifdef DEBUG
3094 // We want to verify that RecordJSReturnSite gets called on all paths 3110 // We want to verify that RecordJSReturnSite gets called on all paths
3095 // through this function. Avoid early returns. 3111 // through this function. Avoid early returns.
3096 expr->return_is_recorded_ = false; 3112 expr->return_is_recorded_ = false;
3097 #endif 3113 #endif
3098 3114
3099 Comment cmnt(masm_, "[ Call"); 3115 Comment cmnt(masm_, "[ Call");
3100 Expression* callee = expr->expression(); 3116 Expression* callee = expr->expression();
3101 Call::CallType call_type = expr->GetCallType(isolate()); 3117 Call::CallType call_type = expr->GetCallType(isolate());
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
3303 __ li(a2, FeedbackVector()); 3319 __ li(a2, FeedbackVector());
3304 __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackSlot()))); 3320 __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackSlot())));
3305 3321
3306 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET); 3322 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET);
3307 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); 3323 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
3308 3324
3309 __ Drop(1); 3325 __ Drop(1);
3310 3326
3311 RecordJSReturnSite(expr); 3327 RecordJSReturnSite(expr);
3312 3328
3313 SuperReference* super_ref = expr->expression()->AsSuperReference(); 3329 EmitInitializeThisAfterSuper(expr->expression()->AsSuperReference());
3314 Variable* this_var = super_ref->this_var()->var();
3315 GetVar(a1, this_var);
3316 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
3317 Label uninitialized_this;
3318 __ Branch(&uninitialized_this, eq, a1, Operand(at));
3319 __ li(a0, Operand(this_var->name()));
3320 __ Push(a0);
3321 __ CallRuntime(Runtime::kThrowReferenceError, 1);
3322 __ bind(&uninitialized_this);
3323
3324 EmitVariableAssignment(this_var, Token::INIT_CONST);
3325 context()->Plug(v0); 3330 context()->Plug(v0);
3326 } 3331 }
3327 3332
3328 3333
3329 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { 3334 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
3330 ZoneList<Expression*>* args = expr->arguments(); 3335 ZoneList<Expression*>* args = expr->arguments();
3331 DCHECK(args->length() == 1); 3336 DCHECK(args->length() == 1);
3332 3337
3333 VisitForAccumulatorValue(args->at(0)); 3338 VisitForAccumulatorValue(args->at(0));
3334 3339
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after
4604 DCHECK(expr->arguments()->length() == 0); 4609 DCHECK(expr->arguments()->length() == 0);
4605 ExternalReference debug_is_active = 4610 ExternalReference debug_is_active =
4606 ExternalReference::debug_is_active_address(isolate()); 4611 ExternalReference::debug_is_active_address(isolate());
4607 __ li(at, Operand(debug_is_active)); 4612 __ li(at, Operand(debug_is_active));
4608 __ lb(v0, MemOperand(at)); 4613 __ lb(v0, MemOperand(at));
4609 __ SmiTag(v0); 4614 __ SmiTag(v0);
4610 context()->Plug(v0); 4615 context()->Plug(v0);
4611 } 4616 }
4612 4617
4613 4618
4619 void FullCodeGenerator::EmitCallSuperWithSpread(CallRuntime* expr) {
4620 // Assert: expr == CallRuntime("ReflectConstruct")
4621 CallRuntime* call = expr->arguments()->at(0)->AsCallRuntime();
4622 ZoneList<Expression*>* args = call->arguments();
4623 DCHECK_EQ(3, args->length());
4624
4625 SuperReference* super_reference = args->at(0)->AsSuperReference();
4626
4627 // Load ReflectConstruct function
4628 EmitLoadJSRuntimeFunction(call);
4629
4630 // Push the target function under the receiver
4631 __ lw(at, MemOperand(sp, 0));
4632 __ push(at);
4633 __ sw(v0, MemOperand(sp, kPointerSize));
4634
4635 // Push super
4636 EmitLoadSuperConstructor();
4637 __ Push(result_register());
4638
4639 // Push arguments array
4640 VisitForStackValue(args->at(1));
4641
4642 // Push NewTarget
4643 DCHECK(args->at(2)->IsVariableProxy());
4644 VisitForStackValue(args->at(2));
4645
4646 EmitCallJSRuntimeFunction(call);
4647
4648 // Restore context register.
4649 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
4650 context()->DropAndPlug(1, v0);
4651
4652 EmitInitializeThisAfterSuper(super_reference);
4653 }
4654
4655
4656 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) {
4657 // Push the builtins object as the receiver.
4658 Register receiver = LoadDescriptor::ReceiverRegister();
4659 __ lw(receiver, GlobalObjectOperand());
4660 __ lw(receiver, FieldMemOperand(receiver, GlobalObject::kBuiltinsOffset));
4661 __ push(receiver);
4662
4663 // Load the function from the receiver.
4664 __ li(LoadDescriptor::NameRegister(), Operand(expr->name()));
4665 if (FLAG_vector_ics) {
4666 __ li(VectorLoadICDescriptor::SlotRegister(),
4667 Operand(SmiFromSlot(expr->CallRuntimeFeedbackSlot())));
4668 CallLoadIC(NOT_CONTEXTUAL);
4669 } else {
4670 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId());
4671 }
4672 }
4673
4674
4675 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) {
4676 ZoneList<Expression*>* args = expr->arguments();
4677 int arg_count = args->length();
4678
4679 // Record source position of the IC call.
4680 SetSourcePosition(expr->position());
4681 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS);
4682 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize));
4683 __ CallStub(&stub);
4684 }
4685
4686
4614 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { 4687 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
4615 ZoneList<Expression*>* args = expr->arguments(); 4688 ZoneList<Expression*>* args = expr->arguments();
4616 int arg_count = args->length(); 4689 int arg_count = args->length();
4617 4690
4618 if (expr->is_jsruntime()) { 4691 if (expr->is_jsruntime()) {
4619 Comment cmnt(masm_, "[ CallRuntime"); 4692 Comment cmnt(masm_, "[ CallRuntime");
4620 // Push the builtins object as the receiver. 4693 EmitLoadJSRuntimeFunction(expr);
4621 Register receiver = LoadDescriptor::ReceiverRegister();
4622 __ lw(receiver, GlobalObjectOperand());
4623 __ lw(receiver, FieldMemOperand(receiver, GlobalObject::kBuiltinsOffset));
4624 __ push(receiver);
4625
4626 // Load the function from the receiver.
4627 __ li(LoadDescriptor::NameRegister(), Operand(expr->name()));
4628 if (FLAG_vector_ics) {
4629 __ li(VectorLoadICDescriptor::SlotRegister(),
4630 Operand(SmiFromSlot(expr->CallRuntimeFeedbackSlot())));
4631 CallLoadIC(NOT_CONTEXTUAL);
4632 } else {
4633 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId());
4634 }
4635 4694
4636 // Push the target function under the receiver. 4695 // Push the target function under the receiver.
4637 __ lw(at, MemOperand(sp, 0)); 4696 __ lw(at, MemOperand(sp, 0));
4638 __ push(at); 4697 __ push(at);
4639 __ sw(v0, MemOperand(sp, kPointerSize)); 4698 __ sw(v0, MemOperand(sp, kPointerSize));
4640 4699
4641 // Push the arguments ("left-to-right"). 4700 // Push the arguments ("left-to-right").
4642 for (int i = 0; i < arg_count; i++) { 4701 for (int i = 0; i < arg_count; i++) {
4643 VisitForStackValue(args->at(i)); 4702 VisitForStackValue(args->at(i));
4644 } 4703 }
4645 4704
4646 // Record source position of the IC call. 4705 EmitCallJSRuntimeFunction(expr);
4647 SetSourcePosition(expr->position());
4648 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS);
4649 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize));
4650 __ CallStub(&stub);
4651 4706
4652 // Restore context register. 4707 // Restore context register.
4653 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 4708 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
4654 4709
4655 context()->DropAndPlug(1, v0); 4710 context()->DropAndPlug(1, v0);
4656 4711
4657 } else { 4712 } else {
4658 const Runtime::Function* function = expr->function(); 4713 const Runtime::Function* function = expr->function();
4659 switch (function->function_id) { 4714 switch (function->function_id) {
4660 #define CALL_INTRINSIC_GENERATOR(Name) \ 4715 #define CALL_INTRINSIC_GENERATOR(Name) \
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
5417 Assembler::target_address_at(pc_immediate_load_address)) == 5472 Assembler::target_address_at(pc_immediate_load_address)) ==
5418 reinterpret_cast<uint32_t>( 5473 reinterpret_cast<uint32_t>(
5419 isolate->builtins()->OsrAfterStackCheck()->entry())); 5474 isolate->builtins()->OsrAfterStackCheck()->entry()));
5420 return OSR_AFTER_STACK_CHECK; 5475 return OSR_AFTER_STACK_CHECK;
5421 } 5476 }
5422 5477
5423 5478
5424 } } // namespace v8::internal 5479 } } // namespace v8::internal
5425 5480
5426 #endif // V8_TARGET_ARCH_MIPS 5481 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698