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 3366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3377 inputs[0], inputs[1]); | 3377 inputs[0], inputs[1]); |
3378 case wasm::kExprI32x4Splat: | 3378 case wasm::kExprI32x4Splat: |
3379 return graph()->NewNode(jsgraph()->machine()->CreateInt32x4(), inputs[0], | 3379 return graph()->NewNode(jsgraph()->machine()->CreateInt32x4(), inputs[0], |
3380 inputs[0], inputs[0], inputs[0]); | 3380 inputs[0], inputs[0], inputs[0]); |
3381 case wasm::kExprI32x4SConvertF32x4: | 3381 case wasm::kExprI32x4SConvertF32x4: |
3382 return graph()->NewNode(jsgraph()->machine()->Int32x4FromFloat32x4(), | 3382 return graph()->NewNode(jsgraph()->machine()->Int32x4FromFloat32x4(), |
3383 inputs[0]); | 3383 inputs[0]); |
3384 case wasm::kExprI32x4UConvertF32x4: | 3384 case wasm::kExprI32x4UConvertF32x4: |
3385 return graph()->NewNode(jsgraph()->machine()->Uint32x4FromFloat32x4(), | 3385 return graph()->NewNode(jsgraph()->machine()->Uint32x4FromFloat32x4(), |
3386 inputs[0]); | 3386 inputs[0]); |
| 3387 case wasm::kExprI32x4Neg: |
| 3388 return graph()->NewNode(jsgraph()->machine()->Int32x4Neg(), inputs[0]); |
3387 case wasm::kExprI32x4Add: | 3389 case wasm::kExprI32x4Add: |
3388 return graph()->NewNode(jsgraph()->machine()->Int32x4Add(), inputs[0], | 3390 return graph()->NewNode(jsgraph()->machine()->Int32x4Add(), inputs[0], |
3389 inputs[1]); | 3391 inputs[1]); |
3390 case wasm::kExprI32x4Sub: | 3392 case wasm::kExprI32x4Sub: |
3391 return graph()->NewNode(jsgraph()->machine()->Int32x4Sub(), inputs[0], | 3393 return graph()->NewNode(jsgraph()->machine()->Int32x4Sub(), inputs[0], |
3392 inputs[1]); | 3394 inputs[1]); |
| 3395 case wasm::kExprI32x4Mul: |
| 3396 return graph()->NewNode(jsgraph()->machine()->Int32x4Mul(), inputs[0], |
| 3397 inputs[1]); |
| 3398 case wasm::kExprI32x4MinS: |
| 3399 return graph()->NewNode(jsgraph()->machine()->Int32x4Min(), inputs[0], |
| 3400 inputs[1]); |
| 3401 case wasm::kExprI32x4MaxS: |
| 3402 return graph()->NewNode(jsgraph()->machine()->Int32x4Max(), inputs[0], |
| 3403 inputs[1]); |
3393 case wasm::kExprI32x4Eq: | 3404 case wasm::kExprI32x4Eq: |
3394 return graph()->NewNode(jsgraph()->machine()->Int32x4Equal(), inputs[0], | 3405 return graph()->NewNode(jsgraph()->machine()->Int32x4Equal(), inputs[0], |
3395 inputs[1]); | 3406 inputs[1]); |
3396 case wasm::kExprI32x4Ne: | 3407 case wasm::kExprI32x4Ne: |
3397 return graph()->NewNode(jsgraph()->machine()->Int32x4NotEqual(), | 3408 return graph()->NewNode(jsgraph()->machine()->Int32x4NotEqual(), |
3398 inputs[0], inputs[1]); | 3409 inputs[0], inputs[1]); |
| 3410 case wasm::kExprI32x4LtS: |
| 3411 return graph()->NewNode(jsgraph()->machine()->Int32x4GreaterThan(), |
| 3412 inputs[1], inputs[0]); |
| 3413 case wasm::kExprI32x4LeS: |
| 3414 return graph()->NewNode(jsgraph()->machine()->Int32x4GreaterThanOrEqual(), |
| 3415 inputs[1], inputs[0]); |
| 3416 case wasm::kExprI32x4GtS: |
| 3417 return graph()->NewNode(jsgraph()->machine()->Int32x4GreaterThan(), |
| 3418 inputs[0], inputs[1]); |
| 3419 case wasm::kExprI32x4GeS: |
| 3420 return graph()->NewNode(jsgraph()->machine()->Int32x4GreaterThanOrEqual(), |
| 3421 inputs[0], inputs[1]); |
| 3422 case wasm::kExprI32x4LtU: |
| 3423 return graph()->NewNode(jsgraph()->machine()->Uint32x4GreaterThan(), |
| 3424 inputs[1], inputs[0]); |
| 3425 case wasm::kExprI32x4LeU: |
| 3426 return graph()->NewNode( |
| 3427 jsgraph()->machine()->Uint32x4GreaterThanOrEqual(), inputs[1], |
| 3428 inputs[0]); |
| 3429 case wasm::kExprI32x4GtU: |
| 3430 return graph()->NewNode(jsgraph()->machine()->Uint32x4GreaterThan(), |
| 3431 inputs[0], inputs[1]); |
| 3432 case wasm::kExprI32x4GeU: |
| 3433 return graph()->NewNode( |
| 3434 jsgraph()->machine()->Uint32x4GreaterThanOrEqual(), inputs[0], |
| 3435 inputs[1]); |
3399 case wasm::kExprS32x4Select: | 3436 case wasm::kExprS32x4Select: |
3400 return graph()->NewNode(jsgraph()->machine()->Simd32x4Select(), inputs[0], | 3437 return graph()->NewNode(jsgraph()->machine()->Simd32x4Select(), inputs[0], |
3401 inputs[1], inputs[2]); | 3438 inputs[1], inputs[2]); |
| 3439 case wasm::kExprI16x8Splat: |
| 3440 return graph()->NewNode(jsgraph()->machine()->CreateInt16x8(), inputs[0], |
| 3441 inputs[0], inputs[0], inputs[0], inputs[0], |
| 3442 inputs[0], inputs[0], inputs[0]); |
| 3443 case wasm::kExprI16x8Neg: |
| 3444 return graph()->NewNode(jsgraph()->machine()->Int16x8Neg(), inputs[0]); |
| 3445 case wasm::kExprI16x8Add: |
| 3446 return graph()->NewNode(jsgraph()->machine()->Int16x8Add(), inputs[0], |
| 3447 inputs[1]); |
| 3448 case wasm::kExprI16x8Sub: |
| 3449 return graph()->NewNode(jsgraph()->machine()->Int16x8Sub(), inputs[0], |
| 3450 inputs[1]); |
| 3451 case wasm::kExprI16x8Mul: |
| 3452 return graph()->NewNode(jsgraph()->machine()->Int16x8Mul(), inputs[0], |
| 3453 inputs[1]); |
| 3454 case wasm::kExprI16x8MinS: |
| 3455 return graph()->NewNode(jsgraph()->machine()->Int16x8Min(), inputs[0], |
| 3456 inputs[1]); |
| 3457 case wasm::kExprI16x8MaxS: |
| 3458 return graph()->NewNode(jsgraph()->machine()->Int16x8Max(), inputs[0], |
| 3459 inputs[1]); |
| 3460 case wasm::kExprI16x8Eq: |
| 3461 return graph()->NewNode(jsgraph()->machine()->Int16x8Equal(), inputs[0], |
| 3462 inputs[1]); |
| 3463 case wasm::kExprI16x8Ne: |
| 3464 return graph()->NewNode(jsgraph()->machine()->Int16x8NotEqual(), |
| 3465 inputs[0], inputs[1]); |
| 3466 case wasm::kExprI16x8LtS: |
| 3467 return graph()->NewNode(jsgraph()->machine()->Int16x8GreaterThan(), |
| 3468 inputs[1], inputs[0]); |
| 3469 case wasm::kExprI16x8LeS: |
| 3470 return graph()->NewNode(jsgraph()->machine()->Int16x8GreaterThanOrEqual(), |
| 3471 inputs[1], inputs[0]); |
| 3472 case wasm::kExprI16x8GtS: |
| 3473 return graph()->NewNode(jsgraph()->machine()->Int16x8GreaterThan(), |
| 3474 inputs[0], inputs[1]); |
| 3475 case wasm::kExprI16x8GeS: |
| 3476 return graph()->NewNode(jsgraph()->machine()->Int16x8GreaterThanOrEqual(), |
| 3477 inputs[0], inputs[1]); |
| 3478 case wasm::kExprI16x8LtU: |
| 3479 return graph()->NewNode(jsgraph()->machine()->Uint16x8GreaterThan(), |
| 3480 inputs[1], inputs[0]); |
| 3481 case wasm::kExprI16x8LeU: |
| 3482 return graph()->NewNode( |
| 3483 jsgraph()->machine()->Uint16x8GreaterThanOrEqual(), inputs[1], |
| 3484 inputs[0]); |
| 3485 case wasm::kExprI16x8GtU: |
| 3486 return graph()->NewNode(jsgraph()->machine()->Uint16x8GreaterThan(), |
| 3487 inputs[0], inputs[1]); |
| 3488 case wasm::kExprI16x8GeU: |
| 3489 return graph()->NewNode( |
| 3490 jsgraph()->machine()->Uint16x8GreaterThanOrEqual(), inputs[0], |
| 3491 inputs[1]); |
| 3492 case wasm::kExprI8x16Splat: |
| 3493 return graph()->NewNode(jsgraph()->machine()->CreateInt8x16(), inputs[0], |
| 3494 inputs[0], inputs[0], inputs[0], inputs[0], |
| 3495 inputs[0], inputs[0], inputs[0], inputs[0], |
| 3496 inputs[0], inputs[0], inputs[0], inputs[0], |
| 3497 inputs[0], inputs[0], inputs[0]); |
| 3498 case wasm::kExprI8x16Neg: |
| 3499 return graph()->NewNode(jsgraph()->machine()->Int8x16Neg(), inputs[0]); |
| 3500 case wasm::kExprI8x16Add: |
| 3501 return graph()->NewNode(jsgraph()->machine()->Int8x16Add(), inputs[0], |
| 3502 inputs[1]); |
| 3503 case wasm::kExprI8x16Sub: |
| 3504 return graph()->NewNode(jsgraph()->machine()->Int8x16Sub(), inputs[0], |
| 3505 inputs[1]); |
| 3506 case wasm::kExprI8x16Mul: |
| 3507 return graph()->NewNode(jsgraph()->machine()->Int8x16Mul(), inputs[0], |
| 3508 inputs[1]); |
| 3509 case wasm::kExprI8x16MinS: |
| 3510 return graph()->NewNode(jsgraph()->machine()->Int8x16Min(), inputs[0], |
| 3511 inputs[1]); |
| 3512 case wasm::kExprI8x16MaxS: |
| 3513 return graph()->NewNode(jsgraph()->machine()->Int8x16Max(), inputs[0], |
| 3514 inputs[1]); |
| 3515 case wasm::kExprI8x16Eq: |
| 3516 return graph()->NewNode(jsgraph()->machine()->Int8x16Equal(), inputs[0], |
| 3517 inputs[1]); |
| 3518 case wasm::kExprI8x16Ne: |
| 3519 return graph()->NewNode(jsgraph()->machine()->Int8x16NotEqual(), |
| 3520 inputs[0], inputs[1]); |
| 3521 case wasm::kExprI8x16LtS: |
| 3522 return graph()->NewNode(jsgraph()->machine()->Int8x16GreaterThan(), |
| 3523 inputs[1], inputs[0]); |
| 3524 case wasm::kExprI8x16LeS: |
| 3525 return graph()->NewNode(jsgraph()->machine()->Int8x16GreaterThanOrEqual(), |
| 3526 inputs[1], inputs[0]); |
| 3527 case wasm::kExprI8x16GtS: |
| 3528 return graph()->NewNode(jsgraph()->machine()->Int8x16GreaterThan(), |
| 3529 inputs[0], inputs[1]); |
| 3530 case wasm::kExprI8x16GeS: |
| 3531 return graph()->NewNode(jsgraph()->machine()->Int8x16GreaterThanOrEqual(), |
| 3532 inputs[0], inputs[1]); |
| 3533 case wasm::kExprI8x16LtU: |
| 3534 return graph()->NewNode(jsgraph()->machine()->Uint8x16GreaterThan(), |
| 3535 inputs[1], inputs[0]); |
| 3536 case wasm::kExprI8x16LeU: |
| 3537 return graph()->NewNode( |
| 3538 jsgraph()->machine()->Uint8x16GreaterThanOrEqual(), inputs[1], |
| 3539 inputs[0]); |
| 3540 case wasm::kExprI8x16GtU: |
| 3541 return graph()->NewNode(jsgraph()->machine()->Uint8x16GreaterThan(), |
| 3542 inputs[0], inputs[1]); |
| 3543 case wasm::kExprI8x16GeU: |
| 3544 return graph()->NewNode( |
| 3545 jsgraph()->machine()->Uint8x16GreaterThanOrEqual(), inputs[0], |
| 3546 inputs[1]); |
3402 default: | 3547 default: |
3403 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); | 3548 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); |
3404 } | 3549 } |
3405 } | 3550 } |
3406 | 3551 |
3407 Node* WasmGraphBuilder::SimdLaneOp(wasm::WasmOpcode opcode, uint8_t lane, | 3552 Node* WasmGraphBuilder::SimdLaneOp(wasm::WasmOpcode opcode, uint8_t lane, |
3408 const NodeVector& inputs) { | 3553 const NodeVector& inputs) { |
3409 has_simd_ = true; | 3554 has_simd_ = true; |
3410 switch (opcode) { | 3555 switch (opcode) { |
| 3556 case wasm::kExprF32x4ExtractLane: |
| 3557 return graph()->NewNode(jsgraph()->machine()->Float32x4ExtractLane(lane), |
| 3558 inputs[0]); |
| 3559 case wasm::kExprF32x4ReplaceLane: |
| 3560 return graph()->NewNode(jsgraph()->machine()->Float32x4ReplaceLane(lane), |
| 3561 inputs[0], inputs[1]); |
3411 case wasm::kExprI32x4ExtractLane: | 3562 case wasm::kExprI32x4ExtractLane: |
3412 return graph()->NewNode(jsgraph()->common()->Int32x4ExtractLane(lane), | 3563 return graph()->NewNode(jsgraph()->machine()->Int32x4ExtractLane(lane), |
3413 inputs[0]); | 3564 inputs[0]); |
3414 case wasm::kExprI32x4ReplaceLane: | 3565 case wasm::kExprI32x4ReplaceLane: |
3415 return graph()->NewNode(jsgraph()->common()->Int32x4ReplaceLane(lane), | 3566 return graph()->NewNode(jsgraph()->machine()->Int32x4ReplaceLane(lane), |
3416 inputs[0], inputs[1]); | 3567 inputs[0], inputs[1]); |
3417 case wasm::kExprF32x4ExtractLane: | 3568 case wasm::kExprI16x8ExtractLane: |
3418 return graph()->NewNode(jsgraph()->common()->Float32x4ExtractLane(lane), | 3569 return graph()->NewNode(jsgraph()->machine()->Int16x8ExtractLane(lane), |
3419 inputs[0]); | 3570 inputs[0]); |
3420 case wasm::kExprF32x4ReplaceLane: | 3571 case wasm::kExprI16x8ReplaceLane: |
3421 return graph()->NewNode(jsgraph()->common()->Float32x4ReplaceLane(lane), | 3572 return graph()->NewNode(jsgraph()->machine()->Int16x8ReplaceLane(lane), |
| 3573 inputs[0], inputs[1]); |
| 3574 case wasm::kExprI8x16ExtractLane: |
| 3575 return graph()->NewNode(jsgraph()->machine()->Int8x16ExtractLane(lane), |
| 3576 inputs[0]); |
| 3577 case wasm::kExprI8x16ReplaceLane: |
| 3578 return graph()->NewNode(jsgraph()->machine()->Int8x16ReplaceLane(lane), |
3422 inputs[0], inputs[1]); | 3579 inputs[0], inputs[1]); |
3423 default: | 3580 default: |
3424 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); | 3581 return graph()->NewNode(UnsupportedOpcode(opcode), nullptr); |
3425 } | 3582 } |
3426 } | 3583 } |
3427 | 3584 |
3428 static void RecordFunctionCompilation(CodeEventListener::LogEventsAndTags tag, | 3585 static void RecordFunctionCompilation(CodeEventListener::LogEventsAndTags tag, |
3429 Isolate* isolate, Handle<Code> code, | 3586 Isolate* isolate, Handle<Code> code, |
3430 const char* message, uint32_t index, | 3587 const char* message, uint32_t index, |
3431 const wasm::WasmName& module_name, | 3588 const wasm::WasmName& module_name, |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3878 Smi::FromInt(instruction.instr_offset)); | 4035 Smi::FromInt(instruction.instr_offset)); |
3879 fn_protected->set(Code::kTrapDataSize * i + Code::kTrapLandingOffset, | 4036 fn_protected->set(Code::kTrapDataSize * i + Code::kTrapLandingOffset, |
3880 Smi::FromInt(instruction.landing_offset)); | 4037 Smi::FromInt(instruction.landing_offset)); |
3881 } | 4038 } |
3882 return fn_protected; | 4039 return fn_protected; |
3883 } | 4040 } |
3884 | 4041 |
3885 } // namespace compiler | 4042 } // namespace compiler |
3886 } // namespace internal | 4043 } // namespace internal |
3887 } // namespace v8 | 4044 } // namespace v8 |
OLD | NEW |