Chromium Code Reviews| 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_COMPILER_INTERPRETER_CODEGEN_H_ | 5 #ifndef V8_COMPILER_INTERPRETER_CODEGEN_H_ |
|
oth
2015/08/17 10:49:02
Aaron Gray correctly highlighted the need for:
s/I
rmcilroy
2015/08/18 13:06:22
Done.
| |
| 6 #define V8_COMPILER_INTERPRETER_CODEGEN_H_ | 6 #define V8_COMPILER_INTERPRETER_CODEGEN_H_ |
| 7 | 7 |
| 8 // Clients of this interface shouldn't depend on lots of compiler internals. | 8 // Clients of this interface shouldn't depend on lots of compiler internals. |
| 9 // Do not include anything from src/compiler here! | 9 // Do not include anything from src/compiler here! |
| 10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
| 11 #include "src/base/smart-pointers.h" | 11 #include "src/base/smart-pointers.h" |
| 12 #include "src/frames.h" | 12 #include "src/frames.h" |
| 13 #include "src/interpreter/bytecodes.h" | 13 #include "src/interpreter/bytecodes.h" |
| 14 #include "src/unique.h" | 14 #include "src/unique.h" |
| 15 | 15 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 29 class Schedule; | 29 class Schedule; |
| 30 | 30 |
| 31 class InterpreterAssembler { | 31 class InterpreterAssembler { |
| 32 public: | 32 public: |
| 33 InterpreterAssembler(Isolate* isolate, Zone* zone, | 33 InterpreterAssembler(Isolate* isolate, Zone* zone, |
| 34 interpreter::Bytecode bytecode); | 34 interpreter::Bytecode bytecode); |
| 35 virtual ~InterpreterAssembler(); | 35 virtual ~InterpreterAssembler(); |
| 36 | 36 |
| 37 Handle<Code> GenerateCode(); | 37 Handle<Code> GenerateCode(); |
| 38 | 38 |
| 39 // Returns the Imm8 immediate for bytecode operand |index| in the current | |
|
Michael Starzinger
2015/08/17 08:22:34
nit: Comment seems to be outdated, no index is pas
rmcilroy
2015/08/18 13:06:22
Changed parameter and comment to operand_index
| |
| 40 // bytecode. | |
| 41 Node* BytecodeOperandImm8(int delta); | |
| 42 // Returns the register index for bytecode operand |index| in the current | |
| 43 // bytecode. | |
| 44 Node* BytecodeOperandReg(int delta); | |
| 45 | |
| 39 // Accumulator. | 46 // Accumulator. |
| 40 Node* GetAccumulator(); | 47 Node* GetAccumulator(); |
| 41 void SetAccumulator(Node* value); | 48 void SetAccumulator(Node* value); |
| 42 | 49 |
| 43 // Loads from and stores to the interpreter register file. | 50 // Loads from and stores to the interpreter register file. |
| 44 Node* LoadRegister(Node* reg_index); | 51 Node* LoadRegister(Node* reg_index); |
| 45 Node* StoreRegister(Node* value, Node* reg_index); | 52 Node* StoreRegister(Node* value, Node* reg_index); |
| 46 | 53 |
| 47 // Constants. | 54 // Constants. |
| 48 Node* Int32Constant(int value); | 55 Node* Int32Constant(int value); |
| 49 Node* NumberConstant(double value); | 56 Node* NumberConstant(double value); |
| 50 Node* HeapConstant(Unique<HeapObject> object); | 57 Node* HeapConstant(Unique<HeapObject> object); |
| 51 | 58 |
| 59 // Tag and untag Smi values. | |
| 60 Node* SmiTag(Node* value); | |
| 61 Node* SmiUntag(Node* value); | |
| 62 | |
| 52 // Returns from the function. | 63 // Returns from the function. |
| 53 void Return(); | 64 void Return(); |
| 54 | 65 |
| 55 // Dispatch to the bytecode. | 66 // Dispatch to the bytecode. |
| 56 void Dispatch(); | 67 void Dispatch(); |
| 57 | 68 |
| 58 Node* BytecodeOperand(int index); | |
| 59 Node* BytecodeOperandSignExtended(int index); | |
| 60 | |
| 61 protected: | 69 protected: |
| 62 // Close the graph. | 70 // Close the graph. |
| 63 void End(); | 71 void End(); |
| 64 | 72 |
| 65 // Protected helpers (for testing) which delegate to RawMachineAssembler. | 73 // Protected helpers (for testing) which delegate to RawMachineAssembler. |
| 66 CallDescriptor* call_descriptor() const; | 74 CallDescriptor* call_descriptor() const; |
| 67 Graph* graph(); | 75 Graph* graph(); |
| 68 | 76 |
| 69 private: | 77 private: |
| 70 // Returns a raw pointer to start of the register file on the stack. | 78 // Returns a raw pointer to start of the register file on the stack. |
| 71 Node* RegisterFileRawPointer(); | 79 Node* RegisterFileRawPointer(); |
| 72 // Returns a tagged pointer to the current function's BytecodeArray object. | 80 // Returns a tagged pointer to the current function's BytecodeArray object. |
| 73 Node* BytecodeArrayTaggedPointer(); | 81 Node* BytecodeArrayTaggedPointer(); |
| 74 // Returns the offset from the BytecodeArrayPointer of the current bytecode. | 82 // Returns the offset from the BytecodeArrayPointer of the current bytecode. |
| 75 Node* BytecodeOffset(); | 83 Node* BytecodeOffset(); |
| 76 // Returns a pointer to first entry in the interpreter dispatch table. | 84 // Returns a pointer to first entry in the interpreter dispatch table. |
| 77 Node* DispatchTableRawPointer(); | 85 Node* DispatchTableRawPointer(); |
| 78 | 86 |
| 79 // Returns the offset of register |index| relative to RegisterFilePointer(). | 87 // Returns the offset of register |index| relative to RegisterFilePointer(). |
| 80 Node* RegisterFrameOffset(Node* index); | 88 Node* RegisterFrameOffset(Node* index); |
| 81 | 89 |
| 90 Node* SmiShiftBitsConstant(); | |
| 91 Node* BytecodeOperand(int index); | |
| 92 Node* BytecodeOperandSignExtended(int index); | |
| 93 | |
| 82 // Returns BytecodeOffset() advanced by delta bytecodes. Note: this does not | 94 // Returns BytecodeOffset() advanced by delta bytecodes. Note: this does not |
| 83 // update BytecodeOffset() itself. | 95 // update BytecodeOffset() itself. |
| 84 Node* Advance(int delta); | 96 Node* Advance(int delta); |
| 85 | 97 |
| 86 // Sets the end node of the graph. | 98 // Sets the end node of the graph. |
| 87 void SetEndInput(Node* input); | 99 void SetEndInput(Node* input); |
| 88 | 100 |
| 89 // Private helpers which delegate to RawMachineAssembler. | 101 // Private helpers which delegate to RawMachineAssembler. |
| 90 Isolate* isolate(); | 102 Isolate* isolate(); |
| 91 Schedule* schedule(); | 103 Schedule* schedule(); |
| 92 | 104 |
| 93 interpreter::Bytecode bytecode_; | 105 interpreter::Bytecode bytecode_; |
| 94 base::SmartPointer<RawMachineAssembler> raw_assembler_; | 106 base::SmartPointer<RawMachineAssembler> raw_assembler_; |
| 95 Node* end_node_; | 107 Node* end_node_; |
| 96 Node* outgoing_accumulator_; | 108 Node* outgoing_accumulator_; |
| 97 bool code_generated_; | 109 bool code_generated_; |
| 98 | 110 |
| 99 DISALLOW_COPY_AND_ASSIGN(InterpreterAssembler); | 111 DISALLOW_COPY_AND_ASSIGN(InterpreterAssembler); |
| 100 }; | 112 }; |
| 101 | 113 |
| 102 } // namespace interpreter | 114 } // namespace interpreter |
| 103 } // namespace internal | 115 } // namespace internal |
| 104 } // namespace v8 | 116 } // namespace v8 |
| 105 | 117 |
| 106 #endif // V8_COMPILER_INTERPRETER_CODEGEN_H_ | 118 #endif // V8_COMPILER_INTERPRETER_CODEGEN_H_ |
| OLD | NEW |