summaryrefslogtreecommitdiff
path: root/deps/v8/src/interpreter/interpreter.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/interpreter/interpreter.h')
-rw-r--r--deps/v8/src/interpreter/interpreter.h118
1 files changed, 82 insertions, 36 deletions
diff --git a/deps/v8/src/interpreter/interpreter.h b/deps/v8/src/interpreter/interpreter.h
index ea50faa02d..bbd0102999 100644
--- a/deps/v8/src/interpreter/interpreter.h
+++ b/deps/v8/src/interpreter/interpreter.h
@@ -5,11 +5,13 @@
#ifndef V8_INTERPRETER_INTERPRETER_H_
#define V8_INTERPRETER_INTERPRETER_H_
+#include <memory>
+
// Clients of this interface shouldn't depend on lots of interpreter internals.
// Do not include anything from src/interpreter other than
// src/interpreter/bytecodes.h here!
#include "src/base/macros.h"
-#include "src/builtins.h"
+#include "src/builtins/builtins.h"
#include "src/interpreter/bytecodes.h"
#include "src/parsing/token.h"
#include "src/runtime/runtime.h"
@@ -21,6 +23,10 @@ class Isolate;
class Callable;
class CompilationInfo;
+namespace compiler {
+class Node;
+} // namespace compiler
+
namespace interpreter {
class InterpreterAssembler;
@@ -49,10 +55,19 @@ class Interpreter {
void TraceCodegen(Handle<Code> code);
const char* LookupNameOfBytecodeHandler(Code* code);
+ Local<v8::Object> GetDispatchCountersObject();
+
Address dispatch_table_address() {
return reinterpret_cast<Address>(&dispatch_table_[0]);
}
+ Address bytecode_dispatch_counters_table() {
+ return reinterpret_cast<Address>(bytecode_dispatch_counters_table_.get());
+ }
+
+ // TODO(ignition): Tune code size multiplier.
+ static const int kCodeSizeMultiplier = 32;
+
private:
// Bytecode handler generator functions.
#define DECLARE_BYTECODE_HANDLER_GENERATOR(Name, ...) \
@@ -60,43 +75,47 @@ class Interpreter {
BYTECODE_LIST(DECLARE_BYTECODE_HANDLER_GENERATOR)
#undef DECLARE_BYTECODE_HANDLER_GENERATOR
- // Generates code to perform the binary operations via |callable|.
- void DoBinaryOp(Callable callable, InterpreterAssembler* assembler);
+ // Generates code to perform the binary operation via |Generator|.
+ template <class Generator>
+ void DoBinaryOp(InterpreterAssembler* assembler);
+
+ // Generates code to perform the binary operation via |Generator|.
+ template <class Generator>
+ void DoBinaryOpWithFeedback(InterpreterAssembler* assembler);
- // Generates code to perform the binary operations via |function_id|.
- void DoBinaryOp(Runtime::FunctionId function_id,
- 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 count operations via |function_id|.
- void DoCountOp(Runtime::FunctionId function_id,
- InterpreterAssembler* assembler);
+ // Generates code to perform the unary operation via |Generator|.
+ template <class Generator>
+ void DoUnaryOp(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 load a constant from the constant pool.
- void DoLoadConstant(InterpreterAssembler* assembler);
-
- // Generates code to perform a global load via |ic|.
- void DoLoadGlobal(Callable ic, InterpreterAssembler* assembler);
-
// Generates code to perform a global store via |ic|.
- void DoStoreGlobal(Callable ic, InterpreterAssembler* assembler);
-
- // Generates code to perform a named property load via |ic|.
- void DoLoadIC(Callable ic, InterpreterAssembler* assembler);
-
- // Generates code to perform a keyed property load via |ic|.
- void DoKeyedLoadIC(Callable ic, InterpreterAssembler* assembler);
+ void DoStaGlobal(Callable ic, InterpreterAssembler* assembler);
- // Generates code to perform a namedproperty store via |ic|.
+ // 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.
+ // Generates code to perform a JS call that collects type feedback.
void DoJSCall(InterpreterAssembler* assembler, TailCallMode tail_call_mode);
// Generates code to perform a runtime call.
@@ -111,24 +130,49 @@ class Interpreter {
// Generates code to perform a constructor call.
void DoCallConstruct(InterpreterAssembler* assembler);
- // Generates code to perform a type conversion.
- void DoTypeConversionOp(Callable callable, InterpreterAssembler* assembler);
-
- // Generates code ro create a literal via |function_id|.
- void DoCreateLiteral(Runtime::FunctionId function_id,
- InterpreterAssembler* assembler);
-
// 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 DoLoadLookupSlot(Runtime::FunctionId function_id,
- InterpreterAssembler* assembler);
+ void DoLdaLookupSlot(Runtime::FunctionId function_id,
+ InterpreterAssembler* assembler);
// Generates code to perform a lookup slot store depending on |language_mode|.
- void DoStoreLookupSlot(LanguageMode language_mode,
- InterpreterAssembler* assembler);
+ void DoStaLookupSlot(LanguageMode language_mode,
+ InterpreterAssembler* assembler);
+
+ // Generates a node with the undefined constant.
+ compiler::Node* BuildLoadUndefined(InterpreterAssembler* assembler);
+
+ // Generates code to load a context slot.
+ compiler::Node* BuildLoadContextSlot(InterpreterAssembler* assembler);
+
+ // Generates code to load a global.
+ compiler::Node* BuildLoadGlobal(Callable ic, InterpreterAssembler* assembler);
+
+ // Generates code to load a named property.
+ compiler::Node* BuildLoadNamedProperty(Callable ic,
+ InterpreterAssembler* assembler);
+
+ // Generates code to load a keyed property.
+ compiler::Node* BuildLoadKeyedProperty(Callable ic,
+ 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);
+
+ uintptr_t GetDispatchCounter(Bytecode from, Bytecode to) const;
// Get dispatch table index of bytecode.
static size_t GetDispatchTableIndex(Bytecode bytecode,
@@ -138,9 +182,11 @@ class Interpreter {
static const int kNumberOfWideVariants = 3;
static const int kDispatchTableSize = kNumberOfWideVariants * (kMaxUInt8 + 1);
+ static const int kNumberOfBytecodes = static_cast<int>(Bytecode::kLast) + 1;
Isolate* isolate_;
- Code* dispatch_table_[kDispatchTableSize];
+ Address dispatch_table_[kDispatchTableSize];
+ std::unique_ptr<uintptr_t[]> bytecode_dispatch_counters_table_;
DISALLOW_COPY_AND_ASSIGN(Interpreter);
};