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