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_ASSEMBLER_H_ | 5 #ifndef V8_COMPILER_INTERPRETER_ASSEMBLER_H_ |
6 #define V8_COMPILER_INTERPRETER_ASSEMBLER_H_ | 6 #define V8_COMPILER_INTERPRETER_ASSEMBLER_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" |
(...skipping 19 matching lines...) Expand all Loading... |
30 class Schedule; | 30 class Schedule; |
31 | 31 |
32 class InterpreterAssembler { | 32 class InterpreterAssembler { |
33 public: | 33 public: |
34 InterpreterAssembler(Isolate* isolate, Zone* zone, | 34 InterpreterAssembler(Isolate* isolate, Zone* zone, |
35 interpreter::Bytecode bytecode); | 35 interpreter::Bytecode bytecode); |
36 virtual ~InterpreterAssembler(); | 36 virtual ~InterpreterAssembler(); |
37 | 37 |
38 Handle<Code> GenerateCode(); | 38 Handle<Code> GenerateCode(); |
39 | 39 |
40 // Returns the Idx immediate for bytecode operand |operand_index| in the | 40 // Returns the count immediate for bytecode operand |operand_index| in the |
| 41 // current bytecode. |
| 42 Node* BytecodeOperandCount(int operand_index); |
| 43 // Returns the index immediate for bytecode operand |operand_index| in the |
41 // current bytecode. | 44 // current bytecode. |
42 Node* BytecodeOperandIdx(int operand_index); | 45 Node* BytecodeOperandIdx(int operand_index); |
43 // Returns the Imm8 immediate for bytecode operand |operand_index| in the | 46 // Returns the Imm8 immediate for bytecode operand |operand_index| in the |
44 // current bytecode. | 47 // current bytecode. |
45 Node* BytecodeOperandImm8(int operand_index); | 48 Node* BytecodeOperandImm8(int operand_index); |
46 // Returns the register index for bytecode operand |operand_index| in the | 49 // Returns the register index for bytecode operand |operand_index| in the |
47 // current bytecode. | 50 // current bytecode. |
48 Node* BytecodeOperandReg(int operand_index); | 51 Node* BytecodeOperandReg(int operand_index); |
49 | 52 |
50 // Accumulator. | 53 // Accumulator. |
51 Node* GetAccumulator(); | 54 Node* GetAccumulator(); |
52 void SetAccumulator(Node* value); | 55 void SetAccumulator(Node* value); |
53 | 56 |
54 // Loads from and stores to the interpreter register file. | 57 // Loads from and stores to the interpreter register file. |
55 Node* LoadRegister(Node* reg_index); | 58 Node* LoadRegister(Node* reg_index); |
56 Node* StoreRegister(Node* value, Node* reg_index); | 59 Node* StoreRegister(Node* value, Node* reg_index); |
57 | 60 |
| 61 // Returns the location in memory of the register |reg_index| in the |
| 62 // interpreter register file. |
| 63 Node* RegisterLocation(Node* reg_index); |
| 64 |
58 // Constants. | 65 // Constants. |
59 Node* Int32Constant(int value); | 66 Node* Int32Constant(int value); |
60 Node* IntPtrConstant(intptr_t value); | 67 Node* IntPtrConstant(intptr_t value); |
61 Node* NumberConstant(double value); | 68 Node* NumberConstant(double value); |
62 Node* HeapConstant(Handle<HeapObject> object); | 69 Node* HeapConstant(Handle<HeapObject> object); |
63 | 70 |
64 // Tag and untag Smi values. | 71 // Tag and untag Smi values. |
65 Node* SmiTag(Node* value); | 72 Node* SmiTag(Node* value); |
66 Node* SmiUntag(Node* value); | 73 Node* SmiUntag(Node* value); |
67 | 74 |
| 75 // Basic arithmetic operations. |
| 76 Node* IntPtrAdd(Node* a, Node* b); |
| 77 Node* IntPtrSub(Node* a, Node* b); |
| 78 Node* WordShl(Node* value, int shift); |
| 79 |
68 // Load constant at |index| in the constant pool. | 80 // Load constant at |index| in the constant pool. |
69 Node* LoadConstantPoolEntry(Node* index); | 81 Node* LoadConstantPoolEntry(Node* index); |
70 | 82 |
71 // Load a field from an object on the heap. | 83 // Load a field from an object on the heap. |
72 Node* LoadObjectField(Node* object, int offset); | 84 Node* LoadObjectField(Node* object, int offset); |
73 | 85 |
74 // Load |slot_index| from a context. | 86 // Load |slot_index| from a context. |
75 Node* LoadContextSlot(Node* context, int slot_index); | 87 Node* LoadContextSlot(Node* context, int slot_index); |
76 | 88 |
77 // Load |slot_index| from the current context. | 89 // Load |slot_index| from the current context. |
78 Node* LoadContextSlot(int slot_index); | 90 Node* LoadContextSlot(int slot_index); |
79 | 91 |
80 // Load the TypeFeedbackVector for the current function. | 92 // Load the TypeFeedbackVector for the current function. |
81 Node* LoadTypeFeedbackVector(); | 93 Node* LoadTypeFeedbackVector(); |
82 | 94 |
| 95 // Call a JS function. |
| 96 Node* CallJS(Node* function, Node* first_arg, Node* last_arg); |
| 97 |
83 // Call an IC code stub. | 98 // Call an IC code stub. |
84 Node* CallIC(CallInterfaceDescriptor descriptor, Node* target, Node* arg1, | 99 Node* CallIC(CallInterfaceDescriptor descriptor, Node* target, Node* arg1, |
85 Node* arg2, Node* arg3, Node* arg4); | 100 Node* arg2, Node* arg3, Node* arg4); |
86 | 101 |
87 // Call JS builtin. | 102 // Call JS builtin. |
88 Node* CallJSBuiltin(int context_index, Node* receiver); | 103 Node* CallJSBuiltin(int context_index, Node* receiver); |
89 Node* CallJSBuiltin(int context_index, Node* receiver, Node* arg1); | 104 Node* CallJSBuiltin(int context_index, Node* receiver, Node* arg1); |
90 | 105 |
91 // Returns from the function. | 106 // Returns from the function. |
92 void Return(); | 107 void Return(); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 bool code_generated_; | 158 bool code_generated_; |
144 | 159 |
145 DISALLOW_COPY_AND_ASSIGN(InterpreterAssembler); | 160 DISALLOW_COPY_AND_ASSIGN(InterpreterAssembler); |
146 }; | 161 }; |
147 | 162 |
148 } // namespace interpreter | 163 } // namespace interpreter |
149 } // namespace internal | 164 } // namespace internal |
150 } // namespace v8 | 165 } // namespace v8 |
151 | 166 |
152 #endif // V8_COMPILER_INTERPRETER_ASSEMBLER_H_ | 167 #endif // V8_COMPILER_INTERPRETER_ASSEMBLER_H_ |
OLD | NEW |