[Interpreter] Unify approach to building interpreter handler and Turbofan stubs.

Moves interpreter-generator.cc to a similar model of building handlers as
Turbofan stubs elsewhere, to simplify moving code between stubs / builtins and
bytecode handlers. This removes the "__" hack from the Interpreter generator
code.

Also make SetBytecodeOffset private to InterpreterAssembler and make 
LdaImmutable[Current]ContextSlot and Lda[Current]ContextSlot share
handlers since they are identical.

Change-Id: I9e91e7d37c2ea75513e4dcc3b95b4bb6517f83da
Reviewed-on: https://chromium-review.googlesource.com/471987
Commit-Queue: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44534}
This commit is contained in:
Ross McIlroy 2017-04-10 17:45:53 +01:00 committed by Commit Bot
parent 4c3d18a065
commit a79f903155
4 changed files with 3628 additions and 3776 deletions

View File

@ -54,6 +54,10 @@ InterpreterAssembler::InterpreterAssembler(CodeAssemblerState* state,
}
RegisterCallGenerationCallbacks([this] { CallPrologue(); },
[this] { CallEpilogue(); });
if (Bytecodes::MakesCallAlongCriticalPath(bytecode)) {
SaveBytecodeOffset();
}
}
InterpreterAssembler::~InterpreterAssembler() {

View File

@ -228,9 +228,6 @@ class V8_EXPORT_PRIVATE InterpreterAssembler : public CodeStubAssembler {
// Returns the offset from the BytecodeArrayPointer of the current bytecode.
compiler::Node* BytecodeOffset();
// Save the bytecode offset to the interpreter frame.
void SaveBytecodeOffset();
protected:
Bytecode bytecode() const { return bytecode_; }
static bool TargetSupportsUnalignedAccess();
@ -306,6 +303,9 @@ class V8_EXPORT_PRIVATE InterpreterAssembler : public CodeStubAssembler {
// JumpIfWordNotEqual.
void JumpConditional(compiler::Node* condition, compiler::Node* jump_offset);
// Save the bytecode offset to the interpreter frame.
void SaveBytecodeOffset();
// Updates and returns BytecodeOffset() advanced by the current bytecode's
// size. Traces the exit of the current bytecode.
compiler::Node* Advance();

File diff suppressed because it is too large Load Diff

View File

@ -52,7 +52,24 @@ void SetupInterpreter::InstallBytecodeHandlers(Interpreter* interpreter) {
bool SetupInterpreter::ReuseExistingHandler(Address* dispatch_table,
Bytecode bytecode,
OperandScale operand_scale) {
// TODO(leszeks): reuse Lda[Immutable][Current]ContextSlot
size_t index = Interpreter::GetDispatchTableIndex(bytecode, operand_scale);
switch (bytecode) {
case Bytecode::kLdaImmutableContextSlot:
STATIC_ASSERT(static_cast<int>(Bytecode::kLdaContextSlot) <
static_cast<int>(Bytecode::kLdaImmutableContextSlot));
dispatch_table[index] = dispatch_table[Interpreter::GetDispatchTableIndex(
Bytecode::kLdaContextSlot, operand_scale)];
return true;
case Bytecode::kLdaImmutableCurrentContextSlot:
STATIC_ASSERT(
static_cast<int>(Bytecode::kLdaCurrentContextSlot) <
static_cast<int>(Bytecode::kLdaImmutableCurrentContextSlot));
dispatch_table[index] = dispatch_table[Interpreter::GetDispatchTableIndex(
Bytecode::kLdaCurrentContextSlot, operand_scale)];
return true;
default:
return false;
}
return false;
}