| 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 #include "src/compiler/wasm-compiler.h" | 5 #include "src/compiler/wasm-compiler.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "src/isolate-inl.h" | 9 #include "src/isolate-inl.h" |
| 10 | 10 |
| (...skipping 3092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3103 | 3103 |
| 3104 Node* WasmGraphBuilder::SimdOp(wasm::WasmOpcode opcode, | 3104 Node* WasmGraphBuilder::SimdOp(wasm::WasmOpcode opcode, |
| 3105 const NodeVector& inputs) { | 3105 const NodeVector& inputs) { |
| 3106 switch (opcode) { | 3106 switch (opcode) { |
| 3107 case wasm::kExprI32x4Splat: | 3107 case wasm::kExprI32x4Splat: |
| 3108 return graph()->NewNode(jsgraph()->machine()->CreateInt32x4(), inputs[0], | 3108 return graph()->NewNode(jsgraph()->machine()->CreateInt32x4(), inputs[0], |
| 3109 inputs[0], inputs[0], inputs[0]); | 3109 inputs[0], inputs[0], inputs[0]); |
| 3110 case wasm::kExprI32x4Add: | 3110 case wasm::kExprI32x4Add: |
| 3111 return graph()->NewNode(jsgraph()->machine()->Int32x4Add(), inputs[0], | 3111 return graph()->NewNode(jsgraph()->machine()->Int32x4Add(), inputs[0], |
| 3112 inputs[1]); | 3112 inputs[1]); |
| 3113 case wasm::kExprF32x4ExtractLane: | |
| 3114 return graph()->NewNode(jsgraph()->machine()->Float32x4ExtractLane(), | |
| 3115 inputs[0], inputs[1]); | |
| 3116 case wasm::kExprF32x4Splat: | 3113 case wasm::kExprF32x4Splat: |
| 3117 return graph()->NewNode(jsgraph()->machine()->CreateFloat32x4(), | 3114 return graph()->NewNode(jsgraph()->machine()->CreateFloat32x4(), |
| 3118 inputs[0], inputs[0], inputs[0], inputs[0]); | 3115 inputs[0], inputs[0], inputs[0], inputs[0]); |
| 3119 case wasm::kExprF32x4Add: | 3116 case wasm::kExprF32x4Add: |
| 3120 return graph()->NewNode(jsgraph()->machine()->Float32x4Add(), inputs[0], | 3117 return graph()->NewNode(jsgraph()->machine()->Float32x4Add(), inputs[0], |
| 3121 inputs[1]); | 3118 inputs[1]); |
| 3122 default: | 3119 default: |
| 3123 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); | 3120 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); |
| 3124 } | 3121 } |
| 3125 } | 3122 } |
| 3126 | 3123 |
| 3127 Node* WasmGraphBuilder::SimdExtractLane(wasm::WasmOpcode opcode, uint8_t lane, | 3124 Node* WasmGraphBuilder::SimdExtractLane(wasm::WasmOpcode opcode, uint8_t lane, |
| 3128 Node* input) { | 3125 Node* input) { |
| 3129 switch (opcode) { | 3126 switch (opcode) { |
| 3130 case wasm::kExprI32x4ExtractLane: | 3127 case wasm::kExprI32x4ExtractLane: |
| 3131 return graph()->NewNode(jsgraph()->machine()->Int32x4ExtractLane(), input, | 3128 return graph()->NewNode(jsgraph()->machine()->Int32x4ExtractLane(), input, |
| 3132 Int32Constant(lane)); | 3129 Int32Constant(lane)); |
| 3133 case wasm::kExprF32x4ExtractLane: | 3130 case wasm::kExprF32x4ExtractLane: |
| 3134 return graph()->NewNode(jsgraph()->machine()->Float32x4ExtractLane(), | 3131 return graph()->NewNode(jsgraph()->machine()->Float32x4ExtractLane(), |
| 3135 input, Int32Constant(lane)); | 3132 input, Int32Constant(lane)); |
| 3136 default: | 3133 default: |
| 3137 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); | 3134 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); |
| 3138 } | 3135 } |
| 3139 } | 3136 } |
| 3140 | 3137 |
| 3138 Node* WasmGraphBuilder::SimdReplaceLane(wasm::WasmOpcode opcode, uint8_t lane, |
| 3139 Node* input, Node* replacement) { |
| 3140 switch (opcode) { |
| 3141 case wasm::kExprI32x4ReplaceLane: |
| 3142 return graph()->NewNode(jsgraph()->machine()->Int32x4ReplaceLane(), input, |
| 3143 Int32Constant(lane), replacement); |
| 3144 case wasm::kExprF32x4ReplaceLane: |
| 3145 return graph()->NewNode(jsgraph()->machine()->Float32x4ReplaceLane(), |
| 3146 input, Int32Constant(lane), replacement); |
| 3147 default: |
| 3148 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); |
| 3149 } |
| 3150 } |
| 3151 |
| 3141 static void RecordFunctionCompilation(CodeEventListener::LogEventsAndTags tag, | 3152 static void RecordFunctionCompilation(CodeEventListener::LogEventsAndTags tag, |
| 3142 Isolate* isolate, Handle<Code> code, | 3153 Isolate* isolate, Handle<Code> code, |
| 3143 const char* message, uint32_t index, | 3154 const char* message, uint32_t index, |
| 3144 const wasm::WasmName& module_name, | 3155 const wasm::WasmName& module_name, |
| 3145 const wasm::WasmName& func_name) { | 3156 const wasm::WasmName& func_name) { |
| 3146 DCHECK(isolate->logger()->is_logging_code_events() || | 3157 DCHECK(isolate->logger()->is_logging_code_events() || |
| 3147 isolate->is_profiling()); | 3158 isolate->is_profiling()); |
| 3148 | 3159 |
| 3149 ScopedVector<char> buffer(128); | 3160 ScopedVector<char> buffer(128); |
| 3150 SNPrintF(buffer, "%s#%d:%.*s:%.*s", message, index, module_name.length(), | 3161 SNPrintF(buffer, "%s#%d:%.*s:%.*s", message, index, module_name.length(), |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3489 function_->code_start_offset), | 3500 function_->code_start_offset), |
| 3490 compile_ms); | 3501 compile_ms); |
| 3491 } | 3502 } |
| 3492 | 3503 |
| 3493 return code; | 3504 return code; |
| 3494 } | 3505 } |
| 3495 | 3506 |
| 3496 } // namespace compiler | 3507 } // namespace compiler |
| 3497 } // namespace internal | 3508 } // namespace internal |
| 3498 } // namespace v8 | 3509 } // namespace v8 |
| OLD | NEW |