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