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

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

Issue 1078253004: PPC: [es6] 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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_PPC 7 #if V8_TARGET_ARCH_PPC
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 3077 matching lines...) Expand 10 before | Expand all | Expand 10 after
3088 } 3088 }
3089 3089
3090 3090
3091 void FullCodeGenerator::EmitLoadSuperConstructor() { 3091 void FullCodeGenerator::EmitLoadSuperConstructor() {
3092 __ LoadP(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 3092 __ LoadP(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
3093 __ Push(r3); 3093 __ Push(r3);
3094 __ CallRuntime(Runtime::kGetPrototype, 1); 3094 __ CallRuntime(Runtime::kGetPrototype, 1);
3095 } 3095 }
3096 3096
3097 3097
3098 void FullCodeGenerator::EmitInitializeThisAfterSuper(
3099 SuperReference* super_ref) {
3100 Variable* this_var = super_ref->this_var()->var();
3101 GetVar(r4, this_var);
3102 __ CompareRoot(r4, Heap::kTheHoleValueRootIndex);
3103 Label uninitialized_this;
3104 __ beq(&uninitialized_this);
3105 __ mov(r4, Operand(this_var->name()));
3106 __ push(r4);
3107 __ CallRuntime(Runtime::kThrowReferenceError, 1);
3108 __ bind(&uninitialized_this);
3109
3110 EmitVariableAssignment(this_var, Token::INIT_CONST);
3111 }
3112
3113
3098 void FullCodeGenerator::VisitCall(Call* expr) { 3114 void FullCodeGenerator::VisitCall(Call* expr) {
3099 #ifdef DEBUG 3115 #ifdef DEBUG
3100 // We want to verify that RecordJSReturnSite gets called on all paths 3116 // We want to verify that RecordJSReturnSite gets called on all paths
3101 // through this function. Avoid early returns. 3117 // through this function. Avoid early returns.
3102 expr->return_is_recorded_ = false; 3118 expr->return_is_recorded_ = false;
3103 #endif 3119 #endif
3104 3120
3105 Comment cmnt(masm_, "[ Call"); 3121 Comment cmnt(masm_, "[ Call");
3106 Expression* callee = expr->expression(); 3122 Expression* callee = expr->expression();
3107 Call::CallType call_type = expr->GetCallType(isolate()); 3123 Call::CallType call_type = expr->GetCallType(isolate());
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
3314 __ Move(r5, FeedbackVector()); 3330 __ Move(r5, FeedbackVector());
3315 __ LoadSmiLiteral(r6, SmiFromSlot(expr->CallFeedbackSlot())); 3331 __ LoadSmiLiteral(r6, SmiFromSlot(expr->CallFeedbackSlot()));
3316 3332
3317 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET); 3333 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET);
3318 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); 3334 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
3319 3335
3320 __ Drop(1); 3336 __ Drop(1);
3321 3337
3322 RecordJSReturnSite(expr); 3338 RecordJSReturnSite(expr);
3323 3339
3324 SuperReference* super_ref = expr->expression()->AsSuperReference(); 3340 EmitInitializeThisAfterSuper(expr->expression()->AsSuperReference());
3325 Variable* this_var = super_ref->this_var()->var();
3326 GetVar(r4, this_var);
3327 __ CompareRoot(r4, Heap::kTheHoleValueRootIndex);
3328 Label uninitialized_this;
3329 __ beq(&uninitialized_this);
3330 __ mov(r4, Operand(this_var->name()));
3331 __ push(r4);
3332 __ CallRuntime(Runtime::kThrowReferenceError, 1);
3333 __ bind(&uninitialized_this);
3334
3335 EmitVariableAssignment(this_var, Token::INIT_CONST);
3336 context()->Plug(r3); 3341 context()->Plug(r3);
3337 } 3342 }
3338 3343
3339 3344
3340 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { 3345 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
3341 ZoneList<Expression*>* args = expr->arguments(); 3346 ZoneList<Expression*>* args = expr->arguments();
3342 DCHECK(args->length() == 1); 3347 DCHECK(args->length() == 1);
3343 3348
3344 VisitForAccumulatorValue(args->at(0)); 3349 VisitForAccumulatorValue(args->at(0));
3345 3350
(...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after
4611 DCHECK(expr->arguments()->length() == 0); 4616 DCHECK(expr->arguments()->length() == 0);
4612 ExternalReference debug_is_active = 4617 ExternalReference debug_is_active =
4613 ExternalReference::debug_is_active_address(isolate()); 4618 ExternalReference::debug_is_active_address(isolate());
4614 __ mov(ip, Operand(debug_is_active)); 4619 __ mov(ip, Operand(debug_is_active));
4615 __ lbz(r3, MemOperand(ip)); 4620 __ lbz(r3, MemOperand(ip));
4616 __ SmiTag(r3); 4621 __ SmiTag(r3);
4617 context()->Plug(r3); 4622 context()->Plug(r3);
4618 } 4623 }
4619 4624
4620 4625
4626 void FullCodeGenerator::EmitCallSuperWithSpread(CallRuntime* expr) {
4627 // Assert: expr === CallRuntime("ReflectConstruct")
4628 CallRuntime* call = expr->arguments()->at(0)->AsCallRuntime();
4629 ZoneList<Expression*>* args = call->arguments();
4630 DCHECK_EQ(3, args->length());
4631
4632 SuperReference* super_reference = args->at(0)->AsSuperReference();
4633
4634 // Load ReflectConstruct function
4635 EmitLoadJSRuntimeFunction(call);
4636
4637 // Push the target function under the receiver.
4638 __ LoadP(r0, MemOperand(sp, 0));
4639 __ push(r0);
4640 __ StoreP(r3, MemOperand(sp, kPointerSize));
4641
4642 // Push super
4643 EmitLoadSuperConstructor();
4644 __ Push(result_register());
4645
4646 // Push arguments array
4647 VisitForStackValue(args->at(1));
4648
4649 // Push NewTarget
4650 DCHECK(args->at(2)->IsVariableProxy());
4651 VisitForStackValue(args->at(2));
4652
4653 EmitCallJSRuntimeFunction(call);
4654
4655 // Restore context register.
4656 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
4657 context()->DropAndPlug(1, r3);
4658
4659 EmitInitializeThisAfterSuper(super_reference);
4660 }
4661
4662
4663 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) {
4664 // Push the builtins object as the receiver.
4665 Register receiver = LoadDescriptor::ReceiverRegister();
4666 __ LoadP(receiver, GlobalObjectOperand());
4667 __ LoadP(receiver, FieldMemOperand(receiver, GlobalObject::kBuiltinsOffset));
4668 __ push(receiver);
4669
4670 // Load the function from the receiver.
4671 __ mov(LoadDescriptor::NameRegister(), Operand(expr->name()));
4672 if (FLAG_vector_ics) {
4673 __ mov(VectorLoadICDescriptor::SlotRegister(),
4674 Operand(SmiFromSlot(expr->CallRuntimeFeedbackSlot())));
4675 CallLoadIC(NOT_CONTEXTUAL);
4676 } else {
4677 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId());
4678 }
4679 }
4680
4681
4682 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) {
4683 ZoneList<Expression*>* args = expr->arguments();
4684 int arg_count = args->length();
4685
4686 // Record source position of the IC call.
4687 SetSourcePosition(expr->position());
4688 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS);
4689 __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0);
4690 __ CallStub(&stub);
4691 }
4692
4693
4621 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { 4694 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) {
4622 ZoneList<Expression*>* args = expr->arguments(); 4695 ZoneList<Expression*>* args = expr->arguments();
4623 int arg_count = args->length(); 4696 int arg_count = args->length();
4624 4697
4625 if (expr->is_jsruntime()) { 4698 if (expr->is_jsruntime()) {
4626 Comment cmnt(masm_, "[ CallRuntime"); 4699 Comment cmnt(masm_, "[ CallRuntime");
4627 // Push the builtins object as the receiver. 4700 EmitLoadJSRuntimeFunction(expr);
4628 Register receiver = LoadDescriptor::ReceiverRegister();
4629 __ LoadP(receiver, GlobalObjectOperand());
4630 __ LoadP(receiver,
4631 FieldMemOperand(receiver, GlobalObject::kBuiltinsOffset));
4632 __ push(receiver);
4633
4634 // Load the function from the receiver.
4635 __ mov(LoadDescriptor::NameRegister(), Operand(expr->name()));
4636 if (FLAG_vector_ics) {
4637 __ mov(VectorLoadICDescriptor::SlotRegister(),
4638 Operand(SmiFromSlot(expr->CallRuntimeFeedbackSlot())));
4639 CallLoadIC(NOT_CONTEXTUAL);
4640 } else {
4641 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId());
4642 }
4643 4701
4644 // Push the target function under the receiver. 4702 // Push the target function under the receiver.
4645 __ LoadP(ip, MemOperand(sp, 0)); 4703 __ LoadP(ip, MemOperand(sp, 0));
4646 __ push(ip); 4704 __ push(ip);
4647 __ StoreP(r3, MemOperand(sp, kPointerSize)); 4705 __ StoreP(r3, MemOperand(sp, kPointerSize));
4648 4706
4649 // Push the arguments ("left-to-right"). 4707 // Push the arguments ("left-to-right").
4650 for (int i = 0; i < arg_count; i++) { 4708 for (int i = 0; i < arg_count; i++) {
4651 VisitForStackValue(args->at(i)); 4709 VisitForStackValue(args->at(i));
4652 } 4710 }
4653 4711
4654 // Record source position of the IC call. 4712 EmitCallJSRuntimeFunction(expr);
4655 SetSourcePosition(expr->position());
4656 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS);
4657 __ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0);
4658 __ CallStub(&stub);
4659 4713
4660 // Restore context register. 4714 // Restore context register.
4661 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 4715 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
4662 4716
4663 context()->DropAndPlug(1, r3); 4717 context()->DropAndPlug(1, r3);
4664 4718
4665 } else { 4719 } else {
4666 const Runtime::Function* function = expr->function(); 4720 const Runtime::Function* function = expr->function();
4667 switch (function->function_id) { 4721 switch (function->function_id) {
4668 #define CALL_INTRINSIC_GENERATOR(Name) \ 4722 #define CALL_INTRINSIC_GENERATOR(Name) \
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after
5418 return ON_STACK_REPLACEMENT; 5472 return ON_STACK_REPLACEMENT;
5419 } 5473 }
5420 5474
5421 DCHECK(interrupt_address == 5475 DCHECK(interrupt_address ==
5422 isolate->builtins()->OsrAfterStackCheck()->entry()); 5476 isolate->builtins()->OsrAfterStackCheck()->entry());
5423 return OSR_AFTER_STACK_CHECK; 5477 return OSR_AFTER_STACK_CHECK;
5424 } 5478 }
5425 } 5479 }
5426 } // namespace v8::internal 5480 } // namespace v8::internal
5427 #endif // V8_TARGET_ARCH_PPC 5481 #endif // V8_TARGET_ARCH_PPC
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