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 JSFunction or Callable |function| with |arg_count| (not including |
| 96 // receiver) and the first argument located at |first_arg|. |
| 97 Node* CallJS(Node* function, Node* first_arg, Node* arg_count); |
| 98 |
83 // Call an IC code stub. | 99 // Call an IC code stub. |
84 Node* CallIC(CallInterfaceDescriptor descriptor, Node* target, Node* arg1, | 100 Node* CallIC(CallInterfaceDescriptor descriptor, Node* target, Node* arg1, |
85 Node* arg2, Node* arg3, Node* arg4); | 101 Node* arg2, Node* arg3, Node* arg4); |
86 Node* CallIC(CallInterfaceDescriptor descriptor, Node* target, Node* arg1, | 102 Node* CallIC(CallInterfaceDescriptor descriptor, Node* target, Node* arg1, |
87 Node* arg2, Node* arg3, Node* arg4, Node* arg5); | 103 Node* arg2, Node* arg3, Node* arg4, Node* arg5); |
88 | 104 |
89 // Call JS builtin. | 105 // Call JS builtin. |
90 Node* CallJSBuiltin(int context_index, Node* receiver); | 106 Node* CallJSBuiltin(int context_index, Node* receiver); |
91 Node* CallJSBuiltin(int context_index, Node* receiver, Node* arg1); | 107 Node* CallJSBuiltin(int context_index, Node* receiver, Node* arg1); |
92 | 108 |
(...skipping 53 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 |