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 3106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3117 | 3117 |
3118 Node* WasmGraphBuilder::SimdOp(wasm::WasmOpcode opcode, | 3118 Node* WasmGraphBuilder::SimdOp(wasm::WasmOpcode opcode, |
3119 const NodeVector& inputs) { | 3119 const NodeVector& inputs) { |
3120 switch (opcode) { | 3120 switch (opcode) { |
3121 case wasm::kExprI32x4Splat: | 3121 case wasm::kExprI32x4Splat: |
3122 return graph()->NewNode(jsgraph()->machine()->CreateInt32x4(), inputs[0], | 3122 return graph()->NewNode(jsgraph()->machine()->CreateInt32x4(), inputs[0], |
3123 inputs[0], inputs[0], inputs[0]); | 3123 inputs[0], inputs[0], inputs[0]); |
3124 case wasm::kExprI32x4Add: | 3124 case wasm::kExprI32x4Add: |
3125 return graph()->NewNode(jsgraph()->machine()->Int32x4Add(), inputs[0], | 3125 return graph()->NewNode(jsgraph()->machine()->Int32x4Add(), inputs[0], |
3126 inputs[1]); | 3126 inputs[1]); |
3127 case wasm::kExprF32x4ExtractLane: | |
3128 return graph()->NewNode(jsgraph()->machine()->Float32x4ExtractLane(), | |
3129 inputs[0], inputs[1]); | |
3130 case wasm::kExprF32x4Splat: | 3127 case wasm::kExprF32x4Splat: |
3131 return graph()->NewNode(jsgraph()->machine()->CreateFloat32x4(), | 3128 return graph()->NewNode(jsgraph()->machine()->CreateFloat32x4(), |
3132 inputs[0], inputs[0], inputs[0], inputs[0]); | 3129 inputs[0], inputs[0], inputs[0], inputs[0]); |
3133 case wasm::kExprF32x4Add: | 3130 case wasm::kExprF32x4Add: |
3134 return graph()->NewNode(jsgraph()->machine()->Float32x4Add(), inputs[0], | 3131 return graph()->NewNode(jsgraph()->machine()->Float32x4Add(), inputs[0], |
3135 inputs[1]); | 3132 inputs[1]); |
3136 default: | 3133 default: |
3137 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); | 3134 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); |
3138 } | 3135 } |
3139 } | 3136 } |
3140 | 3137 |
3141 Node* WasmGraphBuilder::SimdExtractLane(wasm::WasmOpcode opcode, uint8_t lane, | 3138 Node* WasmGraphBuilder::SimdExtractLane(wasm::WasmOpcode opcode, uint8_t lane, |
3142 Node* input) { | 3139 Node* input) { |
3143 switch (opcode) { | 3140 switch (opcode) { |
3144 case wasm::kExprI32x4ExtractLane: | 3141 case wasm::kExprI32x4ExtractLane: |
3145 return graph()->NewNode(jsgraph()->machine()->Int32x4ExtractLane(), input, | 3142 return graph()->NewNode(jsgraph()->machine()->Int32x4ExtractLane(), input, |
3146 Int32Constant(lane)); | 3143 Int32Constant(lane)); |
3147 case wasm::kExprF32x4ExtractLane: | 3144 case wasm::kExprF32x4ExtractLane: |
3148 return graph()->NewNode(jsgraph()->machine()->Float32x4ExtractLane(), | 3145 return graph()->NewNode(jsgraph()->machine()->Float32x4ExtractLane(), |
3149 input, Int32Constant(lane)); | 3146 input, Int32Constant(lane)); |
3150 default: | 3147 default: |
3151 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); | 3148 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); |
3152 } | 3149 } |
3153 } | 3150 } |
3154 | 3151 |
| 3152 Node* WasmGraphBuilder::SimdReplaceLane(wasm::WasmOpcode opcode, uint8_t lane, |
| 3153 Node* input, Node* replacement) { |
| 3154 switch (opcode) { |
| 3155 case wasm::kExprI32x4ReplaceLane: |
| 3156 return graph()->NewNode(jsgraph()->machine()->Int32x4ReplaceLane(), input, |
| 3157 Int32Constant(lane), replacement); |
| 3158 case wasm::kExprF32x4ReplaceLane: |
| 3159 return graph()->NewNode(jsgraph()->machine()->Float32x4ReplaceLane(), |
| 3160 input, Int32Constant(lane), replacement); |
| 3161 default: |
| 3162 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); |
| 3163 } |
| 3164 } |
| 3165 |
3155 static void RecordFunctionCompilation(CodeEventListener::LogEventsAndTags tag, | 3166 static void RecordFunctionCompilation(CodeEventListener::LogEventsAndTags tag, |
3156 Isolate* isolate, Handle<Code> code, | 3167 Isolate* isolate, Handle<Code> code, |
3157 const char* message, uint32_t index, | 3168 const char* message, uint32_t index, |
3158 const wasm::WasmName& module_name, | 3169 const wasm::WasmName& module_name, |
3159 const wasm::WasmName& func_name) { | 3170 const wasm::WasmName& func_name) { |
3160 DCHECK(isolate->logger()->is_logging_code_events() || | 3171 DCHECK(isolate->logger()->is_logging_code_events() || |
3161 isolate->is_profiling()); | 3172 isolate->is_profiling()); |
3162 | 3173 |
3163 ScopedVector<char> buffer(128); | 3174 ScopedVector<char> buffer(128); |
3164 SNPrintF(buffer, "%s#%d:%.*s:%.*s", message, index, module_name.length(), | 3175 SNPrintF(buffer, "%s#%d:%.*s:%.*s", message, index, module_name.length(), |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3529 Smi::FromInt(instruction.instr_offset)); | 3540 Smi::FromInt(instruction.instr_offset)); |
3530 fn_protected->set(Code::kTrapDataSize * i + Code::kTrapLandingOffset, | 3541 fn_protected->set(Code::kTrapDataSize * i + Code::kTrapLandingOffset, |
3531 Smi::FromInt(instruction.landing_offset)); | 3542 Smi::FromInt(instruction.landing_offset)); |
3532 } | 3543 } |
3533 return fn_protected; | 3544 return fn_protected; |
3534 } | 3545 } |
3535 | 3546 |
3536 } // namespace compiler | 3547 } // namespace compiler |
3537 } // namespace internal | 3548 } // namespace internal |
3538 } // namespace v8 | 3549 } // namespace v8 |
OLD | NEW |