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 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1696 Node* result = BuildChangeSmiToInt32(call); | 1696 Node* result = BuildChangeSmiToInt32(call); |
1697 | 1697 |
1698 result = check_input_range.Phi(MachineRepresentation::kWord32, result, | 1698 result = check_input_range.Phi(MachineRepresentation::kWord32, result, |
1699 jsgraph()->Int32Constant(-1)); | 1699 jsgraph()->Int32Constant(-1)); |
1700 *effect_ = graph()->NewNode(jsgraph()->common()->EffectPhi(2), call, *effect_, | 1700 *effect_ = graph()->NewNode(jsgraph()->common()->EffectPhi(2), call, *effect_, |
1701 check_input_range.merge); | 1701 check_input_range.merge); |
1702 *control_ = check_input_range.merge; | 1702 *control_ = check_input_range.merge; |
1703 return result; | 1703 return result; |
1704 } | 1704 } |
1705 | 1705 |
1706 Node* WasmGraphBuilder::Throw(Node* input) { | |
1707 MachineOperatorBuilder* machine = jsgraph()->machine(); | |
1708 | |
1709 // Pass the thrown value as two SMIs: | |
titzer
2016/09/15 12:53:28
Please leave a TODO here, since I think we all agr
John
2016/09/15 14:03:08
Done.
| |
1710 // | |
1711 // upper = static_cast<uint32_t>(input) >> 16; | |
1712 // lower = input & 0xFFFF; | |
1713 Node* upper = BuildChangeInt32ToSmi( | |
1714 graph()->NewNode(machine->Word32Shr(), input, Int32Constant(16))); | |
1715 Node* lower = BuildChangeInt32ToSmi( | |
1716 graph()->NewNode(machine->Word32And(), input, Int32Constant(0xFFFFu))); | |
1717 | |
1718 Node* parameters[] = {lower, upper}; // thrown value | |
1719 return BuildCallToRuntime(Runtime::kWasmThrow, jsgraph(), | |
1720 module_->instance->context, parameters, | |
1721 arraysize(parameters), effect_, *control_); | |
1722 } | |
1723 | |
1706 Node* WasmGraphBuilder::BuildI32DivS(Node* left, Node* right, | 1724 Node* WasmGraphBuilder::BuildI32DivS(Node* left, Node* right, |
1707 wasm::WasmCodePosition position) { | 1725 wasm::WasmCodePosition position) { |
1708 MachineOperatorBuilder* m = jsgraph()->machine(); | 1726 MachineOperatorBuilder* m = jsgraph()->machine(); |
1709 trap_->ZeroCheck32(wasm::kTrapDivByZero, right, position); | 1727 trap_->ZeroCheck32(wasm::kTrapDivByZero, right, position); |
1710 Node* before = *control_; | 1728 Node* before = *control_; |
1711 Node* denom_is_m1; | 1729 Node* denom_is_m1; |
1712 Node* denom_is_not_m1; | 1730 Node* denom_is_not_m1; |
1713 Branch( | 1731 Branch( |
1714 graph()->NewNode(m->Word32Equal(), right, jsgraph()->Int32Constant(-1)), | 1732 graph()->NewNode(m->Word32Equal(), right, jsgraph()->Int32Constant(-1)), |
1715 &denom_is_m1, &denom_is_not_m1); | 1733 &denom_is_m1, &denom_is_not_m1); |
(...skipping 1563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3279 function_->code_start_offset), | 3297 function_->code_start_offset), |
3280 compile_ms); | 3298 compile_ms); |
3281 } | 3299 } |
3282 | 3300 |
3283 return code; | 3301 return code; |
3284 } | 3302 } |
3285 | 3303 |
3286 } // namespace compiler | 3304 } // namespace compiler |
3287 } // namespace internal | 3305 } // namespace internal |
3288 } // namespace v8 | 3306 } // namespace v8 |
OLD | NEW |