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 3426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3437 return graph()->NewNode(jsgraph()->machine()->S128And(), inputs[0], | 3437 return graph()->NewNode(jsgraph()->machine()->S128And(), inputs[0], |
3438 inputs[1]); | 3438 inputs[1]); |
3439 case wasm::kExprS128Or: | 3439 case wasm::kExprS128Or: |
3440 return graph()->NewNode(jsgraph()->machine()->S128Or(), inputs[0], | 3440 return graph()->NewNode(jsgraph()->machine()->S128Or(), inputs[0], |
3441 inputs[1]); | 3441 inputs[1]); |
3442 case wasm::kExprS128Xor: | 3442 case wasm::kExprS128Xor: |
3443 return graph()->NewNode(jsgraph()->machine()->S128Xor(), inputs[0], | 3443 return graph()->NewNode(jsgraph()->machine()->S128Xor(), inputs[0], |
3444 inputs[1]); | 3444 inputs[1]); |
3445 case wasm::kExprS128Not: | 3445 case wasm::kExprS128Not: |
3446 return graph()->NewNode(jsgraph()->machine()->S128Not(), inputs[0]); | 3446 return graph()->NewNode(jsgraph()->machine()->S128Not(), inputs[0]); |
| 3447 case wasm::kExprS32x4ZipLeft: |
| 3448 return graph()->NewNode(jsgraph()->machine()->S32x4ZipLeft(), inputs[0], |
| 3449 inputs[1]); |
| 3450 case wasm::kExprS32x4ZipRight: |
| 3451 return graph()->NewNode(jsgraph()->machine()->S32x4ZipRight(), inputs[0], |
| 3452 inputs[1]); |
| 3453 case wasm::kExprS32x4UnzipLeft: |
| 3454 return graph()->NewNode(jsgraph()->machine()->S32x4UnzipLeft(), inputs[0], |
| 3455 inputs[1]); |
| 3456 case wasm::kExprS32x4UnzipRight: |
| 3457 return graph()->NewNode(jsgraph()->machine()->S32x4UnzipRight(), |
| 3458 inputs[0], inputs[1]); |
| 3459 case wasm::kExprS32x4TransposeLeft: |
| 3460 return graph()->NewNode(jsgraph()->machine()->S32x4TransposeLeft(), |
| 3461 inputs[0], inputs[1]); |
| 3462 case wasm::kExprS32x4TransposeRight: |
| 3463 return graph()->NewNode(jsgraph()->machine()->S32x4TransposeRight(), |
| 3464 inputs[0], inputs[1]); |
3447 case wasm::kExprS32x4Select: | 3465 case wasm::kExprS32x4Select: |
3448 return graph()->NewNode(jsgraph()->machine()->S32x4Select(), inputs[0], | 3466 return graph()->NewNode(jsgraph()->machine()->S32x4Select(), inputs[0], |
3449 inputs[1], inputs[2]); | 3467 inputs[1], inputs[2]); |
| 3468 case wasm::kExprS16x8ZipLeft: |
| 3469 return graph()->NewNode(jsgraph()->machine()->S16x8ZipLeft(), inputs[0], |
| 3470 inputs[1]); |
| 3471 case wasm::kExprS16x8ZipRight: |
| 3472 return graph()->NewNode(jsgraph()->machine()->S16x8ZipRight(), inputs[0], |
| 3473 inputs[1]); |
| 3474 case wasm::kExprS16x8UnzipLeft: |
| 3475 return graph()->NewNode(jsgraph()->machine()->S16x8UnzipLeft(), inputs[0], |
| 3476 inputs[1]); |
| 3477 case wasm::kExprS16x8UnzipRight: |
| 3478 return graph()->NewNode(jsgraph()->machine()->S16x8UnzipRight(), |
| 3479 inputs[0], inputs[1]); |
| 3480 case wasm::kExprS16x8TransposeLeft: |
| 3481 return graph()->NewNode(jsgraph()->machine()->S16x8TransposeLeft(), |
| 3482 inputs[0], inputs[1]); |
| 3483 case wasm::kExprS16x8TransposeRight: |
| 3484 return graph()->NewNode(jsgraph()->machine()->S16x8TransposeRight(), |
| 3485 inputs[0], inputs[1]); |
3450 case wasm::kExprS16x8Select: | 3486 case wasm::kExprS16x8Select: |
3451 return graph()->NewNode(jsgraph()->machine()->S16x8Select(), inputs[0], | 3487 return graph()->NewNode(jsgraph()->machine()->S16x8Select(), inputs[0], |
3452 inputs[1], inputs[2]); | 3488 inputs[1], inputs[2]); |
| 3489 case wasm::kExprS8x16ZipLeft: |
| 3490 return graph()->NewNode(jsgraph()->machine()->S8x16ZipLeft(), inputs[0], |
| 3491 inputs[1]); |
| 3492 case wasm::kExprS8x16ZipRight: |
| 3493 return graph()->NewNode(jsgraph()->machine()->S8x16ZipRight(), inputs[0], |
| 3494 inputs[1]); |
| 3495 case wasm::kExprS8x16UnzipLeft: |
| 3496 return graph()->NewNode(jsgraph()->machine()->S8x16UnzipLeft(), inputs[0], |
| 3497 inputs[1]); |
| 3498 case wasm::kExprS8x16UnzipRight: |
| 3499 return graph()->NewNode(jsgraph()->machine()->S8x16UnzipRight(), |
| 3500 inputs[0], inputs[1]); |
| 3501 case wasm::kExprS8x16TransposeLeft: |
| 3502 return graph()->NewNode(jsgraph()->machine()->S8x16TransposeLeft(), |
| 3503 inputs[0], inputs[1]); |
| 3504 case wasm::kExprS8x16TransposeRight: |
| 3505 return graph()->NewNode(jsgraph()->machine()->S8x16TransposeRight(), |
| 3506 inputs[0], inputs[1]); |
3453 case wasm::kExprS8x16Select: | 3507 case wasm::kExprS8x16Select: |
3454 return graph()->NewNode(jsgraph()->machine()->S8x16Select(), inputs[0], | 3508 return graph()->NewNode(jsgraph()->machine()->S8x16Select(), inputs[0], |
3455 inputs[1], inputs[2]); | 3509 inputs[1], inputs[2]); |
| 3510 case wasm::kExprS32x2Reverse: |
| 3511 return graph()->NewNode(jsgraph()->machine()->S32x2Reverse(), inputs[0]); |
| 3512 case wasm::kExprS16x4Reverse: |
| 3513 return graph()->NewNode(jsgraph()->machine()->S16x4Reverse(), inputs[0]); |
| 3514 case wasm::kExprS16x2Reverse: |
| 3515 return graph()->NewNode(jsgraph()->machine()->S16x2Reverse(), inputs[0]); |
| 3516 case wasm::kExprS8x8Reverse: |
| 3517 return graph()->NewNode(jsgraph()->machine()->S8x8Reverse(), inputs[0]); |
| 3518 case wasm::kExprS8x4Reverse: |
| 3519 return graph()->NewNode(jsgraph()->machine()->S8x4Reverse(), inputs[0]); |
| 3520 case wasm::kExprS8x2Reverse: |
| 3521 return graph()->NewNode(jsgraph()->machine()->S8x2Reverse(), inputs[0]); |
3456 case wasm::kExprS1x4And: | 3522 case wasm::kExprS1x4And: |
3457 return graph()->NewNode(jsgraph()->machine()->S1x4And(), inputs[0], | 3523 return graph()->NewNode(jsgraph()->machine()->S1x4And(), inputs[0], |
3458 inputs[1]); | 3524 inputs[1]); |
3459 case wasm::kExprS1x4Or: | 3525 case wasm::kExprS1x4Or: |
3460 return graph()->NewNode(jsgraph()->machine()->S1x4Or(), inputs[0], | 3526 return graph()->NewNode(jsgraph()->machine()->S1x4Or(), inputs[0], |
3461 inputs[1]); | 3527 inputs[1]); |
3462 case wasm::kExprS1x4Xor: | 3528 case wasm::kExprS1x4Xor: |
3463 return graph()->NewNode(jsgraph()->machine()->S1x4Xor(), inputs[0], | 3529 return graph()->NewNode(jsgraph()->machine()->S1x4Xor(), inputs[0], |
3464 inputs[1]); | 3530 inputs[1]); |
3465 case wasm::kExprS1x4Not: | 3531 case wasm::kExprS1x4Not: |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3562 return graph()->NewNode(jsgraph()->machine()->I8x16ShrS(shift), | 3628 return graph()->NewNode(jsgraph()->machine()->I8x16ShrS(shift), |
3563 inputs[0]); | 3629 inputs[0]); |
3564 case wasm::kExprI8x16ShrU: | 3630 case wasm::kExprI8x16ShrU: |
3565 return graph()->NewNode(jsgraph()->machine()->I8x16ShrU(shift), | 3631 return graph()->NewNode(jsgraph()->machine()->I8x16ShrU(shift), |
3566 inputs[0]); | 3632 inputs[0]); |
3567 default: | 3633 default: |
3568 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); | 3634 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); |
3569 } | 3635 } |
3570 } | 3636 } |
3571 | 3637 |
3572 Node* WasmGraphBuilder::SimdSwizzleOp(wasm::WasmOpcode opcode, uint32_t swizzle, | 3638 Node* WasmGraphBuilder::SimdConcatOp(uint8_t bytes, const NodeVector& inputs) { |
3573 const NodeVector& inputs) { | |
3574 has_simd_ = true; | 3639 has_simd_ = true; |
3575 switch (opcode) { | 3640 return graph()->NewNode(jsgraph()->machine()->S8x16Concat(bytes), inputs[0], |
3576 case wasm::kExprS32x4Swizzle: | 3641 inputs[1]); |
3577 return graph()->NewNode(jsgraph()->machine()->S32x4Swizzle(swizzle), | |
3578 inputs[0]); | |
3579 case wasm::kExprS16x8Swizzle: | |
3580 return graph()->NewNode(jsgraph()->machine()->S16x8Swizzle(swizzle), | |
3581 inputs[0]); | |
3582 case wasm::kExprS8x16Swizzle: | |
3583 return graph()->NewNode(jsgraph()->machine()->S8x16Swizzle(swizzle), | |
3584 inputs[0]); | |
3585 default: | |
3586 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); | |
3587 } | |
3588 } | 3642 } |
3589 | 3643 |
3590 static void RecordFunctionCompilation(CodeEventListener::LogEventsAndTags tag, | 3644 static void RecordFunctionCompilation(CodeEventListener::LogEventsAndTags tag, |
3591 Isolate* isolate, Handle<Code> code, | 3645 Isolate* isolate, Handle<Code> code, |
3592 const char* message, uint32_t index, | 3646 const char* message, uint32_t index, |
3593 const wasm::WasmName& module_name, | 3647 const wasm::WasmName& module_name, |
3594 const wasm::WasmName& func_name) { | 3648 const wasm::WasmName& func_name) { |
3595 DCHECK(isolate->logger()->is_logging_code_events() || | 3649 DCHECK(isolate->logger()->is_logging_code_events() || |
3596 isolate->is_profiling()); | 3650 isolate->is_profiling()); |
3597 | 3651 |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4054 wasm::ModuleBytesEnv* module_env, const wasm::WasmFunction* function) { | 4108 wasm::ModuleBytesEnv* module_env, const wasm::WasmFunction* function) { |
4055 WasmCompilationUnit unit(isolate, module_env, function); | 4109 WasmCompilationUnit unit(isolate, module_env, function); |
4056 unit.InitializeHandles(); | 4110 unit.InitializeHandles(); |
4057 unit.ExecuteCompilation(); | 4111 unit.ExecuteCompilation(); |
4058 return unit.FinishCompilation(thrower); | 4112 return unit.FinishCompilation(thrower); |
4059 } | 4113 } |
4060 | 4114 |
4061 } // namespace compiler | 4115 } // namespace compiler |
4062 } // namespace internal | 4116 } // namespace internal |
4063 } // namespace v8 | 4117 } // namespace v8 |
OLD | NEW |