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/assembler-inl.h" | 9 #include "src/assembler-inl.h" |
10 #include "src/base/platform/elapsed-timer.h" | 10 #include "src/base/platform/elapsed-timer.h" |
(...skipping 3462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3473 return graph()->NewNode(jsgraph()->machine()->S128And(), inputs[0], | 3473 return graph()->NewNode(jsgraph()->machine()->S128And(), inputs[0], |
3474 inputs[1]); | 3474 inputs[1]); |
3475 case wasm::kExprS128Or: | 3475 case wasm::kExprS128Or: |
3476 return graph()->NewNode(jsgraph()->machine()->S128Or(), inputs[0], | 3476 return graph()->NewNode(jsgraph()->machine()->S128Or(), inputs[0], |
3477 inputs[1]); | 3477 inputs[1]); |
3478 case wasm::kExprS128Xor: | 3478 case wasm::kExprS128Xor: |
3479 return graph()->NewNode(jsgraph()->machine()->S128Xor(), inputs[0], | 3479 return graph()->NewNode(jsgraph()->machine()->S128Xor(), inputs[0], |
3480 inputs[1]); | 3480 inputs[1]); |
3481 case wasm::kExprS128Not: | 3481 case wasm::kExprS128Not: |
3482 return graph()->NewNode(jsgraph()->machine()->S128Not(), inputs[0]); | 3482 return graph()->NewNode(jsgraph()->machine()->S128Not(), inputs[0]); |
| 3483 case wasm::kExprS32x4ZipLeft: |
| 3484 return graph()->NewNode(jsgraph()->machine()->S32x4ZipLeft(), inputs[0], |
| 3485 inputs[1]); |
| 3486 case wasm::kExprS32x4ZipRight: |
| 3487 return graph()->NewNode(jsgraph()->machine()->S32x4ZipRight(), inputs[0], |
| 3488 inputs[1]); |
| 3489 case wasm::kExprS32x4UnzipLeft: |
| 3490 return graph()->NewNode(jsgraph()->machine()->S32x4UnzipLeft(), inputs[0], |
| 3491 inputs[1]); |
| 3492 case wasm::kExprS32x4UnzipRight: |
| 3493 return graph()->NewNode(jsgraph()->machine()->S32x4UnzipRight(), |
| 3494 inputs[0], inputs[1]); |
| 3495 case wasm::kExprS32x4TransposeLeft: |
| 3496 return graph()->NewNode(jsgraph()->machine()->S32x4TransposeLeft(), |
| 3497 inputs[0], inputs[1]); |
| 3498 case wasm::kExprS32x4TransposeRight: |
| 3499 return graph()->NewNode(jsgraph()->machine()->S32x4TransposeRight(), |
| 3500 inputs[0], inputs[1]); |
3483 case wasm::kExprS32x4Select: | 3501 case wasm::kExprS32x4Select: |
3484 return graph()->NewNode(jsgraph()->machine()->S32x4Select(), inputs[0], | 3502 return graph()->NewNode(jsgraph()->machine()->S32x4Select(), inputs[0], |
3485 inputs[1], inputs[2]); | 3503 inputs[1], inputs[2]); |
| 3504 case wasm::kExprS16x8ZipLeft: |
| 3505 return graph()->NewNode(jsgraph()->machine()->S16x8ZipLeft(), inputs[0], |
| 3506 inputs[1]); |
| 3507 case wasm::kExprS16x8ZipRight: |
| 3508 return graph()->NewNode(jsgraph()->machine()->S16x8ZipRight(), inputs[0], |
| 3509 inputs[1]); |
| 3510 case wasm::kExprS16x8UnzipLeft: |
| 3511 return graph()->NewNode(jsgraph()->machine()->S16x8UnzipLeft(), inputs[0], |
| 3512 inputs[1]); |
| 3513 case wasm::kExprS16x8UnzipRight: |
| 3514 return graph()->NewNode(jsgraph()->machine()->S16x8UnzipRight(), |
| 3515 inputs[0], inputs[1]); |
| 3516 case wasm::kExprS16x8TransposeLeft: |
| 3517 return graph()->NewNode(jsgraph()->machine()->S16x8TransposeLeft(), |
| 3518 inputs[0], inputs[1]); |
| 3519 case wasm::kExprS16x8TransposeRight: |
| 3520 return graph()->NewNode(jsgraph()->machine()->S16x8TransposeRight(), |
| 3521 inputs[0], inputs[1]); |
3486 case wasm::kExprS16x8Select: | 3522 case wasm::kExprS16x8Select: |
3487 return graph()->NewNode(jsgraph()->machine()->S16x8Select(), inputs[0], | 3523 return graph()->NewNode(jsgraph()->machine()->S16x8Select(), inputs[0], |
3488 inputs[1], inputs[2]); | 3524 inputs[1], inputs[2]); |
| 3525 case wasm::kExprS8x16ZipLeft: |
| 3526 return graph()->NewNode(jsgraph()->machine()->S8x16ZipLeft(), inputs[0], |
| 3527 inputs[1]); |
| 3528 case wasm::kExprS8x16ZipRight: |
| 3529 return graph()->NewNode(jsgraph()->machine()->S8x16ZipRight(), inputs[0], |
| 3530 inputs[1]); |
| 3531 case wasm::kExprS8x16UnzipLeft: |
| 3532 return graph()->NewNode(jsgraph()->machine()->S8x16UnzipLeft(), inputs[0], |
| 3533 inputs[1]); |
| 3534 case wasm::kExprS8x16UnzipRight: |
| 3535 return graph()->NewNode(jsgraph()->machine()->S8x16UnzipRight(), |
| 3536 inputs[0], inputs[1]); |
| 3537 case wasm::kExprS8x16TransposeLeft: |
| 3538 return graph()->NewNode(jsgraph()->machine()->S8x16TransposeLeft(), |
| 3539 inputs[0], inputs[1]); |
| 3540 case wasm::kExprS8x16TransposeRight: |
| 3541 return graph()->NewNode(jsgraph()->machine()->S8x16TransposeRight(), |
| 3542 inputs[0], inputs[1]); |
3489 case wasm::kExprS8x16Select: | 3543 case wasm::kExprS8x16Select: |
3490 return graph()->NewNode(jsgraph()->machine()->S8x16Select(), inputs[0], | 3544 return graph()->NewNode(jsgraph()->machine()->S8x16Select(), inputs[0], |
3491 inputs[1], inputs[2]); | 3545 inputs[1], inputs[2]); |
| 3546 case wasm::kExprS32x2Reverse: |
| 3547 return graph()->NewNode(jsgraph()->machine()->S32x2Reverse(), inputs[0]); |
| 3548 case wasm::kExprS16x4Reverse: |
| 3549 return graph()->NewNode(jsgraph()->machine()->S16x4Reverse(), inputs[0]); |
| 3550 case wasm::kExprS16x2Reverse: |
| 3551 return graph()->NewNode(jsgraph()->machine()->S16x2Reverse(), inputs[0]); |
| 3552 case wasm::kExprS8x8Reverse: |
| 3553 return graph()->NewNode(jsgraph()->machine()->S8x8Reverse(), inputs[0]); |
| 3554 case wasm::kExprS8x4Reverse: |
| 3555 return graph()->NewNode(jsgraph()->machine()->S8x4Reverse(), inputs[0]); |
| 3556 case wasm::kExprS8x2Reverse: |
| 3557 return graph()->NewNode(jsgraph()->machine()->S8x2Reverse(), inputs[0]); |
3492 case wasm::kExprS1x4And: | 3558 case wasm::kExprS1x4And: |
3493 return graph()->NewNode(jsgraph()->machine()->S1x4And(), inputs[0], | 3559 return graph()->NewNode(jsgraph()->machine()->S1x4And(), inputs[0], |
3494 inputs[1]); | 3560 inputs[1]); |
3495 case wasm::kExprS1x4Or: | 3561 case wasm::kExprS1x4Or: |
3496 return graph()->NewNode(jsgraph()->machine()->S1x4Or(), inputs[0], | 3562 return graph()->NewNode(jsgraph()->machine()->S1x4Or(), inputs[0], |
3497 inputs[1]); | 3563 inputs[1]); |
3498 case wasm::kExprS1x4Xor: | 3564 case wasm::kExprS1x4Xor: |
3499 return graph()->NewNode(jsgraph()->machine()->S1x4Xor(), inputs[0], | 3565 return graph()->NewNode(jsgraph()->machine()->S1x4Xor(), inputs[0], |
3500 inputs[1]); | 3566 inputs[1]); |
3501 case wasm::kExprS1x4Not: | 3567 case wasm::kExprS1x4Not: |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3598 return graph()->NewNode(jsgraph()->machine()->I8x16ShrS(shift), | 3664 return graph()->NewNode(jsgraph()->machine()->I8x16ShrS(shift), |
3599 inputs[0]); | 3665 inputs[0]); |
3600 case wasm::kExprI8x16ShrU: | 3666 case wasm::kExprI8x16ShrU: |
3601 return graph()->NewNode(jsgraph()->machine()->I8x16ShrU(shift), | 3667 return graph()->NewNode(jsgraph()->machine()->I8x16ShrU(shift), |
3602 inputs[0]); | 3668 inputs[0]); |
3603 default: | 3669 default: |
3604 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); | 3670 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); |
3605 } | 3671 } |
3606 } | 3672 } |
3607 | 3673 |
3608 Node* WasmGraphBuilder::SimdSwizzleOp(wasm::WasmOpcode opcode, uint32_t swizzle, | 3674 Node* WasmGraphBuilder::SimdConcatOp(uint8_t bytes, const NodeVector& inputs) { |
3609 const NodeVector& inputs) { | |
3610 has_simd_ = true; | 3675 has_simd_ = true; |
3611 switch (opcode) { | 3676 return graph()->NewNode(jsgraph()->machine()->S8x16Concat(bytes), inputs[0], |
3612 case wasm::kExprS32x4Swizzle: | 3677 inputs[1]); |
3613 return graph()->NewNode(jsgraph()->machine()->S32x4Swizzle(swizzle), | |
3614 inputs[0]); | |
3615 case wasm::kExprS16x8Swizzle: | |
3616 return graph()->NewNode(jsgraph()->machine()->S16x8Swizzle(swizzle), | |
3617 inputs[0]); | |
3618 case wasm::kExprS8x16Swizzle: | |
3619 return graph()->NewNode(jsgraph()->machine()->S8x16Swizzle(swizzle), | |
3620 inputs[0]); | |
3621 default: | |
3622 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); | |
3623 } | |
3624 } | 3678 } |
3625 | 3679 |
3626 static void RecordFunctionCompilation(CodeEventListener::LogEventsAndTags tag, | 3680 static void RecordFunctionCompilation(CodeEventListener::LogEventsAndTags tag, |
3627 Isolate* isolate, Handle<Code> code, | 3681 Isolate* isolate, Handle<Code> code, |
3628 const char* message, uint32_t index, | 3682 const char* message, uint32_t index, |
3629 const wasm::WasmName& module_name, | 3683 const wasm::WasmName& module_name, |
3630 const wasm::WasmName& func_name) { | 3684 const wasm::WasmName& func_name) { |
3631 DCHECK(isolate->logger()->is_logging_code_events() || | 3685 DCHECK(isolate->logger()->is_logging_code_events() || |
3632 isolate->is_profiling()); | 3686 isolate->is_profiling()); |
3633 | 3687 |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4090 wasm::ModuleBytesEnv* module_env, const wasm::WasmFunction* function) { | 4144 wasm::ModuleBytesEnv* module_env, const wasm::WasmFunction* function) { |
4091 WasmCompilationUnit unit(isolate, module_env, function); | 4145 WasmCompilationUnit unit(isolate, module_env, function); |
4092 unit.InitializeHandles(); | 4146 unit.InitializeHandles(); |
4093 unit.ExecuteCompilation(); | 4147 unit.ExecuteCompilation(); |
4094 return unit.FinishCompilation(thrower); | 4148 return unit.FinishCompilation(thrower); |
4095 } | 4149 } |
4096 | 4150 |
4097 } // namespace compiler | 4151 } // namespace compiler |
4098 } // namespace internal | 4152 } // namespace internal |
4099 } // namespace v8 | 4153 } // namespace v8 |
OLD | NEW |