Chromium Code Reviews| Index: src/compiler/wasm-compiler.cc |
| diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc |
| index 1b03d2eb13a2c637e06f7989dddfea83a30cfb02..36f196740d8e57fe97b0498254a3acc849d5b910 100644 |
| --- a/src/compiler/wasm-compiler.cc |
| +++ b/src/compiler/wasm-compiler.cc |
| @@ -270,10 +270,16 @@ class WasmTrapHelper : public ZoneObject { |
| return jsgraph()->Float32Constant(bit_cast<float>(0xdeadbeef)); |
| case wasm::kWasmF64: |
| return jsgraph()->Float64Constant(bit_cast<double>(0xdeadbeefdeadbeef)); |
| - break; |
| + // We can't always set SIMD types to specific bit patterns. Just zero |
| + // them out. |
| case wasm::kWasmS128: |
| - return builder_->CreateS128Value(0xdeadbeef); |
| - break; |
| + return builder_->Simd128Zero(); |
| + case wasm::kWasmS1x4: |
| + return builder_->Simd1x4Zero(); |
|
gdeepti
2017/02/24 14:18:11
Would it be better to have these fall through to S
bbudge
2017/02/24 18:33:51
It does seem like a lot of trouble to support a sc
|
| + case wasm::kWasmS1x8: |
| + return builder_->Simd1x8Zero(); |
| + case wasm::kWasmS1x16: |
| + return builder_->Simd1x16Zero(); |
| default: |
| UNREACHABLE(); |
| return nullptr; |
| @@ -3347,13 +3353,24 @@ void WasmGraphBuilder::SetSourcePosition(Node* node, |
| source_position_table_->SetSourcePosition(node, SourcePosition(position)); |
| } |
| -Node* WasmGraphBuilder::CreateS128Value(int32_t value) { |
| - // TODO(gdeepti): Introduce Simd128Constant to common-operator.h and use |
| - // instead of creating a SIMD Value. |
| +Node* WasmGraphBuilder::Simd128Zero() { |
| + has_simd_ = true; |
| + return graph()->NewNode(jsgraph()->machine()->Simd128Zero()); |
| +} |
| + |
| +Node* WasmGraphBuilder::Simd1x4Zero() { |
| + has_simd_ = true; |
| + return graph()->NewNode(jsgraph()->machine()->Simd1x4Zero()); |
| +} |
| + |
| +Node* WasmGraphBuilder::Simd1x8Zero() { |
| + has_simd_ = true; |
| + return graph()->NewNode(jsgraph()->machine()->Simd1x8Zero()); |
| +} |
| + |
| +Node* WasmGraphBuilder::Simd1x16Zero() { |
| has_simd_ = true; |
| - return graph()->NewNode(jsgraph()->machine()->CreateInt32x4(), |
| - Int32Constant(value), Int32Constant(value), |
| - Int32Constant(value), Int32Constant(value)); |
| + return graph()->NewNode(jsgraph()->machine()->Simd1x16Zero()); |
| } |
| Node* WasmGraphBuilder::SimdOp(wasm::WasmOpcode opcode, |
| @@ -3361,8 +3378,8 @@ Node* WasmGraphBuilder::SimdOp(wasm::WasmOpcode opcode, |
| has_simd_ = true; |
| switch (opcode) { |
| case wasm::kExprF32x4Splat: |
| - return graph()->NewNode(jsgraph()->machine()->CreateFloat32x4(), |
| - inputs[0], inputs[0], inputs[0], inputs[0]); |
| + return graph()->NewNode(jsgraph()->machine()->Float32x4Splat(), |
| + inputs[0]); |
| case wasm::kExprF32x4SConvertI32x4: |
| return graph()->NewNode(jsgraph()->machine()->Float32x4FromInt32x4(), |
| inputs[0]); |
| @@ -3386,8 +3403,7 @@ Node* WasmGraphBuilder::SimdOp(wasm::WasmOpcode opcode, |
| return graph()->NewNode(jsgraph()->machine()->Float32x4NotEqual(), |
| inputs[0], inputs[1]); |
| case wasm::kExprI32x4Splat: |
| - return graph()->NewNode(jsgraph()->machine()->CreateInt32x4(), inputs[0], |
| - inputs[0], inputs[0], inputs[0]); |
| + return graph()->NewNode(jsgraph()->machine()->Int32x4Splat(), inputs[0]); |
| case wasm::kExprI32x4SConvertF32x4: |
| return graph()->NewNode(jsgraph()->machine()->Int32x4FromFloat32x4(), |
| inputs[0]); |
| @@ -3450,9 +3466,7 @@ Node* WasmGraphBuilder::SimdOp(wasm::WasmOpcode opcode, |
| jsgraph()->machine()->Uint32x4GreaterThanOrEqual(), inputs[0], |
| inputs[1]); |
| case wasm::kExprI16x8Splat: |
| - return graph()->NewNode(jsgraph()->machine()->CreateInt16x8(), inputs[0], |
| - inputs[0], inputs[0], inputs[0], inputs[0], |
| - inputs[0], inputs[0], inputs[0]); |
| + return graph()->NewNode(jsgraph()->machine()->Int16x8Splat(), inputs[0]); |
| case wasm::kExprI16x8Neg: |
| return graph()->NewNode(jsgraph()->machine()->Int16x8Neg(), inputs[0]); |
| case wasm::kExprI16x8Add: |
| @@ -3521,11 +3535,7 @@ Node* WasmGraphBuilder::SimdOp(wasm::WasmOpcode opcode, |
| jsgraph()->machine()->Uint16x8GreaterThanOrEqual(), inputs[0], |
| inputs[1]); |
| case wasm::kExprI8x16Splat: |
| - return graph()->NewNode(jsgraph()->machine()->CreateInt8x16(), inputs[0], |
| - inputs[0], inputs[0], inputs[0], inputs[0], |
| - inputs[0], inputs[0], inputs[0], inputs[0], |
| - inputs[0], inputs[0], inputs[0], inputs[0], |
| - inputs[0], inputs[0], inputs[0]); |
| + return graph()->NewNode(jsgraph()->machine()->Int8x16Splat(), inputs[0]); |
| case wasm::kExprI8x16Neg: |
| return graph()->NewNode(jsgraph()->machine()->Int8x16Neg(), inputs[0]); |
| case wasm::kExprI8x16Add: |