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 3425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3436 return graph()->NewNode( | 3436 return graph()->NewNode( |
3437 jsgraph()->machine()->Uint32x4GreaterThanOrEqual(), inputs[1], | 3437 jsgraph()->machine()->Uint32x4GreaterThanOrEqual(), inputs[1], |
3438 inputs[0]); | 3438 inputs[0]); |
3439 case wasm::kExprI32x4GtU: | 3439 case wasm::kExprI32x4GtU: |
3440 return graph()->NewNode(jsgraph()->machine()->Uint32x4GreaterThan(), | 3440 return graph()->NewNode(jsgraph()->machine()->Uint32x4GreaterThan(), |
3441 inputs[0], inputs[1]); | 3441 inputs[0], inputs[1]); |
3442 case wasm::kExprI32x4GeU: | 3442 case wasm::kExprI32x4GeU: |
3443 return graph()->NewNode( | 3443 return graph()->NewNode( |
3444 jsgraph()->machine()->Uint32x4GreaterThanOrEqual(), inputs[0], | 3444 jsgraph()->machine()->Uint32x4GreaterThanOrEqual(), inputs[0], |
3445 inputs[1]); | 3445 inputs[1]); |
3446 case wasm::kExprS32x4Select: | |
3447 return graph()->NewNode(jsgraph()->machine()->Simd32x4Select(), inputs[0], | |
3448 inputs[1], inputs[2]); | |
3449 case wasm::kExprI16x8Splat: | 3446 case wasm::kExprI16x8Splat: |
3450 return graph()->NewNode(jsgraph()->machine()->CreateInt16x8(), inputs[0], | 3447 return graph()->NewNode(jsgraph()->machine()->CreateInt16x8(), inputs[0], |
3451 inputs[0], inputs[0], inputs[0], inputs[0], | 3448 inputs[0], inputs[0], inputs[0], inputs[0], |
3452 inputs[0], inputs[0], inputs[0]); | 3449 inputs[0], inputs[0], inputs[0]); |
3453 case wasm::kExprI16x8Neg: | 3450 case wasm::kExprI16x8Neg: |
3454 return graph()->NewNode(jsgraph()->machine()->Int16x8Neg(), inputs[0]); | 3451 return graph()->NewNode(jsgraph()->machine()->Int16x8Neg(), inputs[0]); |
3455 case wasm::kExprI16x8Add: | 3452 case wasm::kExprI16x8Add: |
3456 return graph()->NewNode(jsgraph()->machine()->Int16x8Add(), inputs[0], | 3453 return graph()->NewNode(jsgraph()->machine()->Int16x8Add(), inputs[0], |
3457 inputs[1]); | 3454 inputs[1]); |
3458 case wasm::kExprI16x8AddSaturateS: | 3455 case wasm::kExprI16x8AddSaturateS: |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3583 return graph()->NewNode( | 3580 return graph()->NewNode( |
3584 jsgraph()->machine()->Uint8x16GreaterThanOrEqual(), inputs[1], | 3581 jsgraph()->machine()->Uint8x16GreaterThanOrEqual(), inputs[1], |
3585 inputs[0]); | 3582 inputs[0]); |
3586 case wasm::kExprI8x16GtU: | 3583 case wasm::kExprI8x16GtU: |
3587 return graph()->NewNode(jsgraph()->machine()->Uint8x16GreaterThan(), | 3584 return graph()->NewNode(jsgraph()->machine()->Uint8x16GreaterThan(), |
3588 inputs[0], inputs[1]); | 3585 inputs[0], inputs[1]); |
3589 case wasm::kExprI8x16GeU: | 3586 case wasm::kExprI8x16GeU: |
3590 return graph()->NewNode( | 3587 return graph()->NewNode( |
3591 jsgraph()->machine()->Uint8x16GreaterThanOrEqual(), inputs[0], | 3588 jsgraph()->machine()->Uint8x16GreaterThanOrEqual(), inputs[0], |
3592 inputs[1]); | 3589 inputs[1]); |
| 3590 case wasm::kExprS32x4Select: |
| 3591 return graph()->NewNode(jsgraph()->machine()->Simd32x4Select(), inputs[0], |
| 3592 inputs[1], inputs[2]); |
| 3593 case wasm::kExprS16x8Select: |
| 3594 return graph()->NewNode(jsgraph()->machine()->Simd16x8Select(), inputs[0], |
| 3595 inputs[1], inputs[2]); |
| 3596 case wasm::kExprS8x16Select: |
| 3597 return graph()->NewNode(jsgraph()->machine()->Simd8x16Select(), inputs[0], |
| 3598 inputs[1], inputs[2]); |
| 3599 case wasm::kExprS128And: |
| 3600 return graph()->NewNode(jsgraph()->machine()->Simd128And(), inputs[0], |
| 3601 inputs[1]); |
| 3602 case wasm::kExprS128Or: |
| 3603 return graph()->NewNode(jsgraph()->machine()->Simd128Or(), inputs[0], |
| 3604 inputs[1]); |
| 3605 case wasm::kExprS128Xor: |
| 3606 return graph()->NewNode(jsgraph()->machine()->Simd128Xor(), inputs[0], |
| 3607 inputs[1]); |
| 3608 case wasm::kExprS128Not: |
| 3609 return graph()->NewNode(jsgraph()->machine()->Simd128Not(), inputs[0]); |
3593 default: | 3610 default: |
3594 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); | 3611 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); |
3595 } | 3612 } |
3596 } | 3613 } |
3597 | 3614 |
3598 Node* WasmGraphBuilder::SimdLaneOp(wasm::WasmOpcode opcode, uint8_t lane, | 3615 Node* WasmGraphBuilder::SimdLaneOp(wasm::WasmOpcode opcode, uint8_t lane, |
3599 const NodeVector& inputs) { | 3616 const NodeVector& inputs) { |
3600 has_simd_ = true; | 3617 has_simd_ = true; |
3601 switch (opcode) { | 3618 switch (opcode) { |
3602 case wasm::kExprF32x4ExtractLane: | 3619 case wasm::kExprF32x4ExtractLane: |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3657 return graph()->NewNode( | 3674 return graph()->NewNode( |
3658 jsgraph()->machine()->Int8x16ShiftRightByScalar(shift), inputs[0]); | 3675 jsgraph()->machine()->Int8x16ShiftRightByScalar(shift), inputs[0]); |
3659 case wasm::kExprI8x16ShrU: | 3676 case wasm::kExprI8x16ShrU: |
3660 return graph()->NewNode( | 3677 return graph()->NewNode( |
3661 jsgraph()->machine()->Uint8x16ShiftRightByScalar(shift), inputs[0]); | 3678 jsgraph()->machine()->Uint8x16ShiftRightByScalar(shift), inputs[0]); |
3662 default: | 3679 default: |
3663 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); | 3680 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); |
3664 } | 3681 } |
3665 } | 3682 } |
3666 | 3683 |
| 3684 Node* WasmGraphBuilder::SimdSwizzleOp(wasm::WasmOpcode opcode, uint32_t swizzle, |
| 3685 const NodeVector& inputs) { |
| 3686 has_simd_ = true; |
| 3687 switch (opcode) { |
| 3688 case wasm::kExprS32x4Swizzle: |
| 3689 return graph()->NewNode(jsgraph()->machine()->Simd32x4Swizzle(swizzle), |
| 3690 inputs[0]); |
| 3691 case wasm::kExprS16x8Swizzle: |
| 3692 return graph()->NewNode(jsgraph()->machine()->Simd16x8Swizzle(swizzle), |
| 3693 inputs[0]); |
| 3694 case wasm::kExprS8x16Swizzle: |
| 3695 return graph()->NewNode(jsgraph()->machine()->Simd8x16Swizzle(swizzle), |
| 3696 inputs[0]); |
| 3697 default: |
| 3698 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); |
| 3699 } |
| 3700 } |
| 3701 |
3667 static void RecordFunctionCompilation(CodeEventListener::LogEventsAndTags tag, | 3702 static void RecordFunctionCompilation(CodeEventListener::LogEventsAndTags tag, |
3668 Isolate* isolate, Handle<Code> code, | 3703 Isolate* isolate, Handle<Code> code, |
3669 const char* message, uint32_t index, | 3704 const char* message, uint32_t index, |
3670 const wasm::WasmName& module_name, | 3705 const wasm::WasmName& module_name, |
3671 const wasm::WasmName& func_name) { | 3706 const wasm::WasmName& func_name) { |
3672 DCHECK(isolate->logger()->is_logging_code_events() || | 3707 DCHECK(isolate->logger()->is_logging_code_events() || |
3673 isolate->is_profiling()); | 3708 isolate->is_profiling()); |
3674 | 3709 |
3675 ScopedVector<char> buffer(128); | 3710 ScopedVector<char> buffer(128); |
3676 SNPrintF(buffer, "%s#%d:%.*s:%.*s", message, index, module_name.length(), | 3711 SNPrintF(buffer, "%s#%d:%.*s:%.*s", message, index, module_name.length(), |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4099 function_->code_start_offset), | 4134 function_->code_start_offset), |
4100 compile_ms); | 4135 compile_ms); |
4101 } | 4136 } |
4102 | 4137 |
4103 return code; | 4138 return code; |
4104 } | 4139 } |
4105 | 4140 |
4106 } // namespace compiler | 4141 } // namespace compiler |
4107 } // namespace internal | 4142 } // namespace internal |
4108 } // namespace v8 | 4143 } // namespace v8 |
OLD | NEW |