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