| 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 load = raw_assembler_->ChangeInt32ToInt64(load); | 252 load = raw_assembler_->ChangeInt32ToInt64(load); |
| 253 } | 253 } |
| 254 return load; | 254 return load; |
| 255 } | 255 } |
| 256 | 256 |
| 257 | 257 |
| 258 Node* InterpreterAssembler::BytecodeOperandCount(int operand_index) { | 258 Node* InterpreterAssembler::BytecodeOperandCount(int operand_index) { |
| 259 switch (interpreter::Bytecodes::GetOperandSize(bytecode_, operand_index)) { | 259 switch (interpreter::Bytecodes::GetOperandSize(bytecode_, operand_index)) { |
| 260 case interpreter::OperandSize::kByte: | 260 case interpreter::OperandSize::kByte: |
| 261 DCHECK_EQ( | 261 DCHECK_EQ( |
| 262 interpreter::OperandType::kCount8, | 262 interpreter::OperandType::kRegCount8, |
| 263 interpreter::Bytecodes::GetOperandType(bytecode_, operand_index)); | 263 interpreter::Bytecodes::GetOperandType(bytecode_, operand_index)); |
| 264 return BytecodeOperand(operand_index); | 264 return BytecodeOperand(operand_index); |
| 265 case interpreter::OperandSize::kShort: | 265 case interpreter::OperandSize::kShort: |
| 266 DCHECK_EQ( | 266 DCHECK_EQ( |
| 267 interpreter::OperandType::kCount16, | 267 interpreter::OperandType::kRegCount16, |
| 268 interpreter::Bytecodes::GetOperandType(bytecode_, operand_index)); | 268 interpreter::Bytecodes::GetOperandType(bytecode_, operand_index)); |
| 269 return BytecodeOperandShort(operand_index); | 269 return BytecodeOperandShort(operand_index); |
| 270 default: | 270 case interpreter::OperandSize::kNone: |
| 271 UNREACHABLE(); | 271 UNREACHABLE(); |
| 272 return nullptr; | |
| 273 } | 272 } |
| 273 return nullptr; |
| 274 } | 274 } |
| 275 | 275 |
| 276 | 276 |
| 277 Node* InterpreterAssembler::BytecodeOperandImm(int operand_index) { | 277 Node* InterpreterAssembler::BytecodeOperandImm(int operand_index) { |
| 278 DCHECK_EQ(interpreter::OperandType::kImm8, | 278 DCHECK_EQ(interpreter::OperandType::kImm8, |
| 279 interpreter::Bytecodes::GetOperandType(bytecode_, operand_index)); | 279 interpreter::Bytecodes::GetOperandType(bytecode_, operand_index)); |
| 280 return BytecodeOperandSignExtended(operand_index); | 280 return BytecodeOperandSignExtended(operand_index); |
| 281 } | 281 } |
| 282 | 282 |
| 283 | 283 |
| 284 Node* InterpreterAssembler::BytecodeOperandIdx(int operand_index) { | 284 Node* InterpreterAssembler::BytecodeOperandIdx(int operand_index) { |
| 285 switch (interpreter::Bytecodes::GetOperandSize(bytecode_, operand_index)) { | 285 switch (interpreter::Bytecodes::GetOperandSize(bytecode_, operand_index)) { |
| 286 case interpreter::OperandSize::kByte: | 286 case interpreter::OperandSize::kByte: |
| 287 DCHECK_EQ( | 287 DCHECK_EQ( |
| 288 interpreter::OperandType::kIdx8, | 288 interpreter::OperandType::kIdx8, |
| 289 interpreter::Bytecodes::GetOperandType(bytecode_, operand_index)); | 289 interpreter::Bytecodes::GetOperandType(bytecode_, operand_index)); |
| 290 return BytecodeOperand(operand_index); | 290 return BytecodeOperand(operand_index); |
| 291 case interpreter::OperandSize::kShort: | 291 case interpreter::OperandSize::kShort: |
| 292 DCHECK_EQ( | 292 DCHECK_EQ( |
| 293 interpreter::OperandType::kIdx16, | 293 interpreter::OperandType::kIdx16, |
| 294 interpreter::Bytecodes::GetOperandType(bytecode_, operand_index)); | 294 interpreter::Bytecodes::GetOperandType(bytecode_, operand_index)); |
| 295 return BytecodeOperandShort(operand_index); | 295 return BytecodeOperandShort(operand_index); |
| 296 default: | 296 case interpreter::OperandSize::kNone: |
| 297 UNREACHABLE(); | 297 UNREACHABLE(); |
| 298 return nullptr; | |
| 299 } | 298 } |
| 299 return nullptr; |
| 300 } | 300 } |
| 301 | 301 |
| 302 | 302 |
| 303 Node* InterpreterAssembler::BytecodeOperandReg(int operand_index) { | 303 Node* InterpreterAssembler::BytecodeOperandReg(int operand_index) { |
| 304 switch (interpreter::Bytecodes::GetOperandType(bytecode_, operand_index)) { | 304 switch (interpreter::Bytecodes::GetOperandType(bytecode_, operand_index)) { |
| 305 case interpreter::OperandType::kMaybeReg8: |
| 305 case interpreter::OperandType::kReg8: | 306 case interpreter::OperandType::kReg8: |
| 306 case interpreter::OperandType::kRegPair8: | 307 case interpreter::OperandType::kRegPair8: |
| 307 case interpreter::OperandType::kRegTriple8: | 308 case interpreter::OperandType::kRegTriple8: |
| 308 case interpreter::OperandType::kMaybeReg8: | |
| 309 DCHECK_EQ( | 309 DCHECK_EQ( |
| 310 interpreter::OperandSize::kByte, | 310 interpreter::OperandSize::kByte, |
| 311 interpreter::Bytecodes::GetOperandSize(bytecode_, operand_index)); | 311 interpreter::Bytecodes::GetOperandSize(bytecode_, operand_index)); |
| 312 return BytecodeOperandSignExtended(operand_index); | 312 return BytecodeOperandSignExtended(operand_index); |
| 313 case interpreter::OperandType::kMaybeReg16: |
| 313 case interpreter::OperandType::kReg16: | 314 case interpreter::OperandType::kReg16: |
| 315 case interpreter::OperandType::kRegPair16: |
| 316 case interpreter::OperandType::kRegTriple16: |
| 314 DCHECK_EQ( | 317 DCHECK_EQ( |
| 315 interpreter::OperandSize::kShort, | 318 interpreter::OperandSize::kShort, |
| 316 interpreter::Bytecodes::GetOperandSize(bytecode_, operand_index)); | 319 interpreter::Bytecodes::GetOperandSize(bytecode_, operand_index)); |
| 317 return BytecodeOperandShortSignExtended(operand_index); | 320 return BytecodeOperandShortSignExtended(operand_index); |
| 318 default: | 321 case interpreter::OperandType::kNone: |
| 322 case interpreter::OperandType::kIdx8: |
| 323 case interpreter::OperandType::kIdx16: |
| 324 case interpreter::OperandType::kImm8: |
| 325 case interpreter::OperandType::kRegCount8: |
| 326 case interpreter::OperandType::kRegCount16: |
| 319 UNREACHABLE(); | 327 UNREACHABLE(); |
| 320 return nullptr; | |
| 321 } | 328 } |
| 329 return nullptr; |
| 322 } | 330 } |
| 323 | 331 |
| 324 | 332 |
| 325 Node* InterpreterAssembler::Int32Constant(int value) { | 333 Node* InterpreterAssembler::Int32Constant(int value) { |
| 326 return raw_assembler_->Int32Constant(value); | 334 return raw_assembler_->Int32Constant(value); |
| 327 } | 335 } |
| 328 | 336 |
| 329 | 337 |
| 330 Node* InterpreterAssembler::IntPtrConstant(intptr_t value) { | 338 Node* InterpreterAssembler::IntPtrConstant(intptr_t value) { |
| 331 return raw_assembler_->IntPtrConstant(value); | 339 return raw_assembler_->IntPtrConstant(value); |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 return raw_assembler_->call_descriptor(); | 751 return raw_assembler_->call_descriptor(); |
| 744 } | 752 } |
| 745 | 753 |
| 746 | 754 |
| 747 Zone* InterpreterAssembler::zone() { return raw_assembler_->zone(); } | 755 Zone* InterpreterAssembler::zone() { return raw_assembler_->zone(); } |
| 748 | 756 |
| 749 | 757 |
| 750 } // namespace compiler | 758 } // namespace compiler |
| 751 } // namespace internal | 759 } // namespace internal |
| 752 } // namespace v8 | 760 } // namespace v8 |
| OLD | NEW |