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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 } | 141 } |
142 | 142 |
143 | 143 |
144 Node* InterpreterAssembler::StoreRegister(Node* value, Node* reg_index) { | 144 Node* InterpreterAssembler::StoreRegister(Node* value, Node* reg_index) { |
145 return raw_assembler_->Store( | 145 return raw_assembler_->Store( |
146 MachineRepresentation::kTagged, RegisterFileRawPointer(), | 146 MachineRepresentation::kTagged, RegisterFileRawPointer(), |
147 RegisterFrameOffset(reg_index), value, kNoWriteBarrier); | 147 RegisterFrameOffset(reg_index), value, kNoWriteBarrier); |
148 } | 148 } |
149 | 149 |
150 | 150 |
| 151 Node* InterpreterAssembler::NextRegister(Node* reg_index) { |
| 152 // Register indexes are negative, so the next index is minus one. |
| 153 return IntPtrAdd(reg_index, Int32Constant(-1)); |
| 154 } |
| 155 |
| 156 |
151 Node* InterpreterAssembler::BytecodeOperand(int operand_index) { | 157 Node* InterpreterAssembler::BytecodeOperand(int operand_index) { |
152 DCHECK_LT(operand_index, interpreter::Bytecodes::NumberOfOperands(bytecode_)); | 158 DCHECK_LT(operand_index, interpreter::Bytecodes::NumberOfOperands(bytecode_)); |
153 DCHECK_EQ(interpreter::OperandSize::kByte, | 159 DCHECK_EQ(interpreter::OperandSize::kByte, |
154 interpreter::Bytecodes::GetOperandSize(bytecode_, operand_index)); | 160 interpreter::Bytecodes::GetOperandSize(bytecode_, operand_index)); |
155 return raw_assembler_->Load( | 161 return raw_assembler_->Load( |
156 MachineType::Uint8(), BytecodeArrayTaggedPointer(), | 162 MachineType::Uint8(), BytecodeArrayTaggedPointer(), |
157 IntPtrAdd(BytecodeOffset(), | 163 IntPtrAdd(BytecodeOffset(), |
158 Int32Constant(interpreter::Bytecodes::GetOperandOffset( | 164 Int32Constant(interpreter::Bytecodes::GetOperandOffset( |
159 bytecode_, operand_index)))); | 165 bytecode_, operand_index)))); |
160 } | 166 } |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 default: | 296 default: |
291 UNREACHABLE(); | 297 UNREACHABLE(); |
292 return nullptr; | 298 return nullptr; |
293 } | 299 } |
294 } | 300 } |
295 | 301 |
296 | 302 |
297 Node* InterpreterAssembler::BytecodeOperandReg(int operand_index) { | 303 Node* InterpreterAssembler::BytecodeOperandReg(int operand_index) { |
298 switch (interpreter::Bytecodes::GetOperandType(bytecode_, operand_index)) { | 304 switch (interpreter::Bytecodes::GetOperandType(bytecode_, operand_index)) { |
299 case interpreter::OperandType::kReg8: | 305 case interpreter::OperandType::kReg8: |
| 306 case interpreter::OperandType::kRegPair8: |
300 case interpreter::OperandType::kMaybeReg8: | 307 case interpreter::OperandType::kMaybeReg8: |
301 DCHECK_EQ( | 308 DCHECK_EQ( |
302 interpreter::OperandSize::kByte, | 309 interpreter::OperandSize::kByte, |
303 interpreter::Bytecodes::GetOperandSize(bytecode_, operand_index)); | 310 interpreter::Bytecodes::GetOperandSize(bytecode_, operand_index)); |
304 return BytecodeOperandSignExtended(operand_index); | 311 return BytecodeOperandSignExtended(operand_index); |
305 case interpreter::OperandType::kReg16: | 312 case interpreter::OperandType::kReg16: |
306 DCHECK_EQ( | 313 DCHECK_EQ( |
307 interpreter::OperandSize::kShort, | 314 interpreter::OperandSize::kShort, |
308 interpreter::Bytecodes::GetOperandSize(bytecode_, operand_index)); | 315 interpreter::Bytecodes::GetOperandSize(bytecode_, operand_index)); |
309 return BytecodeOperandShortSignExtended(operand_index); | 316 return BytecodeOperandShortSignExtended(operand_index); |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 args[1] = arg2; | 555 args[1] = arg2; |
549 args[2] = arg3; | 556 args[2] = arg3; |
550 args[3] = arg4; | 557 args[3] = arg4; |
551 args[4] = arg5; | 558 args[4] = arg5; |
552 args[5] = GetContext(); | 559 args[5] = GetContext(); |
553 return CallIC(descriptor, target, args); | 560 return CallIC(descriptor, target, args); |
554 } | 561 } |
555 | 562 |
556 | 563 |
557 Node* InterpreterAssembler::CallRuntime(Node* function_id, Node* first_arg, | 564 Node* InterpreterAssembler::CallRuntime(Node* function_id, Node* first_arg, |
558 Node* arg_count) { | 565 Node* arg_count, int result_size) { |
559 Callable callable = CodeFactory::InterpreterCEntry(isolate()); | 566 Callable callable = CodeFactory::InterpreterCEntry(isolate(), result_size); |
560 CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( | 567 CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( |
561 isolate(), zone(), callable.descriptor(), 0, CallDescriptor::kNoFlags); | 568 isolate(), zone(), callable.descriptor(), 0, CallDescriptor::kNoFlags, |
562 | 569 Operator::kNoProperties, MachineType::AnyTagged(), result_size); |
563 Node* code_target = HeapConstant(callable.code()); | 570 Node* code_target = HeapConstant(callable.code()); |
564 | 571 |
565 // Get the function entry from the function id. | 572 // Get the function entry from the function id. |
566 Node* function_table = raw_assembler_->ExternalConstant( | 573 Node* function_table = raw_assembler_->ExternalConstant( |
567 ExternalReference::runtime_function_table_address(isolate())); | 574 ExternalReference::runtime_function_table_address(isolate())); |
568 Node* function_offset = raw_assembler_->Int32Mul( | 575 Node* function_offset = raw_assembler_->Int32Mul( |
569 function_id, Int32Constant(sizeof(Runtime::Function))); | 576 function_id, Int32Constant(sizeof(Runtime::Function))); |
570 Node* function = IntPtrAdd(function_table, function_offset); | 577 Node* function = IntPtrAdd(function_table, function_offset); |
571 Node* function_entry = | 578 Node* function_entry = |
572 raw_assembler_->Load(MachineType::Pointer(), function, | 579 raw_assembler_->Load(MachineType::Pointer(), function, |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 return raw_assembler_->call_descriptor(); | 742 return raw_assembler_->call_descriptor(); |
736 } | 743 } |
737 | 744 |
738 | 745 |
739 Zone* InterpreterAssembler::zone() { return raw_assembler_->zone(); } | 746 Zone* InterpreterAssembler::zone() { return raw_assembler_->zone(); } |
740 | 747 |
741 | 748 |
742 } // namespace compiler | 749 } // namespace compiler |
743 } // namespace internal | 750 } // namespace internal |
744 } // namespace v8 | 751 } // namespace v8 |
OLD | NEW |