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

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: Rebase 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
« no previous file with comments | « src/interpreter/bytecodes.cc ('k') | src/interpreter/source-position-table.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/interpreter.cc
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc
index 28e2df7aac7686ce26d269dc6f5b5552302c0a21..eecd94bced2e2e84d23ed5e5262ddb084dd3c143 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
« no previous file with comments | « src/interpreter/bytecodes.cc ('k') | src/interpreter/source-position-table.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698