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_WASM_COMPILER_H_ | 5 #ifndef V8_COMPILER_WASM_COMPILER_H_ |
| 6 #define V8_COMPILER_WASM_COMPILER_H_ | 6 #define V8_COMPILER_WASM_COMPILER_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/wasm/wasm-opcodes.h" | 10 #include "src/wasm/wasm-opcodes.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 126 Node* CallIndirect(uint32_t index, Node** args, | 126 Node* CallIndirect(uint32_t index, Node** args, |
| 127 wasm::WasmCodePosition position); | 127 wasm::WasmCodePosition position); |
| 128 void BuildJSToWasmWrapper(Handle<Code> wasm_code, wasm::FunctionSig* sig); | 128 void BuildJSToWasmWrapper(Handle<Code> wasm_code, wasm::FunctionSig* sig); |
| 129 void BuildWasmToJSWrapper(Handle<JSFunction> function, | 129 void BuildWasmToJSWrapper(Handle<JSFunction> function, |
| 130 wasm::FunctionSig* sig); | 130 wasm::FunctionSig* sig); |
| 131 | 131 |
| 132 Node* ToJS(Node* node, Node* context, wasm::LocalType type); | 132 Node* ToJS(Node* node, Node* context, wasm::LocalType type); |
| 133 Node* FromJS(Node* node, Node* context, wasm::LocalType type); | 133 Node* FromJS(Node* node, Node* context, wasm::LocalType type); |
| 134 Node* Invert(Node* node); | 134 Node* Invert(Node* node); |
| 135 Node* FunctionTable(); | 135 Node* FunctionTable(); |
| 136 Node* BuildChangeInt32ToTagged(Node* value); | |
| 137 Node* BuildChangeTaggedToInt32(Node* value); | |
| 138 Node* BuildChangeFloat64ToTagged(Node* value); | |
| 139 Node* BuildChangeTaggedToFloat64(Node* value); | |
| 136 | 140 |
| 137 //----------------------------------------------------------------------- | 141 //----------------------------------------------------------------------- |
| 138 // Operations that concern the linear memory. | 142 // Operations that concern the linear memory. |
| 139 //----------------------------------------------------------------------- | 143 //----------------------------------------------------------------------- |
| 140 Node* MemSize(uint32_t offset); | 144 Node* MemSize(uint32_t offset); |
| 141 Node* LoadGlobal(uint32_t index); | 145 Node* LoadGlobal(uint32_t index); |
| 142 Node* StoreGlobal(uint32_t index, Node* val); | 146 Node* StoreGlobal(uint32_t index, Node* val); |
| 143 Node* LoadMem(wasm::LocalType type, MachineType memtype, Node* index, | 147 Node* LoadMem(wasm::LocalType type, MachineType memtype, Node* index, |
| 144 uint32_t offset, wasm::WasmCodePosition position); | 148 uint32_t offset, wasm::WasmCodePosition position); |
| 145 Node* StoreMem(MachineType type, Node* index, uint32_t offset, Node* val, | 149 Node* StoreMem(MachineType type, Node* index, uint32_t offset, Node* val, |
| 146 wasm::WasmCodePosition position); | 150 wasm::WasmCodePosition position); |
| 147 | 151 |
| 148 static void PrintDebugName(Node* node); | 152 static void PrintDebugName(Node* node); |
| 149 | 153 |
| 150 Node* Control() { return *control_; } | 154 Node* Control() { return *control_; } |
| 151 Node* Effect() { return *effect_; } | 155 Node* Effect() { return *effect_; } |
| 152 | 156 |
| 153 void set_module(wasm::ModuleEnv* module) { this->module_ = module; } | 157 void set_module(wasm::ModuleEnv* module) { this->module_ = module; } |
| 154 | 158 |
| 155 void set_control_ptr(Node** control) { this->control_ = control; } | 159 void set_control_ptr(Node** control) { this->control_ = control; } |
| 156 | 160 |
| 157 void set_effect_ptr(Node** effect) { this->effect_ = effect; } | 161 void set_effect_ptr(Node** effect) { this->effect_ = effect; } |
| 158 | 162 |
| 159 wasm::FunctionSig* GetFunctionSignature() { return function_signature_; } | 163 wasm::FunctionSig* GetFunctionSignature() { return function_signature_; } |
| 160 | 164 |
| 161 void Int64LoweringForTesting(); | 165 void Int64LoweringForTesting(); |
| 162 | 166 |
| 163 void SetSourcePosition(Node* node, wasm::WasmCodePosition position); | 167 void SetSourcePosition(Node* node, wasm::WasmCodePosition position); |
| 164 | 168 |
| 169 //----------------------------------------------------------------------- | |
| 170 // SIMD operations. | |
| 171 //----------------------------------------------------------------------- | |
| 172 Node* DefaultS128Value(); | |
| 173 void set_is_simd_function(bool simd) { this->is_simd_function_ = simd; } | |
|
titzer
2016/05/19 09:43:27
I think this should be "has simd ops" and should b
gdeepti
2016/07/01 22:24:48
Changed to HasSimdOps, and is now only set interna
| |
| 174 bool is_simd_function() { return is_simd_function_; } | |
| 175 | |
| 165 private: | 176 private: |
| 166 static const int kDefaultBufferSize = 16; | 177 static const int kDefaultBufferSize = 16; |
| 167 friend class WasmTrapHelper; | 178 friend class WasmTrapHelper; |
| 168 | 179 |
| 169 Zone* zone_; | 180 Zone* zone_; |
| 170 JSGraph* jsgraph_; | 181 JSGraph* jsgraph_; |
| 171 wasm::ModuleEnv* module_; | 182 wasm::ModuleEnv* module_; |
| 172 Node* mem_buffer_; | 183 Node* mem_buffer_; |
| 173 Node* mem_size_; | 184 Node* mem_size_; |
| 174 Node* function_table_; | 185 Node* function_table_; |
| 175 Node** control_; | 186 Node** control_; |
| 176 Node** effect_; | 187 Node** effect_; |
| 177 Node** cur_buffer_; | 188 Node** cur_buffer_; |
| 178 size_t cur_bufsize_; | 189 size_t cur_bufsize_; |
| 179 Node* def_buffer_[kDefaultBufferSize]; | 190 Node* def_buffer_[kDefaultBufferSize]; |
| 180 | 191 |
| 181 WasmTrapHelper* trap_; | 192 WasmTrapHelper* trap_; |
| 182 wasm::FunctionSig* function_signature_; | 193 wasm::FunctionSig* function_signature_; |
| 194 bool is_simd_function_; | |
| 183 SetOncePointer<const Operator> allocate_heap_number_operator_; | 195 SetOncePointer<const Operator> allocate_heap_number_operator_; |
| 184 | 196 |
| 185 compiler::SourcePositionTable* source_position_table_ = nullptr; | 197 compiler::SourcePositionTable* source_position_table_ = nullptr; |
| 186 | 198 |
| 187 // Internal helper methods. | 199 // Internal helper methods. |
| 188 JSGraph* jsgraph() { return jsgraph_; } | 200 JSGraph* jsgraph() { return jsgraph_; } |
| 189 Graph* graph(); | 201 Graph* graph(); |
| 190 | 202 |
| 191 Node* String(const char* string); | 203 Node* String(const char* string); |
| 192 Node* MemBuffer(uint32_t offset); | 204 Node* MemBuffer(uint32_t offset); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 270 Node* BuildI64DivS(Node* left, Node* right, wasm::WasmCodePosition position); | 282 Node* BuildI64DivS(Node* left, Node* right, wasm::WasmCodePosition position); |
| 271 Node* BuildI64RemS(Node* left, Node* right, wasm::WasmCodePosition position); | 283 Node* BuildI64RemS(Node* left, Node* right, wasm::WasmCodePosition position); |
| 272 Node* BuildI64DivU(Node* left, Node* right, wasm::WasmCodePosition position); | 284 Node* BuildI64DivU(Node* left, Node* right, wasm::WasmCodePosition position); |
| 273 Node* BuildI64RemU(Node* left, Node* right, wasm::WasmCodePosition position); | 285 Node* BuildI64RemU(Node* left, Node* right, wasm::WasmCodePosition position); |
| 274 Node* BuildDiv64Call(Node* left, Node* right, ExternalReference ref, | 286 Node* BuildDiv64Call(Node* left, Node* right, ExternalReference ref, |
| 275 MachineType result_type, int trap_zero, | 287 MachineType result_type, int trap_zero, |
| 276 wasm::WasmCodePosition position); | 288 wasm::WasmCodePosition position); |
| 277 | 289 |
| 278 Node* BuildJavaScriptToNumber(Node* node, Node* context, Node* effect, | 290 Node* BuildJavaScriptToNumber(Node* node, Node* context, Node* effect, |
| 279 Node* control); | 291 Node* control); |
| 280 Node* BuildChangeInt32ToTagged(Node* value); | |
| 281 Node* BuildChangeFloat64ToTagged(Node* value); | |
| 282 Node* BuildChangeTaggedToFloat64(Node* value); | |
| 283 | 292 |
| 284 Node* BuildChangeInt32ToSmi(Node* value); | 293 Node* BuildChangeInt32ToSmi(Node* value); |
| 285 Node* BuildChangeSmiToInt32(Node* value); | 294 Node* BuildChangeSmiToInt32(Node* value); |
| 286 Node* BuildChangeSmiToFloat64(Node* value); | 295 Node* BuildChangeSmiToFloat64(Node* value); |
| 287 Node* BuildTestNotSmi(Node* value); | 296 Node* BuildTestNotSmi(Node* value); |
| 288 Node* BuildSmiShiftBitsConstant(); | 297 Node* BuildSmiShiftBitsConstant(); |
| 289 | 298 |
| 290 Node* BuildAllocateHeapNumberWithValue(Node* value, Node* control); | 299 Node* BuildAllocateHeapNumberWithValue(Node* value, Node* control); |
| 291 Node* BuildLoadHeapNumberValue(Node* value, Node* control); | 300 Node* BuildLoadHeapNumberValue(Node* value, Node* control); |
| 292 Node* BuildHeapNumberValueIndexConstant(); | 301 Node* BuildHeapNumberValueIndexConstant(); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 307 Node** buf = Buffer(new_count); | 316 Node** buf = Buffer(new_count); |
| 308 if (buf != buffer) memcpy(buf, buffer, old_count * sizeof(Node*)); | 317 if (buf != buffer) memcpy(buf, buffer, old_count * sizeof(Node*)); |
| 309 return buf; | 318 return buf; |
| 310 } | 319 } |
| 311 }; | 320 }; |
| 312 } // namespace compiler | 321 } // namespace compiler |
| 313 } // namespace internal | 322 } // namespace internal |
| 314 } // namespace v8 | 323 } // namespace v8 |
| 315 | 324 |
| 316 #endif // V8_COMPILER_WASM_COMPILER_H_ | 325 #endif // V8_COMPILER_WASM_COMPILER_H_ |
| OLD | NEW |