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_ARM | 7 #if V8_TARGET_ARCH_ARM |
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 4597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4608 ExternalReference debug_is_active = | 4608 ExternalReference debug_is_active = |
4609 ExternalReference::debug_is_active_address(isolate()); | 4609 ExternalReference::debug_is_active_address(isolate()); |
4610 __ mov(ip, Operand(debug_is_active)); | 4610 __ mov(ip, Operand(debug_is_active)); |
4611 __ ldrb(r0, MemOperand(ip)); | 4611 __ ldrb(r0, MemOperand(ip)); |
4612 __ SmiTag(r0); | 4612 __ SmiTag(r0); |
4613 context()->Plug(r0); | 4613 context()->Plug(r0); |
4614 } | 4614 } |
4615 | 4615 |
4616 | 4616 |
4617 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { | 4617 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { |
4618 InlineFunctionGenerator generator = FindInlineFunctionGenerator(expr); | |
4619 if (generator != nullptr) { | |
4620 Comment cmnt(masm_, "[ InlineRuntimeCall"); | |
4621 EmitInlineRuntimeCall(expr, generator); | |
4622 return; | |
4623 } | |
4624 | |
4625 Comment cmnt(masm_, "[ CallRuntime"); | |
4626 ZoneList<Expression*>* args = expr->arguments(); | 4618 ZoneList<Expression*>* args = expr->arguments(); |
4627 int arg_count = args->length(); | 4619 int arg_count = args->length(); |
4628 | 4620 |
4629 if (expr->is_jsruntime()) { | 4621 if (expr->is_jsruntime()) { |
| 4622 Comment cmnt(masm_, "[ CallRuntime"); |
4630 // Push the builtins object as the receiver. | 4623 // Push the builtins object as the receiver. |
4631 Register receiver = LoadDescriptor::ReceiverRegister(); | 4624 Register receiver = LoadDescriptor::ReceiverRegister(); |
4632 __ ldr(receiver, GlobalObjectOperand()); | 4625 __ ldr(receiver, GlobalObjectOperand()); |
4633 __ ldr(receiver, FieldMemOperand(receiver, GlobalObject::kBuiltinsOffset)); | 4626 __ ldr(receiver, FieldMemOperand(receiver, GlobalObject::kBuiltinsOffset)); |
4634 __ push(receiver); | 4627 __ push(receiver); |
4635 | 4628 |
4636 // Load the function from the receiver. | 4629 // Load the function from the receiver. |
4637 __ mov(LoadDescriptor::NameRegister(), Operand(expr->name())); | 4630 __ mov(LoadDescriptor::NameRegister(), Operand(expr->name())); |
4638 if (FLAG_vector_ics) { | 4631 if (FLAG_vector_ics) { |
4639 __ mov(VectorLoadICDescriptor::SlotRegister(), | 4632 __ mov(VectorLoadICDescriptor::SlotRegister(), |
4640 Operand(SmiFromSlot(expr->CallRuntimeFeedbackSlot()))); | 4633 Operand(SmiFromSlot(expr->CallRuntimeFeedbackSlot()))); |
4641 CallLoadIC(NOT_CONTEXTUAL); | 4634 CallLoadIC(NOT_CONTEXTUAL); |
4642 } else { | 4635 } else { |
4643 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId()); | 4636 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId()); |
4644 } | 4637 } |
4645 | 4638 |
4646 // Push the target function under the receiver. | 4639 // Push the target function under the receiver. |
4647 __ ldr(ip, MemOperand(sp, 0)); | 4640 __ ldr(ip, MemOperand(sp, 0)); |
4648 __ push(ip); | 4641 __ push(ip); |
4649 __ str(r0, MemOperand(sp, kPointerSize)); | 4642 __ str(r0, MemOperand(sp, kPointerSize)); |
4650 | 4643 |
4651 // Push the arguments ("left-to-right"). | 4644 // Push the arguments ("left-to-right"). |
4652 int arg_count = args->length(); | |
4653 for (int i = 0; i < arg_count; i++) { | 4645 for (int i = 0; i < arg_count; i++) { |
4654 VisitForStackValue(args->at(i)); | 4646 VisitForStackValue(args->at(i)); |
4655 } | 4647 } |
4656 | 4648 |
4657 // Record source position of the IC call. | 4649 // Record source position of the IC call. |
4658 SetSourcePosition(expr->position()); | 4650 SetSourcePosition(expr->position()); |
4659 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); | 4651 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); |
4660 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); | 4652 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
4661 __ CallStub(&stub); | 4653 __ CallStub(&stub); |
4662 | 4654 |
4663 // Restore context register. | 4655 // Restore context register. |
4664 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 4656 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
4665 | 4657 |
4666 context()->DropAndPlug(1, r0); | 4658 context()->DropAndPlug(1, r0); |
| 4659 |
4667 } else { | 4660 } else { |
4668 // Push the arguments ("left-to-right"). | 4661 const Runtime::Function* function = expr->function(); |
4669 for (int i = 0; i < arg_count; i++) { | 4662 switch (function->function_id) { |
4670 VisitForStackValue(args->at(i)); | 4663 #define CALL_INTRINSIC_GENERATOR(Name) \ |
| 4664 case Runtime::kInline##Name: { \ |
| 4665 Comment cmnt(masm_, "[ Inline" #Name); \ |
| 4666 return Emit##Name(expr); \ |
| 4667 } |
| 4668 FOR_EACH_FULL_CODE_INTRINSIC(CALL_INTRINSIC_GENERATOR) |
| 4669 #undef CALL_INTRINSIC_GENERATOR |
| 4670 default: { |
| 4671 Comment cmnt(masm_, "[ CallRuntime for unhandled intrinsic"); |
| 4672 // Push the arguments ("left-to-right"). |
| 4673 for (int i = 0; i < arg_count; i++) { |
| 4674 VisitForStackValue(args->at(i)); |
| 4675 } |
| 4676 |
| 4677 // Call the C runtime function. |
| 4678 __ CallRuntime(expr->function(), arg_count); |
| 4679 context()->Plug(r0); |
| 4680 } |
4671 } | 4681 } |
4672 | |
4673 // Call the C runtime function. | |
4674 __ CallRuntime(expr->function(), arg_count); | |
4675 context()->Plug(r0); | |
4676 } | 4682 } |
4677 } | 4683 } |
4678 | 4684 |
4679 | 4685 |
4680 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { | 4686 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { |
4681 switch (expr->op()) { | 4687 switch (expr->op()) { |
4682 case Token::DELETE: { | 4688 case Token::DELETE: { |
4683 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); | 4689 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); |
4684 Property* property = expr->expression()->AsProperty(); | 4690 Property* property = expr->expression()->AsProperty(); |
4685 VariableProxy* proxy = expr->expression()->AsVariableProxy(); | 4691 VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5522 | 5528 |
5523 DCHECK(interrupt_address == | 5529 DCHECK(interrupt_address == |
5524 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5530 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5525 return OSR_AFTER_STACK_CHECK; | 5531 return OSR_AFTER_STACK_CHECK; |
5526 } | 5532 } |
5527 | 5533 |
5528 | 5534 |
5529 } } // namespace v8::internal | 5535 } } // namespace v8::internal |
5530 | 5536 |
5531 #endif // V8_TARGET_ARCH_ARM | 5537 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |