| 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" |
| 11 #include "src/base/smart-pointers.h" | 11 #include "src/base/smart-pointers.h" |
| 12 #include "src/builtins.h" | 12 #include "src/builtins.h" |
| 13 #include "src/frames.h" | 13 #include "src/frames.h" |
| 14 #include "src/interpreter/bytecodes.h" | 14 #include "src/interpreter/bytecodes.h" |
| 15 #include "src/runtime/runtime.h" | 15 #include "src/runtime/runtime.h" |
| 16 #include "src/zone-containers.h" |
| 16 | 17 |
| 17 namespace v8 { | 18 namespace v8 { |
| 18 namespace internal { | 19 namespace internal { |
| 19 | 20 |
| 20 class CallInterfaceDescriptor; | 21 class CallInterfaceDescriptor; |
| 21 class Isolate; | 22 class Isolate; |
| 22 class Zone; | 23 class Zone; |
| 23 | 24 |
| 24 namespace compiler { | 25 namespace compiler { |
| 25 | 26 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 62 |
| 62 // Returns the location in memory of the register |reg_index| in the | 63 // Returns the location in memory of the register |reg_index| in the |
| 63 // interpreter register file. | 64 // interpreter register file. |
| 64 Node* RegisterLocation(Node* reg_index); | 65 Node* RegisterLocation(Node* reg_index); |
| 65 | 66 |
| 66 // Constants. | 67 // Constants. |
| 67 Node* Int32Constant(int value); | 68 Node* Int32Constant(int value); |
| 68 Node* IntPtrConstant(intptr_t value); | 69 Node* IntPtrConstant(intptr_t value); |
| 69 Node* NumberConstant(double value); | 70 Node* NumberConstant(double value); |
| 70 Node* HeapConstant(Handle<HeapObject> object); | 71 Node* HeapConstant(Handle<HeapObject> object); |
| 72 Node* BooleanConstant(bool value); |
| 71 | 73 |
| 72 // Tag and untag Smi values. | 74 // Tag and untag Smi values. |
| 73 Node* SmiTag(Node* value); | 75 Node* SmiTag(Node* value); |
| 74 Node* SmiUntag(Node* value); | 76 Node* SmiUntag(Node* value); |
| 75 | 77 |
| 76 // Basic arithmetic operations. | 78 // Basic arithmetic operations. |
| 77 Node* IntPtrAdd(Node* a, Node* b); | 79 Node* IntPtrAdd(Node* a, Node* b); |
| 78 Node* IntPtrSub(Node* a, Node* b); | 80 Node* IntPtrSub(Node* a, Node* b); |
| 79 Node* WordShl(Node* value, int shift); | 81 Node* WordShl(Node* value, int shift); |
| 80 | 82 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 99 | 101 |
| 100 // Call an IC code stub. | 102 // Call an IC code stub. |
| 101 Node* CallIC(CallInterfaceDescriptor descriptor, Node* target, Node* arg1, | 103 Node* CallIC(CallInterfaceDescriptor descriptor, Node* target, Node* arg1, |
| 102 Node* arg2, Node* arg3, Node* arg4); | 104 Node* arg2, Node* arg3, Node* arg4); |
| 103 Node* CallIC(CallInterfaceDescriptor descriptor, Node* target, Node* arg1, | 105 Node* CallIC(CallInterfaceDescriptor descriptor, Node* target, Node* arg1, |
| 104 Node* arg2, Node* arg3, Node* arg4, Node* arg5); | 106 Node* arg2, Node* arg3, Node* arg4, Node* arg5); |
| 105 | 107 |
| 106 // Call runtime function. | 108 // Call runtime function. |
| 107 Node* CallRuntime(Runtime::FunctionId function_id, Node* arg1, Node* arg2); | 109 Node* CallRuntime(Runtime::FunctionId function_id, Node* arg1, Node* arg2); |
| 108 | 110 |
| 111 // Jump relative to the current bytecode by |jump_offset|. |
| 112 void Jump(Node* jump_offset); |
| 113 |
| 114 // Jump relative to the current bytecode by |jump_offset| if the |
| 115 // word values |lhs| and |rhs| are equal. |
| 116 void JumpIfWordEqual(Node* lhs, Node* rhs, Node* jump_offset); |
| 117 |
| 109 // Returns from the function. | 118 // Returns from the function. |
| 110 void Return(); | 119 void Return(); |
| 111 | 120 |
| 112 // Dispatch to the bytecode. | 121 // Dispatch to the bytecode. |
| 113 void Dispatch(); | 122 void Dispatch(); |
| 114 | 123 |
| 115 protected: | 124 protected: |
| 116 // Close the graph. | 125 // Close the graph. |
| 117 void End(); | 126 void End(); |
| 118 | 127 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 139 Node* BytecodeOperand(int operand_index); | 148 Node* BytecodeOperand(int operand_index); |
| 140 Node* BytecodeOperandSignExtended(int operand_index); | 149 Node* BytecodeOperandSignExtended(int operand_index); |
| 141 | 150 |
| 142 Node* CallIC(CallInterfaceDescriptor descriptor, Node* target, Node** args); | 151 Node* CallIC(CallInterfaceDescriptor descriptor, Node* target, Node** args); |
| 143 Node* CallJSBuiltin(int context_index, Node* receiver, Node** js_args, | 152 Node* CallJSBuiltin(int context_index, Node* receiver, Node** js_args, |
| 144 int js_arg_count); | 153 int js_arg_count); |
| 145 | 154 |
| 146 // Returns BytecodeOffset() advanced by delta bytecodes. Note: this does not | 155 // Returns BytecodeOffset() advanced by delta bytecodes. Note: this does not |
| 147 // update BytecodeOffset() itself. | 156 // update BytecodeOffset() itself. |
| 148 Node* Advance(int delta); | 157 Node* Advance(int delta); |
| 158 Node* Advance(Node* delta); |
| 149 | 159 |
| 150 // Sets the end node of the graph. | 160 // Starts next instruction dispatch at |new_bytecode_offset|. |
| 151 void SetEndInput(Node* input); | 161 void DispatchTo(Node* new_bytecode_offset); |
| 162 |
| 163 // Adds an end node of the graph. |
| 164 void AddEndInput(Node* input); |
| 152 | 165 |
| 153 // Private helpers which delegate to RawMachineAssembler. | 166 // Private helpers which delegate to RawMachineAssembler. |
| 154 Isolate* isolate(); | 167 Isolate* isolate(); |
| 155 Schedule* schedule(); | 168 Schedule* schedule(); |
| 156 Zone* zone(); | 169 Zone* zone(); |
| 157 | 170 |
| 158 interpreter::Bytecode bytecode_; | 171 interpreter::Bytecode bytecode_; |
| 159 base::SmartPointer<RawMachineAssembler> raw_assembler_; | 172 base::SmartPointer<RawMachineAssembler> raw_assembler_; |
| 160 Node* end_node_; | 173 ZoneVector<Node*> end_nodes_; |
| 161 Node* accumulator_; | 174 Node* accumulator_; |
| 162 bool code_generated_; | 175 bool code_generated_; |
| 163 | 176 |
| 164 DISALLOW_COPY_AND_ASSIGN(InterpreterAssembler); | 177 DISALLOW_COPY_AND_ASSIGN(InterpreterAssembler); |
| 165 }; | 178 }; |
| 166 | 179 |
| 167 } // namespace interpreter | 180 } // namespace interpreter |
| 168 } // namespace internal | 181 } // namespace internal |
| 169 } // namespace v8 | 182 } // namespace v8 |
| 170 | 183 |
| 171 #endif // V8_COMPILER_INTERPRETER_ASSEMBLER_H_ | 184 #endif // V8_COMPILER_INTERPRETER_ASSEMBLER_H_ |
| OLD | NEW |