Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(427)

Unified Diff: src/interpreter/bytecode-array-builder.cc

Issue 1325983002: [Intepreter] Extend and move Register class. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix test, bug spotted by bots. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/interpreter/bytecode-array-builder.h ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecode-array-builder.cc
diff --git a/src/interpreter/bytecode-array-builder.cc b/src/interpreter/bytecode-array-builder.cc
index 989fb2d17749c9c54fbabdd4e24696ee3a09db4d..836e6c1b8b25422649432aa3a54a063db4ec908b 100644
--- a/src/interpreter/bytecode-array-builder.cc
+++ b/src/interpreter/bytecode-array-builder.cc
@@ -37,10 +37,10 @@ void BytecodeArrayBuilder::set_parameter_count(int number_of_parameters) {
int BytecodeArrayBuilder::parameter_count() const { return parameter_count_; }
-Register BytecodeArrayBuilder::Parameter(int param_index) {
- DCHECK_GE(param_index, 0);
- DCHECK_LT(param_index, parameter_count_);
- return Register(kLastParamRegisterIndex - parameter_count_ + param_index + 1);
+Register BytecodeArrayBuilder::Parameter(int parameter_index) {
+ DCHECK_GE(parameter_index, 0);
+ DCHECK_LT(parameter_index, parameter_count_);
+ return Register::FromParameterIndex(parameter_index, parameter_count_);
}
@@ -198,10 +198,13 @@ bool BytecodeArrayBuilder::OperandIsValid(Bytecode bytecode, int operand_index,
case OperandType::kIdx:
return operand_value < constants_.size();
case OperandType::kReg: {
- int reg_index = Register::FromOperand(operand_value).index();
- return (reg_index >= 0 && reg_index < temporary_register_next_) ||
- (reg_index <= kLastParamRegisterIndex &&
- reg_index > kLastParamRegisterIndex - parameter_count_);
+ Register reg = Register::FromOperand(operand_value);
+ if (reg.is_parameter()) {
+ int parameter_index = reg.ToParameterIndex(parameter_count_);
+ return parameter_index >= 0 && parameter_index < parameter_count_;
+ } else {
+ return (reg.index() >= 0 && reg.index() < temporary_register_next_);
+ }
}
}
UNREACHABLE();
« no previous file with comments | « src/interpreter/bytecode-array-builder.h ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698