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

Unified Diff: src/interpreter/interpreter.cc

Issue 1947403002: [interpreter] Introduce bytecode generation pipeline. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Attempt to fix compilation with gcc/msvc and introduce nop to simplify source positions in peephole… Created 4 years, 7 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
Index: src/interpreter/interpreter.cc
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc
index 505202c6cb3e915330d88270ec77f328b38782db..8d06ba4d07c4554ffc8307b7aceaae04f1265aef 100644
--- a/src/interpreter/interpreter.cc
+++ b/src/interpreter/interpreter.cc
@@ -45,9 +45,13 @@ void Interpreter::Initialize() {
}
// Generate bytecode handlers for all bytecodes and scales.
- for (OperandScale operand_scale = OperandScale::kSingle;
- operand_scale <= OperandScale::kMaxValid;
- operand_scale = Bytecodes::NextOperandScale(operand_scale)) {
+ const OperandScale kOperandScales[] = {
+#define VALUE(Name, _) OperandScale::k##Name,
+ OPERAND_SCALE_LIST(VALUE)
+#undef VALUE
+ };
+
+ for (OperandScale operand_scale : kOperandScales) {
#define GENERATE_CODE(Name, ...) \
{ \
if (Bytecodes::BytecodeHasHandler(Bytecode::k##Name, operand_scale)) { \
@@ -93,12 +97,16 @@ size_t Interpreter::GetDispatchTableIndex(Bytecode bytecode,
OperandScale operand_scale) {
static const size_t kEntriesPerOperandScale = 1u << kBitsPerByte;
size_t index = static_cast<size_t>(bytecode);
- OperandScale current_scale = OperandScale::kSingle;
- while (current_scale != operand_scale) {
- index += kEntriesPerOperandScale;
- current_scale = Bytecodes::NextOperandScale(current_scale);
+ switch (operand_scale) {
+ case OperandScale::kSingle:
+ return index;
+ case OperandScale::kDouble:
+ return index + kEntriesPerOperandScale;
+ case OperandScale::kQuadruple:
+ return index + 2 * kEntriesPerOperandScale;
}
- return index;
+ UNREACHABLE();
+ return 0;
}
void Interpreter::IterateDispatchTable(ObjectVisitor* v) {
@@ -1767,6 +1775,11 @@ void Interpreter::DoIllegal(InterpreterAssembler* assembler) {
__ Abort(kInvalidBytecode);
}
+// Nop
+//
+// No operation.
+void Interpreter::DoNop(InterpreterAssembler* assembler) { __ Dispatch(); }
+
// SuspendGenerator <generator>
//
// Exports the register file and stores it into the generator. Also stores the
« src/interpreter/bytecodes.h ('K') | « src/interpreter/bytecodes.cc ('k') | src/log.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698