OLD | NEW |
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 4605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4616 ExternalReference debug_is_active = | 4616 ExternalReference debug_is_active = |
4617 ExternalReference::debug_is_active_address(isolate()); | 4617 ExternalReference::debug_is_active_address(isolate()); |
4618 __ li(at, Operand(debug_is_active)); | 4618 __ li(at, Operand(debug_is_active)); |
4619 __ lb(v0, MemOperand(at)); | 4619 __ lb(v0, MemOperand(at)); |
4620 __ SmiTag(v0); | 4620 __ SmiTag(v0); |
4621 context()->Plug(v0); | 4621 context()->Plug(v0); |
4622 } | 4622 } |
4623 | 4623 |
4624 | 4624 |
4625 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { | 4625 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { |
4626 InlineFunctionGenerator generator = FindInlineFunctionGenerator(expr); | |
4627 if (generator != nullptr) { | |
4628 Comment cmnt(masm_, "[ InlineRuntimeCall"); | |
4629 EmitInlineRuntimeCall(expr, generator); | |
4630 return; | |
4631 } | |
4632 | |
4633 Comment cmnt(masm_, "[ CallRuntime"); | |
4634 ZoneList<Expression*>* args = expr->arguments(); | 4626 ZoneList<Expression*>* args = expr->arguments(); |
4635 int arg_count = args->length(); | 4627 int arg_count = args->length(); |
4636 | 4628 |
4637 if (expr->is_jsruntime()) { | 4629 if (expr->is_jsruntime()) { |
| 4630 Comment cmnt(masm_, "[ CallRuntime"); |
4638 // Push the builtins object as the receiver. | 4631 // Push the builtins object as the receiver. |
4639 Register receiver = LoadDescriptor::ReceiverRegister(); | 4632 Register receiver = LoadDescriptor::ReceiverRegister(); |
4640 __ lw(receiver, GlobalObjectOperand()); | 4633 __ lw(receiver, GlobalObjectOperand()); |
4641 __ lw(receiver, FieldMemOperand(receiver, GlobalObject::kBuiltinsOffset)); | 4634 __ lw(receiver, FieldMemOperand(receiver, GlobalObject::kBuiltinsOffset)); |
4642 __ push(receiver); | 4635 __ push(receiver); |
4643 | 4636 |
4644 // Load the function from the receiver. | 4637 // Load the function from the receiver. |
4645 __ li(LoadDescriptor::NameRegister(), Operand(expr->name())); | 4638 __ li(LoadDescriptor::NameRegister(), Operand(expr->name())); |
4646 if (FLAG_vector_ics) { | 4639 if (FLAG_vector_ics) { |
4647 __ li(VectorLoadICDescriptor::SlotRegister(), | 4640 __ li(VectorLoadICDescriptor::SlotRegister(), |
4648 Operand(SmiFromSlot(expr->CallRuntimeFeedbackSlot()))); | 4641 Operand(SmiFromSlot(expr->CallRuntimeFeedbackSlot()))); |
4649 CallLoadIC(NOT_CONTEXTUAL); | 4642 CallLoadIC(NOT_CONTEXTUAL); |
4650 } else { | 4643 } else { |
4651 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId()); | 4644 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId()); |
4652 } | 4645 } |
4653 | 4646 |
4654 // Push the target function under the receiver. | 4647 // Push the target function under the receiver. |
4655 __ lw(at, MemOperand(sp, 0)); | 4648 __ lw(at, MemOperand(sp, 0)); |
4656 __ push(at); | 4649 __ push(at); |
4657 __ sw(v0, MemOperand(sp, kPointerSize)); | 4650 __ sw(v0, MemOperand(sp, kPointerSize)); |
4658 | 4651 |
4659 // Push the arguments ("left-to-right"). | 4652 // Push the arguments ("left-to-right"). |
4660 int arg_count = args->length(); | |
4661 for (int i = 0; i < arg_count; i++) { | 4653 for (int i = 0; i < arg_count; i++) { |
4662 VisitForStackValue(args->at(i)); | 4654 VisitForStackValue(args->at(i)); |
4663 } | 4655 } |
4664 | 4656 |
4665 // Record source position of the IC call. | 4657 // Record source position of the IC call. |
4666 SetSourcePosition(expr->position()); | 4658 SetSourcePosition(expr->position()); |
4667 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); | 4659 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); |
4668 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 4660 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
4669 __ CallStub(&stub); | 4661 __ CallStub(&stub); |
4670 | 4662 |
4671 // Restore context register. | 4663 // Restore context register. |
4672 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 4664 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
4673 | 4665 |
4674 context()->DropAndPlug(1, v0); | 4666 context()->DropAndPlug(1, v0); |
| 4667 |
4675 } else { | 4668 } else { |
4676 // Push the arguments ("left-to-right"). | 4669 const Runtime::Function* function = expr->function(); |
4677 for (int i = 0; i < arg_count; i++) { | 4670 switch (function->function_id) { |
4678 VisitForStackValue(args->at(i)); | 4671 #define CALL_INTRINSIC_GENERATOR(Name) \ |
| 4672 case Runtime::kInline##Name: { \ |
| 4673 Comment cmnt(masm_, "[ Inline" #Name); \ |
| 4674 return Emit##Name(expr); \ |
| 4675 } |
| 4676 FOR_EACH_FULL_CODE_INTRINSIC(CALL_INTRINSIC_GENERATOR) |
| 4677 #undef CALL_INTRINSIC_GENERATOR |
| 4678 default: { |
| 4679 Comment cmnt(masm_, "[ CallRuntime for unhandled intrinsic"); |
| 4680 // Push the arguments ("left-to-right"). |
| 4681 for (int i = 0; i < arg_count; i++) { |
| 4682 VisitForStackValue(args->at(i)); |
| 4683 } |
| 4684 |
| 4685 // Call the C runtime function. |
| 4686 __ CallRuntime(expr->function(), arg_count); |
| 4687 context()->Plug(v0); |
| 4688 } |
4679 } | 4689 } |
4680 | |
4681 // Call the C runtime function. | |
4682 __ CallRuntime(expr->function(), arg_count); | |
4683 context()->Plug(v0); | |
4684 } | 4690 } |
4685 } | 4691 } |
4686 | 4692 |
4687 | 4693 |
4688 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { | 4694 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { |
4689 switch (expr->op()) { | 4695 switch (expr->op()) { |
4690 case Token::DELETE: { | 4696 case Token::DELETE: { |
4691 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); | 4697 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); |
4692 Property* property = expr->expression()->AsProperty(); | 4698 Property* property = expr->expression()->AsProperty(); |
4693 VariableProxy* proxy = expr->expression()->AsVariableProxy(); | 4699 VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5476 Assembler::target_address_at(pc_immediate_load_address)) == | 5482 Assembler::target_address_at(pc_immediate_load_address)) == |
5477 reinterpret_cast<uint32_t>( | 5483 reinterpret_cast<uint32_t>( |
5478 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5484 isolate->builtins()->OsrAfterStackCheck()->entry())); |
5479 return OSR_AFTER_STACK_CHECK; | 5485 return OSR_AFTER_STACK_CHECK; |
5480 } | 5486 } |
5481 | 5487 |
5482 | 5488 |
5483 } } // namespace v8::internal | 5489 } } // namespace v8::internal |
5484 | 5490 |
5485 #endif // V8_TARGET_ARCH_MIPS | 5491 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |