| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_INTERPRETER_INTERPRETER_H_ | 5 #ifndef V8_INTERPRETER_INTERPRETER_H_ |
| 6 #define V8_INTERPRETER_INTERPRETER_H_ | 6 #define V8_INTERPRETER_INTERPRETER_H_ |
| 7 | 7 |
| 8 // Clients of this interface shouldn't depend on lots of interpreter internals. | 8 // Clients of this interface shouldn't depend on lots of interpreter internals. |
| 9 // Do not include anything from src/interpreter other than | 9 // Do not include anything from src/interpreter other than |
| 10 // src/interpreter/bytecodes.h here! | 10 // src/interpreter/bytecodes.h here! |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 class InterpreterAssembler; | 25 class InterpreterAssembler; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace interpreter { | 28 namespace interpreter { |
| 29 | 29 |
| 30 class Interpreter { | 30 class Interpreter { |
| 31 public: | 31 public: |
| 32 explicit Interpreter(Isolate* isolate); | 32 explicit Interpreter(Isolate* isolate); |
| 33 virtual ~Interpreter() {} | 33 virtual ~Interpreter() {} |
| 34 | 34 |
| 35 // Creates an uninitialized interpreter handler table, where each handler | 35 // Initializes the interpreter dispatch table. |
| 36 // points to the Illegal builtin. | |
| 37 static Handle<FixedArray> CreateUninitializedInterpreterTable( | |
| 38 Isolate* isolate); | |
| 39 | |
| 40 // Initializes the interpreter. | |
| 41 void Initialize(); | 36 void Initialize(); |
| 42 | 37 |
| 43 // Generate bytecode for |info|. | 38 // Generate bytecode for |info|. |
| 44 static bool MakeBytecode(CompilationInfo* info); | 39 static bool MakeBytecode(CompilationInfo* info); |
| 45 | 40 |
| 41 // GC support. |
| 42 void IterateDispatchTable(ObjectVisitor* v); |
| 43 |
| 44 Address dispatch_table_address() { |
| 45 return reinterpret_cast<Address>(&dispatch_table_[0]); |
| 46 } |
| 47 |
| 46 private: | 48 private: |
| 47 // Bytecode handler generator functions. | 49 // Bytecode handler generator functions. |
| 48 #define DECLARE_BYTECODE_HANDLER_GENERATOR(Name, ...) \ | 50 #define DECLARE_BYTECODE_HANDLER_GENERATOR(Name, ...) \ |
| 49 void Do##Name(compiler::InterpreterAssembler* assembler); | 51 void Do##Name(compiler::InterpreterAssembler* assembler); |
| 50 BYTECODE_LIST(DECLARE_BYTECODE_HANDLER_GENERATOR) | 52 BYTECODE_LIST(DECLARE_BYTECODE_HANDLER_GENERATOR) |
| 51 #undef DECLARE_BYTECODE_HANDLER_GENERATOR | 53 #undef DECLARE_BYTECODE_HANDLER_GENERATOR |
| 52 | 54 |
| 53 // Generates code to perform the binary operations via |function_id|. | 55 // Generates code to perform the binary operations via |function_id|. |
| 54 void DoBinaryOp(Runtime::FunctionId function_id, | 56 void DoBinaryOp(Runtime::FunctionId function_id, |
| 55 compiler::InterpreterAssembler* assembler); | 57 compiler::InterpreterAssembler* assembler); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 compiler::InterpreterAssembler* assembler); | 110 compiler::InterpreterAssembler* assembler); |
| 109 | 111 |
| 110 // Generates code to perform a lookup slot load via |function_id|. | 112 // Generates code to perform a lookup slot load via |function_id|. |
| 111 void DoLoadLookupSlot(Runtime::FunctionId function_id, | 113 void DoLoadLookupSlot(Runtime::FunctionId function_id, |
| 112 compiler::InterpreterAssembler* assembler); | 114 compiler::InterpreterAssembler* assembler); |
| 113 | 115 |
| 114 // Generates code to perform a lookup slot store depending on |language_mode|. | 116 // Generates code to perform a lookup slot store depending on |language_mode|. |
| 115 void DoStoreLookupSlot(LanguageMode language_mode, | 117 void DoStoreLookupSlot(LanguageMode language_mode, |
| 116 compiler::InterpreterAssembler* assembler); | 118 compiler::InterpreterAssembler* assembler); |
| 117 | 119 |
| 118 bool IsInterpreterTableInitialized(Handle<FixedArray> handler_table); | 120 bool IsDispatchTableInitialized(); |
| 121 |
| 122 static const int kDispatchTableSize = static_cast<int>(Bytecode::kLast) + 1; |
| 119 | 123 |
| 120 Isolate* isolate_; | 124 Isolate* isolate_; |
| 125 Object* dispatch_table_[kDispatchTableSize]; |
| 121 | 126 |
| 122 DISALLOW_COPY_AND_ASSIGN(Interpreter); | 127 DISALLOW_COPY_AND_ASSIGN(Interpreter); |
| 123 }; | 128 }; |
| 124 | 129 |
| 125 } // namespace interpreter | 130 } // namespace interpreter |
| 126 } // namespace internal | 131 } // namespace internal |
| 127 } // namespace v8 | 132 } // namespace v8 |
| 128 | 133 |
| 129 #endif // V8_INTERPRETER_INTERPRETER_H_ | 134 #endif // V8_INTERPRETER_INTERPRETER_H_ |
| OLD | NEW |