| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/compiler/interpreter-assembler.h" | 5 #include "src/compiler/interpreter-assembler.h" |
| 6 | 6 |
| 7 #include <ostream> | 7 #include <ostream> |
| 8 | 8 |
| 9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 | 577 |
| 578 Node** args = zone()->NewArray<Node*>(4); | 578 Node** args = zone()->NewArray<Node*>(4); |
| 579 args[0] = arg_count; | 579 args[0] = arg_count; |
| 580 args[1] = first_arg; | 580 args[1] = first_arg; |
| 581 args[2] = function_entry; | 581 args[2] = function_entry; |
| 582 args[3] = GetContext(); | 582 args[3] = GetContext(); |
| 583 | 583 |
| 584 return CallN(descriptor, code_target, args); | 584 return CallN(descriptor, code_target, args); |
| 585 } | 585 } |
| 586 | 586 |
| 587 Node* InterpreterAssembler::CallRuntime(Runtime::FunctionId function_id) { |
| 588 CallPrologue(); |
| 589 Node* return_val = raw_assembler_->CallRuntime0(function_id, GetContext()); |
| 590 return return_val; |
| 591 } |
| 587 | 592 |
| 588 Node* InterpreterAssembler::CallRuntime(Runtime::FunctionId function_id, | 593 Node* InterpreterAssembler::CallRuntime(Runtime::FunctionId function_id, |
| 589 Node* arg1) { | 594 Node* arg1) { |
| 590 CallPrologue(); | 595 CallPrologue(); |
| 591 Node* return_val = | 596 Node* return_val = |
| 592 raw_assembler_->CallRuntime1(function_id, arg1, GetContext()); | 597 raw_assembler_->CallRuntime1(function_id, arg1, GetContext()); |
| 593 return return_val; | 598 return return_val; |
| 594 } | 599 } |
| 595 | 600 |
| 596 | 601 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 695 STATIC_ASSERT(5 == Linkage::kInterpreterContextParameter); | 700 STATIC_ASSERT(5 == Linkage::kInterpreterContextParameter); |
| 696 Node* args[] = { GetAccumulator(), | 701 Node* args[] = { GetAccumulator(), |
| 697 RegisterFileRawPointer(), | 702 RegisterFileRawPointer(), |
| 698 new_bytecode_offset, | 703 new_bytecode_offset, |
| 699 BytecodeArrayTaggedPointer(), | 704 BytecodeArrayTaggedPointer(), |
| 700 DispatchTableRawPointer(), | 705 DispatchTableRawPointer(), |
| 701 GetContext() }; | 706 GetContext() }; |
| 702 raw_assembler_->TailCallN(call_descriptor(), target_code_object, args); | 707 raw_assembler_->TailCallN(call_descriptor(), target_code_object, args); |
| 703 } | 708 } |
| 704 | 709 |
| 710 void InterpreterAssembler::StackCheck() { |
| 711 RawMachineLabel ok, stack_guard; |
| 712 Node* sp = raw_assembler_->LoadStackPointer(); |
| 713 Node* stack_limit = raw_assembler_->Load( |
| 714 MachineType::Pointer(), |
| 715 raw_assembler_->ExternalConstant( |
| 716 ExternalReference::address_of_stack_limit(isolate()))); |
| 717 Node* condition = raw_assembler_->UintPtrGreaterThanOrEqual(sp, stack_limit); |
| 718 raw_assembler_->Branch(condition, &ok, &stack_guard); |
| 719 raw_assembler_->Bind(&stack_guard); |
| 720 CallRuntime(Runtime::kStackGuard); |
| 721 raw_assembler_->Goto(&ok); |
| 722 raw_assembler_->Bind(&ok); |
| 723 } |
| 705 | 724 |
| 706 void InterpreterAssembler::Abort(BailoutReason bailout_reason) { | 725 void InterpreterAssembler::Abort(BailoutReason bailout_reason) { |
| 707 Node* abort_id = SmiTag(Int32Constant(bailout_reason)); | 726 Node* abort_id = SmiTag(Int32Constant(bailout_reason)); |
| 708 Node* ret_value = CallRuntime(Runtime::kAbort, abort_id); | 727 Node* ret_value = CallRuntime(Runtime::kAbort, abort_id); |
| 709 // Unreached, but keeps turbofan happy. | 728 // Unreached, but keeps turbofan happy. |
| 710 raw_assembler_->Return(ret_value); | 729 raw_assembler_->Return(ret_value); |
| 711 } | 730 } |
| 712 | 731 |
| 713 | 732 |
| 714 void InterpreterAssembler::AbortIfWordNotEqual(Node* lhs, Node* rhs, | 733 void InterpreterAssembler::AbortIfWordNotEqual(Node* lhs, Node* rhs, |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 return raw_assembler_->call_descriptor(); | 770 return raw_assembler_->call_descriptor(); |
| 752 } | 771 } |
| 753 | 772 |
| 754 | 773 |
| 755 Zone* InterpreterAssembler::zone() { return raw_assembler_->zone(); } | 774 Zone* InterpreterAssembler::zone() { return raw_assembler_->zone(); } |
| 756 | 775 |
| 757 | 776 |
| 758 } // namespace compiler | 777 } // namespace compiler |
| 759 } // namespace internal | 778 } // namespace internal |
| 760 } // namespace v8 | 779 } // namespace v8 |
| OLD | NEW |