Chromium Code Reviews| Index: src/compiler/wasm-compiler.cc |
| diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc |
| index af4ee67c4391ca94e33728a8174543d37068a07d..976568af5178748a9a4b7aed2129e098aa0f0a10 100644 |
| --- a/src/compiler/wasm-compiler.cc |
| +++ b/src/compiler/wasm-compiler.cc |
| @@ -388,6 +388,40 @@ Node* WasmGraphBuilder::Int64Constant(int64_t value) { |
| return jsgraph()->Int64Constant(value); |
| } |
| +void WasmGraphBuilder::StackCheck(wasm::WasmCodePosition position) { |
| + // We do not generate stack checks for cctests. |
| + if (module_ && !module_->instance->context.is_null()) { |
| + Node* limit = graph()->NewNode( |
| + jsgraph()->machine()->Load(MachineType::Pointer()), |
| + jsgraph()->ExternalConstant( |
| + ExternalReference::address_of_stack_limit(jsgraph()->isolate())), |
| + jsgraph()->IntPtrConstant(0), *effect_, *control_); |
| + Node* pointer = graph()->NewNode(jsgraph()->machine()->LoadStackPointer()); |
| + |
| + Node* check = |
| + graph()->NewNode(jsgraph()->machine()->UintLessThan(), limit, pointer); |
| + |
| + Diamond stack_check(graph(), jsgraph()->common(), check, BranchHint::kTrue); |
| + |
| + Node* effect_true = *effect_; |
| + |
| + Node* effect_false; |
| + // Generate a call to the runtime if there is a stack check failure. |
| + { |
| + Node* node = BuildCallToRuntime(Runtime::kStackGuard, jsgraph(), |
| + module_->instance->context, nullptr, 0, |
| + effect_, control_); |
|
Michael Starzinger
2016/08/18 17:22:48
This should be s/control_/diamond.if_false/ here,
ahaas
2016/08/19 07:13:42
Thanks for noticing this. I fixed it now.
|
| + effect_false = node; |
| + } |
| + |
| + Node* ephi = graph()->NewNode(jsgraph()->common()->EffectPhi(2), |
| + effect_true, effect_false, stack_check.merge); |
| + |
| + *control_ = stack_check.merge; |
| + *effect_ = ephi; |
| + } |
| +} |
| + |
| Node* WasmGraphBuilder::Binop(wasm::WasmOpcode opcode, Node* left, Node* right, |
| wasm::WasmCodePosition position) { |
| const Operator* op; |