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_X64 | 7 #if V8_TARGET_ARCH_X64 |
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 4546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4557 ExternalReference debug_is_active = | 4557 ExternalReference debug_is_active = |
4558 ExternalReference::debug_is_active_address(isolate()); | 4558 ExternalReference::debug_is_active_address(isolate()); |
4559 __ Move(kScratchRegister, debug_is_active); | 4559 __ Move(kScratchRegister, debug_is_active); |
4560 __ movzxbp(rax, Operand(kScratchRegister, 0)); | 4560 __ movzxbp(rax, Operand(kScratchRegister, 0)); |
4561 __ Integer32ToSmi(rax, rax); | 4561 __ Integer32ToSmi(rax, rax); |
4562 context()->Plug(rax); | 4562 context()->Plug(rax); |
4563 } | 4563 } |
4564 | 4564 |
4565 | 4565 |
4566 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { | 4566 void FullCodeGenerator::VisitCallRuntime(CallRuntime* expr) { |
4567 InlineFunctionGenerator generator = FindInlineFunctionGenerator(expr); | |
4568 if (generator != nullptr) { | |
4569 Comment cmnt(masm_, "[ InlineRuntimeCall"); | |
4570 EmitInlineRuntimeCall(expr, generator); | |
4571 return; | |
4572 } | |
4573 | |
4574 Comment cmnt(masm_, "[ CallRuntime"); | |
4575 ZoneList<Expression*>* args = expr->arguments(); | 4567 ZoneList<Expression*>* args = expr->arguments(); |
4576 int arg_count = args->length(); | 4568 int arg_count = args->length(); |
4577 | 4569 |
4578 if (expr->is_jsruntime()) { | 4570 if (expr->is_jsruntime()) { |
| 4571 Comment cmnt(masm_, "[ CallRuntime"); |
4579 // Push the builtins object as receiver. | 4572 // Push the builtins object as receiver. |
4580 __ movp(rax, GlobalObjectOperand()); | 4573 __ movp(rax, GlobalObjectOperand()); |
4581 __ Push(FieldOperand(rax, GlobalObject::kBuiltinsOffset)); | 4574 __ Push(FieldOperand(rax, GlobalObject::kBuiltinsOffset)); |
4582 | 4575 |
4583 // Load the function from the receiver. | 4576 // Load the function from the receiver. |
4584 __ movp(LoadDescriptor::ReceiverRegister(), Operand(rsp, 0)); | 4577 __ movp(LoadDescriptor::ReceiverRegister(), Operand(rsp, 0)); |
4585 __ Move(LoadDescriptor::NameRegister(), expr->name()); | 4578 __ Move(LoadDescriptor::NameRegister(), expr->name()); |
4586 if (FLAG_vector_ics) { | 4579 if (FLAG_vector_ics) { |
4587 __ Move(VectorLoadICDescriptor::SlotRegister(), | 4580 __ Move(VectorLoadICDescriptor::SlotRegister(), |
4588 SmiFromSlot(expr->CallRuntimeFeedbackSlot())); | 4581 SmiFromSlot(expr->CallRuntimeFeedbackSlot())); |
(...skipping 15 matching lines...) Expand all Loading... |
4604 SetSourcePosition(expr->position()); | 4597 SetSourcePosition(expr->position()); |
4605 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); | 4598 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); |
4606 __ movp(rdi, Operand(rsp, (arg_count + 1) * kPointerSize)); | 4599 __ movp(rdi, Operand(rsp, (arg_count + 1) * kPointerSize)); |
4607 __ CallStub(&stub); | 4600 __ CallStub(&stub); |
4608 | 4601 |
4609 // Restore context register. | 4602 // Restore context register. |
4610 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); | 4603 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); |
4611 context()->DropAndPlug(1, rax); | 4604 context()->DropAndPlug(1, rax); |
4612 | 4605 |
4613 } else { | 4606 } else { |
4614 // Push the arguments ("left-to-right"). | 4607 const Runtime::Function* function = expr->function(); |
4615 for (int i = 0; i < arg_count; i++) { | 4608 switch (function->function_id) { |
4616 VisitForStackValue(args->at(i)); | 4609 #define CALL_INTRINSIC_GENERATOR(Name) \ |
| 4610 case Runtime::kInline##Name: { \ |
| 4611 Comment cmnt(masm_, "[ Inline" #Name); \ |
| 4612 return Emit##Name(expr); \ |
| 4613 } |
| 4614 FOR_EACH_FULL_CODE_INTRINSIC(CALL_INTRINSIC_GENERATOR) |
| 4615 #undef CALL_INTRINSIC_GENERATOR |
| 4616 default: { |
| 4617 Comment cmnt(masm_, "[ CallRuntime for unhandled intrinsic"); |
| 4618 // Push the arguments ("left-to-right"). |
| 4619 for (int i = 0; i < arg_count; i++) { |
| 4620 VisitForStackValue(args->at(i)); |
| 4621 } |
| 4622 |
| 4623 // Call the C runtime. |
| 4624 __ CallRuntime(function, arg_count); |
| 4625 context()->Plug(rax); |
| 4626 } |
4617 } | 4627 } |
4618 | |
4619 // Call the C runtime. | |
4620 __ CallRuntime(expr->function(), arg_count); | |
4621 context()->Plug(rax); | |
4622 } | 4628 } |
4623 } | 4629 } |
4624 | 4630 |
4625 | 4631 |
4626 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { | 4632 void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { |
4627 switch (expr->op()) { | 4633 switch (expr->op()) { |
4628 case Token::DELETE: { | 4634 case Token::DELETE: { |
4629 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); | 4635 Comment cmnt(masm_, "[ UnaryOperation (DELETE)"); |
4630 Property* property = expr->expression()->AsProperty(); | 4636 Property* property = expr->expression()->AsProperty(); |
4631 VariableProxy* proxy = expr->expression()->AsVariableProxy(); | 4637 VariableProxy* proxy = expr->expression()->AsVariableProxy(); |
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5406 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 5412 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
5407 Assembler::target_address_at(call_target_address, | 5413 Assembler::target_address_at(call_target_address, |
5408 unoptimized_code)); | 5414 unoptimized_code)); |
5409 return OSR_AFTER_STACK_CHECK; | 5415 return OSR_AFTER_STACK_CHECK; |
5410 } | 5416 } |
5411 | 5417 |
5412 | 5418 |
5413 } } // namespace v8::internal | 5419 } } // namespace v8::internal |
5414 | 5420 |
5415 #endif // V8_TARGET_ARCH_X64 | 5421 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |