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 3089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3100 Int32Constant(value), Int32Constant(value), | 3100 Int32Constant(value), Int32Constant(value), |
3101 Int32Constant(value), Int32Constant(value)); | 3101 Int32Constant(value), Int32Constant(value)); |
3102 } | 3102 } |
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::kExprI32x4ExtractLane: |
| 3111 return graph()->NewNode(jsgraph()->machine()->Int32x4ExtractLane(), |
| 3112 inputs[0], inputs[1]); |
| 3113 case wasm::kExprI32x4ReplaceLane: |
| 3114 return graph()->NewNode(jsgraph()->machine()->Int32x4ReplaceLane(), |
| 3115 inputs[0], inputs[1], inputs[2]); |
3110 case wasm::kExprI32x4Add: | 3116 case wasm::kExprI32x4Add: |
3111 return graph()->NewNode(jsgraph()->machine()->Int32x4Add(), inputs[0], | 3117 return graph()->NewNode(jsgraph()->machine()->Int32x4Add(), inputs[0], |
3112 inputs[1]); | 3118 inputs[1]); |
| 3119 case wasm::kExprI32x4Sub: |
| 3120 return graph()->NewNode(jsgraph()->machine()->Int32x4Sub(), inputs[0], |
| 3121 inputs[1]); |
| 3122 case wasm::kExprF32x4Splat: |
| 3123 return graph()->NewNode(jsgraph()->machine()->CreateFloat32x4(), |
| 3124 inputs[0], inputs[0], inputs[0], inputs[0]); |
3113 case wasm::kExprF32x4ExtractLane: | 3125 case wasm::kExprF32x4ExtractLane: |
3114 return graph()->NewNode(jsgraph()->machine()->Float32x4ExtractLane(), | 3126 return graph()->NewNode(jsgraph()->machine()->Float32x4ExtractLane(), |
3115 inputs[0], inputs[1]); | 3127 inputs[0], inputs[1]); |
3116 case wasm::kExprF32x4Splat: | |
3117 return graph()->NewNode(jsgraph()->machine()->CreateFloat32x4(), | |
3118 inputs[0], inputs[0], inputs[0], inputs[0]); | |
3119 case wasm::kExprF32x4Add: | 3128 case wasm::kExprF32x4Add: |
3120 return graph()->NewNode(jsgraph()->machine()->Float32x4Add(), inputs[0], | 3129 return graph()->NewNode(jsgraph()->machine()->Float32x4Add(), inputs[0], |
3121 inputs[1]); | 3130 inputs[1]); |
3122 default: | 3131 default: |
3123 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); | 3132 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); |
3124 } | 3133 } |
3125 } | 3134 } |
3126 | 3135 |
3127 Node* WasmGraphBuilder::SimdExtractLane(wasm::WasmOpcode opcode, uint8_t lane, | |
3128 Node* input) { | |
3129 switch (opcode) { | |
3130 case wasm::kExprI32x4ExtractLane: | |
3131 return graph()->NewNode(jsgraph()->machine()->Int32x4ExtractLane(), input, | |
3132 Int32Constant(lane)); | |
3133 case wasm::kExprF32x4ExtractLane: | |
3134 return graph()->NewNode(jsgraph()->machine()->Float32x4ExtractLane(), | |
3135 input, Int32Constant(lane)); | |
3136 default: | |
3137 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); | |
3138 } | |
3139 } | |
3140 | |
3141 static void RecordFunctionCompilation(CodeEventListener::LogEventsAndTags tag, | 3136 static void RecordFunctionCompilation(CodeEventListener::LogEventsAndTags tag, |
3142 Isolate* isolate, Handle<Code> code, | 3137 Isolate* isolate, Handle<Code> code, |
3143 const char* message, uint32_t index, | 3138 const char* message, uint32_t index, |
3144 const wasm::WasmName& module_name, | 3139 const wasm::WasmName& module_name, |
3145 const wasm::WasmName& func_name) { | 3140 const wasm::WasmName& func_name) { |
3146 DCHECK(isolate->logger()->is_logging_code_events() || | 3141 DCHECK(isolate->logger()->is_logging_code_events() || |
3147 isolate->is_profiling()); | 3142 isolate->is_profiling()); |
3148 | 3143 |
3149 ScopedVector<char> buffer(128); | 3144 ScopedVector<char> buffer(128); |
3150 SNPrintF(buffer, "%s#%d:%.*s:%.*s", message, index, module_name.length(), | 3145 SNPrintF(buffer, "%s#%d:%.*s:%.*s", message, index, module_name.length(), |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3491 function_->code_start_offset), | 3486 function_->code_start_offset), |
3492 compile_ms); | 3487 compile_ms); |
3493 } | 3488 } |
3494 | 3489 |
3495 return code; | 3490 return code; |
3496 } | 3491 } |
3497 | 3492 |
3498 } // namespace compiler | 3493 } // namespace compiler |
3499 } // namespace internal | 3494 } // namespace internal |
3500 } // namespace v8 | 3495 } // namespace v8 |
OLD | NEW |