Chromium Code Reviews| 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/interpreter/bytecode-array-builder.h" | 5 #include "src/interpreter/bytecode-array-builder.h" |
| 6 | 6 |
| 7 namespace v8 { | 7 namespace v8 { |
| 8 namespace internal { | 8 namespace internal { |
| 9 namespace interpreter { | 9 namespace interpreter { |
| 10 | 10 |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 401 Output(Bytecode::kMovWide, from.ToRawOperand(), to.ToRawOperand()); | 401 Output(Bytecode::kMovWide, from.ToRawOperand(), to.ToRawOperand()); |
| 402 } | 402 } |
| 403 | 403 |
| 404 bool BytecodeArrayBuilder::RegisterOperandIsMovable(Bytecode bytecode, | 404 bool BytecodeArrayBuilder::RegisterOperandIsMovable(Bytecode bytecode, |
| 405 int operand_index) { | 405 int operand_index) { |
| 406 // By design, we only support moving individual registers. There | 406 // By design, we only support moving individual registers. There |
| 407 // should be wide variants of such bytecodes instead to avoid the | 407 // should be wide variants of such bytecodes instead to avoid the |
| 408 // need for a large translation window. | 408 // need for a large translation window. |
| 409 OperandType operand_type = Bytecodes::GetOperandType(bytecode, operand_index); | 409 OperandType operand_type = Bytecodes::GetOperandType(bytecode, operand_index); |
| 410 if (operand_type != OperandType::kReg8 && | 410 if (operand_type != OperandType::kReg8 && |
| 411 operand_type != OperandType::kReg16) { | 411 operand_type != OperandType::kRegOut8) { |
|
rmcilroy
2016/01/26 16:49:51
Purposefully dropping kReg16 from here?
oth
2016/01/26 17:55:53
Yes, moves to the translation window are not neede
| |
| 412 return false; | 412 return false; |
| 413 } else if (operand_index + 1 == Bytecodes::NumberOfOperands(bytecode)) { | 413 } else if (operand_index + 1 == Bytecodes::NumberOfOperands(bytecode)) { |
| 414 return true; | 414 return true; |
| 415 } else { | 415 } else { |
| 416 OperandType next_operand_type = | 416 OperandType next_operand_type = |
| 417 Bytecodes::GetOperandType(bytecode, operand_index + 1); | 417 Bytecodes::GetOperandType(bytecode, operand_index + 1); |
| 418 return (next_operand_type != OperandType::kRegCount8 && | 418 return (next_operand_type != OperandType::kRegCount8 && |
| 419 next_operand_type != OperandType::kRegCount16); | 419 next_operand_type != OperandType::kRegCount16); |
| 420 } | 420 } |
| 421 } | 421 } |
| (...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1406 return static_cast<uint16_t>(operand_value) == operand_value; | 1406 return static_cast<uint16_t>(operand_value) == operand_value; |
| 1407 case OperandType::kImm8: | 1407 case OperandType::kImm8: |
| 1408 case OperandType::kIdx8: | 1408 case OperandType::kIdx8: |
| 1409 return static_cast<uint8_t>(operand_value) == operand_value; | 1409 return static_cast<uint8_t>(operand_value) == operand_value; |
| 1410 case OperandType::kMaybeReg8: | 1410 case OperandType::kMaybeReg8: |
| 1411 if (operand_value == 0) { | 1411 if (operand_value == 0) { |
| 1412 return true; | 1412 return true; |
| 1413 } | 1413 } |
| 1414 // Fall-through to kReg8 case. | 1414 // Fall-through to kReg8 case. |
| 1415 case OperandType::kReg8: | 1415 case OperandType::kReg8: |
| 1416 case OperandType::kRegOut8: | |
| 1416 return RegisterIsValid(Register::FromRawOperand(operand_value), | 1417 return RegisterIsValid(Register::FromRawOperand(operand_value), |
| 1417 operand_type); | 1418 operand_type); |
| 1419 case OperandType::kRegOutPair8: | |
| 1420 case OperandType::kRegOutPair16: | |
| 1418 case OperandType::kRegPair8: | 1421 case OperandType::kRegPair8: |
| 1419 case OperandType::kRegPair16: { | 1422 case OperandType::kRegPair16: { |
| 1420 Register reg0 = Register::FromRawOperand(operand_value); | 1423 Register reg0 = Register::FromRawOperand(operand_value); |
| 1421 Register reg1 = Register(reg0.index() + 1); | 1424 Register reg1 = Register(reg0.index() + 1); |
| 1422 return RegisterIsValid(reg0, operand_type) && | 1425 return RegisterIsValid(reg0, operand_type) && |
| 1423 RegisterIsValid(reg1, operand_type); | 1426 RegisterIsValid(reg1, operand_type); |
| 1424 } | 1427 } |
| 1425 case OperandType::kRegTriple8: | 1428 case OperandType::kRegOutTriple8: |
| 1426 case OperandType::kRegTriple16: { | 1429 case OperandType::kRegOutTriple16: { |
| 1427 Register reg0 = Register::FromRawOperand(operand_value); | 1430 Register reg0 = Register::FromRawOperand(operand_value); |
| 1428 Register reg1 = Register(reg0.index() + 1); | 1431 Register reg1 = Register(reg0.index() + 1); |
| 1429 Register reg2 = Register(reg0.index() + 2); | 1432 Register reg2 = Register(reg0.index() + 2); |
| 1430 return RegisterIsValid(reg0, operand_type) && | 1433 return RegisterIsValid(reg0, operand_type) && |
| 1431 RegisterIsValid(reg1, operand_type) && | 1434 RegisterIsValid(reg1, operand_type) && |
| 1432 RegisterIsValid(reg2, operand_type); | 1435 RegisterIsValid(reg2, operand_type); |
| 1433 } | 1436 } |
| 1434 case OperandType::kMaybeReg16: | 1437 case OperandType::kMaybeReg16: |
| 1435 if (operand_value == 0) { | 1438 if (operand_value == 0) { |
| 1436 return true; | 1439 return true; |
| 1437 } | 1440 } |
| 1438 // Fall-through to kReg16 case. | 1441 // Fall-through to kReg16 case. |
| 1439 case OperandType::kReg16: { | 1442 case OperandType::kReg16: |
| 1443 case OperandType::kRegOut16: { | |
| 1440 Register reg = Register::FromRawOperand(operand_value); | 1444 Register reg = Register::FromRawOperand(operand_value); |
| 1441 return RegisterIsValid(reg, operand_type); | 1445 return RegisterIsValid(reg, operand_type); |
| 1442 } | 1446 } |
| 1443 } | 1447 } |
| 1444 UNREACHABLE(); | 1448 UNREACHABLE(); |
| 1445 return false; | 1449 return false; |
| 1446 } | 1450 } |
| 1447 | 1451 |
| 1448 | 1452 |
| 1449 bool BytecodeArrayBuilder::RegisterIsValid(Register reg, | 1453 bool BytecodeArrayBuilder::RegisterIsValid(Register reg, |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1828 } | 1832 } |
| 1829 | 1833 |
| 1830 // static | 1834 // static |
| 1831 bool BytecodeArrayBuilder::FitsInReg16OperandUntranslated(Register value) { | 1835 bool BytecodeArrayBuilder::FitsInReg16OperandUntranslated(Register value) { |
| 1832 return value.is_short_operand(); | 1836 return value.is_short_operand(); |
| 1833 } | 1837 } |
| 1834 | 1838 |
| 1835 } // namespace interpreter | 1839 } // namespace interpreter |
| 1836 } // namespace internal | 1840 } // namespace internal |
| 1837 } // namespace v8 | 1841 } // namespace v8 |
| OLD | NEW |