[interpreter] Split bytecode generation out of interpreter.cc
as InterpreterGenerator. This is in preparation for no longer including the bytecode handler generation code in the main library. BUG=v8:6055 Review-Url: https://codereview.chromium.org/2765433003 Cr-Commit-Position: refs/heads/master@{#43949}
This commit is contained in:
parent
ec37d0b0f3
commit
221dec328f
3
BUILD.gn
3
BUILD.gn
@ -933,6 +933,8 @@ v8_source_set("v8_builtins_generators") {
|
||||
"src/builtins/builtins-typedarray-gen.cc",
|
||||
"src/builtins/builtins-utils-gen.h",
|
||||
"src/builtins/builtins-wasm-gen.cc",
|
||||
"src/interpreter/interpreter-generator.cc",
|
||||
"src/interpreter/interpreter-generator.h",
|
||||
]
|
||||
|
||||
configs = [ ":internal_config" ]
|
||||
@ -1597,6 +1599,7 @@ v8_source_set("v8_base") {
|
||||
"src/interpreter/handler-table-builder.h",
|
||||
"src/interpreter/interpreter-assembler.cc",
|
||||
"src/interpreter/interpreter-assembler.h",
|
||||
"src/interpreter/interpreter-generator.h",
|
||||
"src/interpreter/interpreter-intrinsics.cc",
|
||||
"src/interpreter/interpreter-intrinsics.h",
|
||||
"src/interpreter/interpreter.cc",
|
||||
|
3430
src/interpreter/interpreter-generator.cc
Normal file
3430
src/interpreter/interpreter-generator.cc
Normal file
File diff suppressed because it is too large
Load Diff
22
src/interpreter/interpreter-generator.h
Normal file
22
src/interpreter/interpreter-generator.h
Normal file
@ -0,0 +1,22 @@
|
||||
// Copyright 2017 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef V8_INTERPRETER_INTERPRETER_GENERATOR_H_
|
||||
#define V8_INTERPRETER_INTERPRETER_GENERATOR_H_
|
||||
|
||||
#include "src/interpreter/bytecode-operands.h"
|
||||
#include "src/interpreter/bytecodes.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
namespace interpreter {
|
||||
|
||||
extern Handle<Code> GenerateBytecodeHandler(Isolate* isolate, Bytecode bytecode,
|
||||
OperandScale operand_scale);
|
||||
|
||||
} // namespace interpreter
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
||||
#endif // V8_INTERPRETER_INTERPRETER_GENERATOR_H_
|
File diff suppressed because it is too large
Load Diff
@ -24,10 +24,6 @@ class Callable;
|
||||
class CompilationInfo;
|
||||
class CompilationJob;
|
||||
|
||||
namespace compiler {
|
||||
class Node;
|
||||
} // namespace compiler
|
||||
|
||||
namespace interpreter {
|
||||
|
||||
class InterpreterAssembler;
|
||||
@ -53,7 +49,6 @@ class Interpreter {
|
||||
void IterateDispatchTable(ObjectVisitor* v);
|
||||
|
||||
// Disassembler support (only useful with ENABLE_DISASSEMBLER defined).
|
||||
void TraceCodegen(Handle<Code> code);
|
||||
const char* LookupNameOfBytecodeHandler(Code* code);
|
||||
|
||||
V8_EXPORT_PRIVATE Local<v8::Object> GetDispatchCountersObject();
|
||||
@ -70,112 +65,14 @@ class Interpreter {
|
||||
static const int kCodeSizeMultiplier = 32;
|
||||
|
||||
private:
|
||||
// Bytecode handler generator functions.
|
||||
#define DECLARE_BYTECODE_HANDLER_GENERATOR(Name, ...) \
|
||||
void Do##Name(InterpreterAssembler* assembler);
|
||||
BYTECODE_LIST(DECLARE_BYTECODE_HANDLER_GENERATOR)
|
||||
#undef DECLARE_BYTECODE_HANDLER_GENERATOR
|
||||
|
||||
typedef void (Interpreter::*BytecodeGeneratorFunc)(InterpreterAssembler*);
|
||||
|
||||
// In the case of bytecodes that share handler implementations, copy the code
|
||||
// into the bytecode's dispatcher table entry and return true.
|
||||
bool ReuseExistingHandler(Bytecode bytecode, OperandScale operand_scale);
|
||||
|
||||
// Generates handler for given |bytecode| and |operand_scale| using
|
||||
// |generator| and installs it into the dispatch table.
|
||||
void InstallBytecodeHandler(Zone* zone, Bytecode bytecode,
|
||||
OperandScale operand_scale,
|
||||
BytecodeGeneratorFunc generator);
|
||||
|
||||
// Generates code to perform the binary operation via |Generator|.
|
||||
template <class Generator>
|
||||
void DoBinaryOpWithFeedback(InterpreterAssembler* assembler);
|
||||
|
||||
// Generates code to perform the comparison via |Generator| while gathering
|
||||
// type feedback.
|
||||
void DoCompareOpWithFeedback(Token::Value compare_op,
|
||||
InterpreterAssembler* assembler);
|
||||
|
||||
// Generates code to perform the bitwise binary operation corresponding to
|
||||
// |bitwise_op| while gathering type feedback.
|
||||
void DoBitwiseBinaryOp(Token::Value bitwise_op,
|
||||
InterpreterAssembler* assembler);
|
||||
|
||||
// Generates code to perform the binary operation via |Generator| using
|
||||
// an immediate value rather the accumulator as the rhs operand.
|
||||
template <class Generator>
|
||||
void DoBinaryOpWithImmediate(InterpreterAssembler* assembler);
|
||||
|
||||
// Generates code to perform the unary operation via |Generator| while
|
||||
// gatering type feedback.
|
||||
template <class Generator>
|
||||
void DoUnaryOpWithFeedback(InterpreterAssembler* assembler);
|
||||
|
||||
// Generates code to perform the comparison operation associated with
|
||||
// |compare_op|.
|
||||
void DoCompareOp(Token::Value compare_op, InterpreterAssembler* assembler);
|
||||
|
||||
// Generates code to perform a global store via |ic|.
|
||||
void DoStaGlobal(Callable ic, InterpreterAssembler* assembler);
|
||||
|
||||
// Generates code to perform a named property store via |ic|.
|
||||
void DoStoreIC(Callable ic, InterpreterAssembler* assembler);
|
||||
|
||||
// Generates code to perform a keyed property store via |ic|.
|
||||
void DoKeyedStoreIC(Callable ic, InterpreterAssembler* assembler);
|
||||
|
||||
// Generates code to perform a JS call that collects type feedback.
|
||||
void DoJSCall(InterpreterAssembler* assembler, TailCallMode tail_call_mode);
|
||||
|
||||
// Generates code to perform a JS call with a known number of arguments that
|
||||
// collects type feedback.
|
||||
void DoJSCallN(InterpreterAssembler* assembler, int n);
|
||||
|
||||
// Generates code to perform delete via function_id.
|
||||
void DoDelete(Runtime::FunctionId function_id,
|
||||
InterpreterAssembler* assembler);
|
||||
|
||||
// Generates code to perform a lookup slot load via |function_id|.
|
||||
void DoLdaLookupSlot(Runtime::FunctionId function_id,
|
||||
InterpreterAssembler* assembler);
|
||||
|
||||
// Generates code to perform a lookup slot load via |function_id| that can
|
||||
// fast path to a context slot load.
|
||||
void DoLdaLookupContextSlot(Runtime::FunctionId function_id,
|
||||
InterpreterAssembler* assembler);
|
||||
|
||||
// Generates code to perform a lookup slot load via |function_id| that can
|
||||
// fast path to a global load.
|
||||
void DoLdaLookupGlobalSlot(Runtime::FunctionId function_id,
|
||||
InterpreterAssembler* assembler);
|
||||
|
||||
// Generates code to perform a lookup slot store depending on
|
||||
// |language_mode|.
|
||||
void DoStaLookupSlot(LanguageMode language_mode,
|
||||
InterpreterAssembler* assembler);
|
||||
|
||||
// Generates code to load a global property.
|
||||
void BuildLoadGlobalIC(int slot_operand_index, int name_operand_index,
|
||||
TypeofMode typeof_mode,
|
||||
InterpreterAssembler* assembler);
|
||||
|
||||
// Generates code to load a property.
|
||||
void BuildLoadIC(int recv_operand_index, int slot_operand_index,
|
||||
int name_operand_index, InterpreterAssembler* assembler);
|
||||
|
||||
// Generates code to prepare the result for ForInPrepare. Cache data
|
||||
// are placed into the consecutive series of registers starting at
|
||||
// |output_register|.
|
||||
void BuildForInPrepareResult(compiler::Node* output_register,
|
||||
compiler::Node* cache_type,
|
||||
compiler::Node* cache_array,
|
||||
compiler::Node* cache_length,
|
||||
InterpreterAssembler* assembler);
|
||||
|
||||
// Generates code to perform the unary operation via |callable|.
|
||||
compiler::Node* BuildUnaryOp(Callable callable,
|
||||
InterpreterAssembler* assembler);
|
||||
// Generates handler for given |bytecode| and |operand_scale|
|
||||
// and installs it into the dispatch table.
|
||||
void InstallBytecodeHandler(Isolate* isolate, Bytecode bytecode,
|
||||
OperandScale operand_scale);
|
||||
|
||||
uintptr_t GetDispatchCounter(Bytecode from, Bytecode to) const;
|
||||
|
||||
|
@ -1060,6 +1060,8 @@
|
||||
'interpreter/interpreter.h',
|
||||
'interpreter/interpreter-assembler.cc',
|
||||
'interpreter/interpreter-assembler.h',
|
||||
'interpreter/interpreter-generator.cc',
|
||||
'interpreter/interpreter-generator.h',
|
||||
'interpreter/interpreter-intrinsics.cc',
|
||||
'interpreter/interpreter-intrinsics.h',
|
||||
'isolate-inl.h',
|
||||
|
Loading…
Reference in New Issue
Block a user