Commit d0e7d41f authored by rmcilroy's avatar rmcilroy Committed by Commit bot

[Interpreter] Add some CHECKS to track down crbug.com/642111

BUG=chromium:642111

Review-Url: https://codereview.chromium.org/2313763002
Cr-Commit-Position: refs/heads/master@{#39197}
parent 985afadf
...@@ -153,7 +153,7 @@ size_t Bytecodes::ReturnCount(Bytecode bytecode) { ...@@ -153,7 +153,7 @@ size_t Bytecodes::ReturnCount(Bytecode bytecode) {
// static // static
int Bytecodes::NumberOfOperands(Bytecode bytecode) { int Bytecodes::NumberOfOperands(Bytecode bytecode) {
DCHECK(bytecode <= Bytecode::kLast); CHECK(bytecode <= Bytecode::kLast);
switch (bytecode) { switch (bytecode) {
#define CASE(Name, ...) \ #define CASE(Name, ...) \
case Bytecode::k##Name: \ case Bytecode::k##Name: \
...@@ -310,15 +310,15 @@ bool Bytecodes::IsWithoutExternalSideEffects(Bytecode bytecode) { ...@@ -310,15 +310,15 @@ bool Bytecodes::IsWithoutExternalSideEffects(Bytecode bytecode) {
// static // static
OperandType Bytecodes::GetOperandType(Bytecode bytecode, int i) { OperandType Bytecodes::GetOperandType(Bytecode bytecode, int i) {
DCHECK_LE(bytecode, Bytecode::kLast); CHECK_LE(bytecode, Bytecode::kLast);
DCHECK_LT(i, NumberOfOperands(bytecode)); CHECK_LT(i, NumberOfOperands(bytecode));
DCHECK_GE(i, 0); CHECK_GE(i, 0);
return GetOperandTypes(bytecode)[i]; return GetOperandTypes(bytecode)[i];
} }
// static // static
const OperandType* Bytecodes::GetOperandTypes(Bytecode bytecode) { const OperandType* Bytecodes::GetOperandTypes(Bytecode bytecode) {
DCHECK(bytecode <= Bytecode::kLast); CHECK_LE(bytecode, Bytecode::kLast);
switch (bytecode) { switch (bytecode) {
#define CASE(Name, ...) \ #define CASE(Name, ...) \
case Bytecode::k##Name: \ case Bytecode::k##Name: \
...@@ -347,7 +347,7 @@ const OperandTypeInfo* Bytecodes::GetOperandTypeInfos(Bytecode bytecode) { ...@@ -347,7 +347,7 @@ const OperandTypeInfo* Bytecodes::GetOperandTypeInfos(Bytecode bytecode) {
// static // static
OperandSize Bytecodes::GetOperandSize(Bytecode bytecode, int i, OperandSize Bytecodes::GetOperandSize(Bytecode bytecode, int i,
OperandScale operand_scale) { OperandScale operand_scale) {
DCHECK_LT(i, NumberOfOperands(bytecode)); CHECK_LT(i, NumberOfOperands(bytecode));
OperandType operand_type = GetOperandType(bytecode, i); OperandType operand_type = GetOperandType(bytecode, i);
return SizeOfOperand(operand_type, operand_scale); return SizeOfOperand(operand_type, operand_scale);
} }
...@@ -369,6 +369,9 @@ int Bytecodes::GetOperandOffset(Bytecode bytecode, int i, ...@@ -369,6 +369,9 @@ int Bytecodes::GetOperandOffset(Bytecode bytecode, int i,
// static // static
OperandSize Bytecodes::SizeOfOperand(OperandType operand_type, OperandSize Bytecodes::SizeOfOperand(OperandType operand_type,
OperandScale operand_scale) { OperandScale operand_scale) {
CHECK_LE(operand_type, OperandType::kLast);
CHECK_GE(operand_scale, OperandScale::kSingle);
CHECK_LE(operand_scale, OperandScale::kLast);
return static_cast<OperandSize>( return static_cast<OperandSize>(
ScaledOperandSize(operand_type, operand_scale)); ScaledOperandSize(operand_type, operand_scale));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment