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