Chromium Code Reviews| Index: src/compiler/interpreter-assembler.h |
| diff --git a/src/compiler/interpreter-assembler.h b/src/compiler/interpreter-assembler.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8852cf3fa258ee5ace750b65ca13620d5ab943ed |
| --- /dev/null |
| +++ b/src/compiler/interpreter-assembler.h |
| @@ -0,0 +1,98 @@ |
| +// Copyright 2015 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_COMPILER_INTERPRETER_CODEGEN_H_ |
| +#define V8_COMPILER_INTERPRETER_CODEGEN_H_ |
| + |
| +#include "src/interpreter/bytecodes.h" |
|
Michael Starzinger
2015/07/17 13:20:58
Can we add the same comment that is in pipeline.h
rmcilroy
2015/07/21 11:13:21
Done. Also added similar comments for src/interpre
|
| +#include "src/smart-pointers.h" |
| + |
| +namespace v8 { |
| +namespace internal { |
| + |
| +class Isolate; |
| +class Zone; |
| + |
| +namespace compiler { |
| + |
| +class CallDescriptor; |
| +class CommonOperatorBuilder; |
| +class Graph; |
| +class MachineOperatorBuilder; |
| +class Node; |
| +class Operator; |
| +class RawMachineAssembler; |
| +class Schedule; |
| + |
| +class InterpreterAssembler { |
| + public: |
| + InterpreterAssembler(Isolate* isolate, Zone* zone, |
|
Michael Starzinger
2015/07/17 13:20:58
Do you think it makes sense to add unit tests for
rmcilroy
2015/07/21 11:13:21
Yes this probably makes sense, although I'm not ex
|
| + interpreter::Bytecode bytecode); |
| + virtual ~InterpreterAssembler(); |
| + |
| + Handle<Code> GenerateCode(); |
| + |
| + // Constants. |
| + Node* Int32Constant(int value); |
| + Node* NumberConstant(double value); |
| + |
| + // Returns the bytecode argument |index| for the current bytecode. |
| + Node* BytecodeArg(int index); |
| + |
| + // Loads from and stores to the interpreter register file. |
| + Node* LoadRegister(int index); |
| + Node* LoadRegister(Node* index); |
| + void StoreRegister(Node* value, int index); |
| + void StoreRegister(Node* value, Node* index); |
| + |
| + // Function return. |
| + void Return(Node* value); |
| + |
| + // Dispatch to the bytecode. |
| + void Dispatch(); |
| + |
| + // Specifies the parameter number used to thread fixed register data through |
| + // interpreter dispatches. |
| + static const int kBytecodePointerParameter = 0; |
| + static const int kDispatchTablePointerParameter = 1; |
| + |
| + private: |
| + // Returns the pointer to the current bytecode. |
| + Node* BytecodePointer(); |
| + // Returns the pointer to first entry in the interpreter dispatch table. |
| + Node* DispatchTablePointer(); |
| + // Returns the frame pointer for the current function. |
| + Node* FramePointer(); |
| + |
| + // Returns the offset of register |index|. |
| + Node* RegisterFrameOffset(int index); |
| + Node* RegisterFrameOffset(Node* index); |
| + |
| + // Returns BytecodePointer() advanced by delta bytecodes. Note: this does not |
| + // update BytecodePointer() itself. |
| + Node* Advance(int delta); |
| + |
| + // Returns the a call descriptor for interpreter dispatch. |
| + const CallDescriptor* GetCallDiscriptorForDispatch(); |
| + |
| + // Private helpers which delegate to RawMachineAssembler. |
| + Isolate* isolate(); |
| + Graph* graph(); |
| + Schedule* schedule(); |
| + MachineOperatorBuilder* machine(); |
| + CommonOperatorBuilder* common(); |
| + |
| + Zone* zone_; // Not owned. |
| + interpreter::Bytecode bytecode_; |
| + SmartPointer<RawMachineAssembler> raw_assembler_; |
| + bool code_generated_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(InterpreterAssembler); |
| +}; |
| + |
| +} // namespace interpreter |
| +} // namespace internal |
| +} // namespace v8 |
| + |
| +#endif // V8_COMPILER_INTERPRETER_CODEGEN_H_ |