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/compiler.h" | 10 #include "src/compiler.h" |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 154 Node* CallIndirect(uint32_t index, Node** args, | 154 Node* CallIndirect(uint32_t index, Node** args, |
| 155 wasm::WasmCodePosition position); | 155 wasm::WasmCodePosition position); |
| 156 void BuildJSToWasmWrapper(Handle<Code> wasm_code, wasm::FunctionSig* sig); | 156 void BuildJSToWasmWrapper(Handle<Code> wasm_code, wasm::FunctionSig* sig); |
| 157 void BuildWasmToJSWrapper(Handle<JSFunction> function, | 157 void BuildWasmToJSWrapper(Handle<JSFunction> function, |
| 158 wasm::FunctionSig* sig); | 158 wasm::FunctionSig* sig); |
| 159 | 159 |
| 160 Node* ToJS(Node* node, Node* context, wasm::LocalType type); | 160 Node* ToJS(Node* node, Node* context, wasm::LocalType type); |
| 161 Node* FromJS(Node* node, Node* context, wasm::LocalType type); | 161 Node* FromJS(Node* node, Node* context, wasm::LocalType type); |
| 162 Node* Invert(Node* node); | 162 Node* Invert(Node* node); |
| 163 Node* FunctionTable(); | 163 Node* FunctionTable(); |
| 164 Node* BuildChangeInt32ToTagged(Node* value); | |
| 165 Node* BuildChangeTaggedToInt32(Node* value); | |
| 166 Node* BuildChangeFloat64ToTagged(Node* value); | |
| 167 Node* BuildChangeTaggedToFloat64(Node* value); | |
|
bbudge
2016/07/06 20:18:08
It's unfortunate we have to perturb this API, give
gdeepti
2016/07/07 04:05:34
Refactored SimdLowering class, ChangeToRuntimeCall
gdeepti
2016/07/08 00:09:25
The last part in my previous comment about the boo
| |
| 164 | 168 |
| 165 //----------------------------------------------------------------------- | 169 //----------------------------------------------------------------------- |
| 166 // Operations that concern the linear memory. | 170 // Operations that concern the linear memory. |
| 167 //----------------------------------------------------------------------- | 171 //----------------------------------------------------------------------- |
| 168 Node* MemSize(uint32_t offset); | 172 Node* MemSize(uint32_t offset); |
| 169 Node* LoadGlobal(uint32_t index); | 173 Node* LoadGlobal(uint32_t index); |
| 170 Node* StoreGlobal(uint32_t index, Node* val); | 174 Node* StoreGlobal(uint32_t index, Node* val); |
| 171 Node* LoadMem(wasm::LocalType type, MachineType memtype, Node* index, | 175 Node* LoadMem(wasm::LocalType type, MachineType memtype, Node* index, |
| 172 uint32_t offset, uint32_t alignment, | 176 uint32_t offset, uint32_t alignment, |
| 173 wasm::WasmCodePosition position); | 177 wasm::WasmCodePosition position); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 185 void set_control_ptr(Node** control) { this->control_ = control; } | 189 void set_control_ptr(Node** control) { this->control_ = control; } |
| 186 | 190 |
| 187 void set_effect_ptr(Node** effect) { this->effect_ = effect; } | 191 void set_effect_ptr(Node** effect) { this->effect_ = effect; } |
| 188 | 192 |
| 189 wasm::FunctionSig* GetFunctionSignature() { return function_signature_; } | 193 wasm::FunctionSig* GetFunctionSignature() { return function_signature_; } |
| 190 | 194 |
| 191 void Int64LoweringForTesting(); | 195 void Int64LoweringForTesting(); |
| 192 | 196 |
| 193 void SetSourcePosition(Node* node, wasm::WasmCodePosition position); | 197 void SetSourcePosition(Node* node, wasm::WasmCodePosition position); |
| 194 | 198 |
| 199 //----------------------------------------------------------------------- | |
| 200 // SIMD operations. | |
| 201 //----------------------------------------------------------------------- | |
| 202 Node* DefaultS128Value(); | |
|
bbudge
2016/07/06 20:18:08
This method logically belongs near Float64Constant
gdeepti
2016/07/07 04:05:34
Moved method, removed SIMD section.
| |
| 203 bool HasSimdOps() { return has_simd_ops_; } | |
|
bbudge
2016/07/06 20:18:08
nit: simple getter style would be has_simd_ops
gdeepti
2016/07/07 04:05:34
Done.
| |
| 204 | |
| 195 private: | 205 private: |
| 196 static const int kDefaultBufferSize = 16; | 206 static const int kDefaultBufferSize = 16; |
| 197 friend class WasmTrapHelper; | 207 friend class WasmTrapHelper; |
| 198 | 208 |
| 199 Zone* zone_; | 209 Zone* zone_; |
| 200 JSGraph* jsgraph_; | 210 JSGraph* jsgraph_; |
| 201 wasm::ModuleEnv* module_; | 211 wasm::ModuleEnv* module_; |
| 202 Node* mem_buffer_; | 212 Node* mem_buffer_; |
| 203 Node* mem_size_; | 213 Node* mem_size_; |
| 204 Node* function_table_; | 214 Node* function_table_; |
| 205 Node** control_; | 215 Node** control_; |
| 206 Node** effect_; | 216 Node** effect_; |
| 207 Node** cur_buffer_; | 217 Node** cur_buffer_; |
| 208 size_t cur_bufsize_; | 218 size_t cur_bufsize_; |
| 209 Node* def_buffer_[kDefaultBufferSize]; | 219 Node* def_buffer_[kDefaultBufferSize]; |
| 210 | 220 |
| 211 WasmTrapHelper* trap_; | 221 WasmTrapHelper* trap_; |
| 212 wasm::FunctionSig* function_signature_; | 222 wasm::FunctionSig* function_signature_; |
| 213 SetOncePointer<const Operator> allocate_heap_number_operator_; | 223 SetOncePointer<const Operator> allocate_heap_number_operator_; |
| 214 | 224 |
| 215 compiler::SourcePositionTable* source_position_table_ = nullptr; | 225 compiler::SourcePositionTable* source_position_table_ = nullptr; |
| 226 bool has_simd_ops_; | |
| 216 | 227 |
| 217 // Internal helper methods. | 228 // Internal helper methods. |
| 218 JSGraph* jsgraph() { return jsgraph_; } | 229 JSGraph* jsgraph() { return jsgraph_; } |
| 219 Graph* graph(); | 230 Graph* graph(); |
| 220 | 231 |
| 221 Node* String(const char* string); | 232 Node* String(const char* string); |
| 222 Node* MemBuffer(uint32_t offset); | 233 Node* MemBuffer(uint32_t offset); |
| 223 void BoundsCheckMem(MachineType memtype, Node* index, uint32_t offset, | 234 void BoundsCheckMem(MachineType memtype, Node* index, uint32_t offset, |
| 224 wasm::WasmCodePosition position); | 235 wasm::WasmCodePosition position); |
| 225 | 236 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 308 Node* BuildI64DivS(Node* left, Node* right, wasm::WasmCodePosition position); | 319 Node* BuildI64DivS(Node* left, Node* right, wasm::WasmCodePosition position); |
| 309 Node* BuildI64RemS(Node* left, Node* right, wasm::WasmCodePosition position); | 320 Node* BuildI64RemS(Node* left, Node* right, wasm::WasmCodePosition position); |
| 310 Node* BuildI64DivU(Node* left, Node* right, wasm::WasmCodePosition position); | 321 Node* BuildI64DivU(Node* left, Node* right, wasm::WasmCodePosition position); |
| 311 Node* BuildI64RemU(Node* left, Node* right, wasm::WasmCodePosition position); | 322 Node* BuildI64RemU(Node* left, Node* right, wasm::WasmCodePosition position); |
| 312 Node* BuildDiv64Call(Node* left, Node* right, ExternalReference ref, | 323 Node* BuildDiv64Call(Node* left, Node* right, ExternalReference ref, |
| 313 MachineType result_type, int trap_zero, | 324 MachineType result_type, int trap_zero, |
| 314 wasm::WasmCodePosition position); | 325 wasm::WasmCodePosition position); |
| 315 | 326 |
| 316 Node* BuildJavaScriptToNumber(Node* node, Node* context, Node* effect, | 327 Node* BuildJavaScriptToNumber(Node* node, Node* context, Node* effect, |
| 317 Node* control); | 328 Node* control); |
| 318 Node* BuildChangeInt32ToTagged(Node* value); | |
| 319 Node* BuildChangeFloat64ToTagged(Node* value); | |
| 320 Node* BuildChangeTaggedToFloat64(Node* value); | |
| 321 | 329 |
| 322 Node* BuildChangeInt32ToSmi(Node* value); | 330 Node* BuildChangeInt32ToSmi(Node* value); |
| 323 Node* BuildChangeSmiToInt32(Node* value); | 331 Node* BuildChangeSmiToInt32(Node* value); |
| 324 Node* BuildChangeUint32ToSmi(Node* value); | 332 Node* BuildChangeUint32ToSmi(Node* value); |
| 325 Node* BuildChangeSmiToFloat64(Node* value); | 333 Node* BuildChangeSmiToFloat64(Node* value); |
| 326 Node* BuildTestNotSmi(Node* value); | 334 Node* BuildTestNotSmi(Node* value); |
| 327 Node* BuildSmiShiftBitsConstant(); | 335 Node* BuildSmiShiftBitsConstant(); |
| 328 | 336 |
| 329 Node* BuildAllocateHeapNumberWithValue(Node* value, Node* control); | 337 Node* BuildAllocateHeapNumberWithValue(Node* value, Node* control); |
| 330 Node* BuildLoadHeapNumberValue(Node* value, Node* control); | 338 Node* BuildLoadHeapNumberValue(Node* value, Node* control); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 341 Node* BuildI32AsmjsDivU(Node* left, Node* right); | 349 Node* BuildI32AsmjsDivU(Node* left, Node* right); |
| 342 Node* BuildI32AsmjsRemU(Node* left, Node* right); | 350 Node* BuildI32AsmjsRemU(Node* left, Node* right); |
| 343 Node* BuildAsmjsLoadMem(MachineType type, Node* index); | 351 Node* BuildAsmjsLoadMem(MachineType type, Node* index); |
| 344 Node* BuildAsmjsStoreMem(MachineType type, Node* index, Node* val); | 352 Node* BuildAsmjsStoreMem(MachineType type, Node* index, Node* val); |
| 345 | 353 |
| 346 Node** Realloc(Node** buffer, size_t old_count, size_t new_count) { | 354 Node** Realloc(Node** buffer, size_t old_count, size_t new_count) { |
| 347 Node** buf = Buffer(new_count); | 355 Node** buf = Buffer(new_count); |
| 348 if (buf != buffer) memcpy(buf, buffer, old_count * sizeof(Node*)); | 356 if (buf != buffer) memcpy(buf, buffer, old_count * sizeof(Node*)); |
| 349 return buf; | 357 return buf; |
| 350 } | 358 } |
| 359 | |
| 360 // Simd helper functions | |
| 361 void SetHasSimdOps(bool has_simd_ops) { has_simd_ops_ = has_simd_ops; } | |
| 351 }; | 362 }; |
| 352 } // namespace compiler | 363 } // namespace compiler |
| 353 } // namespace internal | 364 } // namespace internal |
| 354 } // namespace v8 | 365 } // namespace v8 |
| 355 | 366 |
| 356 #endif // V8_COMPILER_WASM_COMPILER_H_ | 367 #endif // V8_COMPILER_WASM_COMPILER_H_ |
| OLD | NEW |