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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 119 |
120 | 120 |
121 Node* InterpreterAssembler::StoreRegister(Node* value, Node* reg_index) { | 121 Node* InterpreterAssembler::StoreRegister(Node* value, Node* reg_index) { |
122 return raw_assembler_->Store(kMachAnyTagged, RegisterFileRawPointer(), | 122 return raw_assembler_->Store(kMachAnyTagged, RegisterFileRawPointer(), |
123 RegisterFrameOffset(reg_index), value); | 123 RegisterFrameOffset(reg_index), value); |
124 } | 124 } |
125 | 125 |
126 | 126 |
127 Node* InterpreterAssembler::BytecodeOperand(int operand_index) { | 127 Node* InterpreterAssembler::BytecodeOperand(int operand_index) { |
128 DCHECK_LT(operand_index, interpreter::Bytecodes::NumberOfOperands(bytecode_)); | 128 DCHECK_LT(operand_index, interpreter::Bytecodes::NumberOfOperands(bytecode_)); |
| 129 DCHECK(interpreter::OperandSize::kByte == |
| 130 interpreter::Bytecodes::SizeOfOperand( |
| 131 interpreter::Bytecodes::GetOperandType(bytecode_, operand_index))); |
129 return raw_assembler_->Load( | 132 return raw_assembler_->Load( |
130 kMachUint8, BytecodeArrayTaggedPointer(), | 133 kMachUint8, BytecodeArrayTaggedPointer(), |
131 IntPtrAdd(BytecodeOffset(), Int32Constant(1 + operand_index))); | 134 IntPtrAdd(BytecodeOffset(), |
| 135 Int32Constant(interpreter::Bytecodes::GetOperandOffset( |
| 136 bytecode_, operand_index)))); |
132 } | 137 } |
133 | 138 |
134 | 139 |
135 Node* InterpreterAssembler::BytecodeOperandSignExtended(int operand_index) { | 140 Node* InterpreterAssembler::BytecodeOperandSignExtended(int operand_index) { |
136 DCHECK_LT(operand_index, interpreter::Bytecodes::NumberOfOperands(bytecode_)); | 141 DCHECK_LT(operand_index, interpreter::Bytecodes::NumberOfOperands(bytecode_)); |
| 142 DCHECK(interpreter::OperandSize::kByte == |
| 143 interpreter::Bytecodes::SizeOfOperand( |
| 144 interpreter::Bytecodes::GetOperandType(bytecode_, operand_index))); |
137 Node* load = raw_assembler_->Load( | 145 Node* load = raw_assembler_->Load( |
138 kMachInt8, BytecodeArrayTaggedPointer(), | 146 kMachInt8, BytecodeArrayTaggedPointer(), |
139 IntPtrAdd(BytecodeOffset(), Int32Constant(1 + operand_index))); | 147 IntPtrAdd(BytecodeOffset(), |
| 148 Int32Constant(interpreter::Bytecodes::GetOperandOffset( |
| 149 bytecode_, operand_index)))); |
140 // Ensure that we sign extend to full pointer size | 150 // Ensure that we sign extend to full pointer size |
141 if (kPointerSize == 8) { | 151 if (kPointerSize == 8) { |
142 load = raw_assembler_->ChangeInt32ToInt64(load); | 152 load = raw_assembler_->ChangeInt32ToInt64(load); |
143 } | 153 } |
144 return load; | 154 return load; |
145 } | 155 } |
146 | 156 |
147 | 157 |
| 158 Node* InterpreterAssembler::BytecodeOperandWide(int operand_index) { |
| 159 DCHECK_LT(operand_index, interpreter::Bytecodes::NumberOfOperands(bytecode_)); |
| 160 DCHECK(interpreter::OperandSize::kWide == |
| 161 interpreter::Bytecodes::SizeOfOperand( |
| 162 interpreter::Bytecodes::GetOperandType(bytecode_, operand_index))); |
| 163 return raw_assembler_->Load( |
| 164 kMachUint16, BytecodeArrayTaggedPointer(), |
| 165 IntPtrAdd(BytecodeOffset(), |
| 166 Int32Constant(interpreter::Bytecodes::GetOperandOffset( |
| 167 bytecode_, operand_index)))); |
| 168 } |
| 169 |
| 170 |
148 Node* InterpreterAssembler::BytecodeOperandCount(int operand_index) { | 171 Node* InterpreterAssembler::BytecodeOperandCount(int operand_index) { |
149 DCHECK_EQ(interpreter::OperandType::kCount, | 172 DCHECK_EQ(interpreter::OperandType::kCount, |
150 interpreter::Bytecodes::GetOperandType(bytecode_, operand_index)); | 173 interpreter::Bytecodes::GetOperandType(bytecode_, operand_index)); |
151 return BytecodeOperand(operand_index); | 174 return BytecodeOperand(operand_index); |
152 } | 175 } |
153 | 176 |
154 | 177 |
155 Node* InterpreterAssembler::BytecodeOperandImm8(int operand_index) { | 178 Node* InterpreterAssembler::BytecodeOperandImm8(int operand_index) { |
156 DCHECK_EQ(interpreter::OperandType::kImm8, | 179 DCHECK_EQ(interpreter::OperandType::kImm8, |
157 interpreter::Bytecodes::GetOperandType(bytecode_, operand_index)); | 180 interpreter::Bytecodes::GetOperandType(bytecode_, operand_index)); |
158 return BytecodeOperandSignExtended(operand_index); | 181 return BytecodeOperandSignExtended(operand_index); |
159 } | 182 } |
160 | 183 |
161 | 184 |
162 Node* InterpreterAssembler::BytecodeOperandIdx(int operand_index) { | 185 Node* InterpreterAssembler::BytecodeOperandIdx(int operand_index) { |
163 DCHECK_EQ(interpreter::OperandType::kIdx, | 186 DCHECK_EQ(interpreter::OperandType::kIdx, |
164 interpreter::Bytecodes::GetOperandType(bytecode_, operand_index)); | 187 interpreter::Bytecodes::GetOperandType(bytecode_, operand_index)); |
165 return BytecodeOperand(operand_index); | 188 return BytecodeOperand(operand_index); |
166 } | 189 } |
167 | 190 |
168 | 191 |
169 Node* InterpreterAssembler::BytecodeOperandReg(int operand_index) { | 192 Node* InterpreterAssembler::BytecodeOperandReg(int operand_index) { |
170 DCHECK_EQ(interpreter::OperandType::kReg, | 193 DCHECK_EQ(interpreter::OperandType::kReg, |
171 interpreter::Bytecodes::GetOperandType(bytecode_, operand_index)); | 194 interpreter::Bytecodes::GetOperandType(bytecode_, operand_index)); |
172 return BytecodeOperandSignExtended(operand_index); | 195 return BytecodeOperandSignExtended(operand_index); |
173 } | 196 } |
174 | 197 |
175 | 198 |
| 199 Node* InterpreterAssembler::BytecodeOperandWideIdx(int operand_index) { |
| 200 DCHECK_EQ(interpreter::OperandType::kWideIdx, |
| 201 interpreter::Bytecodes::GetOperandType(bytecode_, operand_index)); |
| 202 return BytecodeOperandWide(operand_index); |
| 203 } |
| 204 |
| 205 |
176 Node* InterpreterAssembler::Int32Constant(int value) { | 206 Node* InterpreterAssembler::Int32Constant(int value) { |
177 return raw_assembler_->Int32Constant(value); | 207 return raw_assembler_->Int32Constant(value); |
178 } | 208 } |
179 | 209 |
180 | 210 |
181 Node* InterpreterAssembler::IntPtrConstant(intptr_t value) { | 211 Node* InterpreterAssembler::IntPtrConstant(intptr_t value) { |
182 return raw_assembler_->IntPtrConstant(value); | 212 return raw_assembler_->IntPtrConstant(value); |
183 } | 213 } |
184 | 214 |
185 | 215 |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 return raw_assembler_->schedule(); | 478 return raw_assembler_->schedule(); |
449 } | 479 } |
450 | 480 |
451 | 481 |
452 Zone* InterpreterAssembler::zone() { return raw_assembler_->zone(); } | 482 Zone* InterpreterAssembler::zone() { return raw_assembler_->zone(); } |
453 | 483 |
454 | 484 |
455 } // namespace interpreter | 485 } // namespace interpreter |
456 } // namespace internal | 486 } // namespace internal |
457 } // namespace v8 | 487 } // namespace v8 |
OLD | NEW |