Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef V8_COMPILER_INTERPRETER_CODEGEN_H_ | |
| 6 #define V8_COMPILER_INTERPRETER_CODEGEN_H_ | |
| 7 | |
| 8 // Clients of this interface shouldn't depend on lots of compiler internals. | |
| 9 // Do not include anything from src/compiler here! | |
| 10 #include "src/frames.h" | |
| 11 #include "src/interpreter/bytecodes.h" | |
| 12 #include "src/smart-pointers.h" | |
| 13 | |
| 14 namespace v8 { | |
| 15 namespace internal { | |
| 16 | |
| 17 class Isolate; | |
| 18 class Zone; | |
| 19 | |
| 20 namespace compiler { | |
| 21 | |
| 22 class CallDescriptor; | |
| 23 class CommonOperatorBuilder; | |
| 24 class Graph; | |
| 25 class MachineOperatorBuilder; | |
| 26 class Node; | |
| 27 class Operator; | |
| 28 class RawMachineAssembler; | |
| 29 class Schedule; | |
| 30 | |
| 31 class InterpreterAssembler { | |
| 32 public: | |
| 33 InterpreterAssembler(Isolate* isolate, Zone* zone, | |
| 34 interpreter::Bytecode bytecode); | |
| 35 virtual ~InterpreterAssembler(); | |
| 36 | |
| 37 Handle<Code> GenerateCode(); | |
| 38 | |
| 39 // Constants. | |
| 40 Node* Int32Constant(int value); | |
| 41 Node* NumberConstant(double value); | |
| 42 | |
| 43 // Returns the bytecode argument |index| for the current bytecode. | |
| 44 Node* BytecodeArg(int index); | |
| 45 | |
| 46 // Loads from and stores to the interpreter register file. | |
| 47 Node* LoadRegister(int index); | |
| 48 Node* LoadRegister(Node* index); | |
| 49 void StoreRegister(Node* value, int index); | |
| 50 void StoreRegister(Node* value, Node* index); | |
| 51 | |
| 52 // Dispatch to the bytecode. | |
| 53 void Dispatch(); | |
| 54 | |
| 55 private: | |
| 56 static const int kFirstRegsterOffsetFromFp = | |
| 57 -kPointerSize - StandardFrameConstants::kFixedFrameSizeFromFp; | |
| 58 | |
| 59 // Returns the pointer to the current bytecode. | |
| 60 Node* BytecodePointer(); | |
| 61 // Returns the pointer to first entry in the interpreter dispatch table. | |
| 62 Node* DispatchTablePointer(); | |
| 63 // Returns the frame pointer for the current function. | |
| 64 Node* FramePointer(); | |
| 65 | |
| 66 // Returns the offset of register |index|. | |
| 67 Node* RegisterFrameOffset(int index); | |
| 68 Node* RegisterFrameOffset(Node* index); | |
| 69 | |
| 70 // Returns BytecodePointer() advanced by delta bytecodes. Note: this does not | |
| 71 // update BytecodePointer() itself. | |
| 72 Node* Advance(int delta); | |
| 73 | |
| 74 // Returns the a call descriptor for interpreter dispatch. | |
| 75 const CallDescriptor* GetCallDiscriptorForDispatch(); | |
| 76 | |
| 77 // Private helpers which delegate to RawMachineAssembler. | |
| 78 Isolate* isolate(); | |
| 79 Graph* graph(); | |
| 80 Schedule* schedule(); | |
| 81 MachineOperatorBuilder* machine(); | |
| 82 CommonOperatorBuilder* common(); | |
| 83 | |
| 84 Zone* zone_; // Not owned. | |
|
Michael Starzinger
2015/07/21 13:51:45
nit: Not sure what the "Not owned" comment tries t
rmcilroy
2015/07/23 10:43:54
This is quite common in Chromium code [1] to ident
| |
| 85 interpreter::Bytecode bytecode_; | |
| 86 SmartPointer<RawMachineAssembler> raw_assembler_; | |
| 87 bool code_generated_; | |
| 88 | |
| 89 DISALLOW_COPY_AND_ASSIGN(InterpreterAssembler); | |
| 90 }; | |
| 91 | |
| 92 } // namespace interpreter | |
| 93 } // namespace internal | |
| 94 } // namespace v8 | |
| 95 | |
| 96 #endif // V8_COMPILER_INTERPRETER_CODEGEN_H_ | |
| OLD | NEW |