Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(193)

Side by Side Diff: src/compiler/wasm-compiler.cc

Issue 2226163004: [turbofan] Ensure nodes without kNoThrow have only IfSuccess or IfException uses. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Merge with master Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/js-typed-lowering.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 trap_position_smi, // byte position 242 trap_position_smi, // byte position
243 jsgraph()->ExternalConstant( 243 jsgraph()->ExternalConstant(
244 ExternalReference(f, jsgraph()->isolate())), // ref 244 ExternalReference(f, jsgraph()->isolate())), // ref
245 jsgraph()->Int32Constant(fun->nargs), // arity 245 jsgraph()->Int32Constant(fun->nargs), // arity
246 builder_->HeapConstant(module->instance->context), // context 246 builder_->HeapConstant(module->instance->context), // context
247 *effect_ptr, 247 *effect_ptr,
248 *control_ptr}; 248 *control_ptr};
249 249
250 Node* node = graph()->NewNode( 250 Node* node = graph()->NewNode(
251 common()->Call(desc), static_cast<int>(arraysize(inputs)), inputs); 251 common()->Call(desc), static_cast<int>(arraysize(inputs)), inputs);
252 *control_ptr = node;
253 *effect_ptr = node; 252 *effect_ptr = node;
253 *control_ptr = graph()->NewNode(common()->IfSuccess(), node);
ahaas 2016/08/10 10:34:58 node is a call to Runtime::ThrowWasmError, which h
bgeron 2016/08/10 10:41:56 Nope, that's it! Committing.
254 } 254 }
255 if (false) { 255 if (false) {
256 // End the control flow with a throw 256 // End the control flow with a throw
257 Node* thrw = 257 Node* thrw =
258 graph()->NewNode(common()->Throw(), jsgraph()->ZeroConstant(), 258 graph()->NewNode(common()->Throw(), jsgraph()->ZeroConstant(),
259 *effect_ptr, *control_ptr); 259 *effect_ptr, *control_ptr);
260 end = thrw; 260 end = thrw;
261 } else { 261 } else {
262 // End the control flow with returning 0xdeadbeef 262 // End the control flow with returning 0xdeadbeef
263 Node* ret_value = GetTrapValue(builder_->GetFunctionSignature()); 263 Node* ret_value = GetTrapValue(builder_->GetFunctionSignature());
(...skipping 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after
1655 graph()->NewNode(load_op, stack_slot_result, jsgraph()->Int32Constant(0), 1655 graph()->NewNode(load_op, stack_slot_result, jsgraph()->Int32Constant(0),
1656 *effect_, *control_); 1656 *effect_, *control_);
1657 *effect_ = load; 1657 *effect_ = load;
1658 return load; 1658 return load;
1659 } 1659 }
1660 1660
1661 Node* WasmGraphBuilder::BuildGrowMemory(Node* input) { 1661 Node* WasmGraphBuilder::BuildGrowMemory(Node* input) {
1662 Runtime::FunctionId function_id = Runtime::kWasmGrowMemory; 1662 Runtime::FunctionId function_id = Runtime::kWasmGrowMemory;
1663 const Runtime::Function* function = Runtime::FunctionForId(function_id); 1663 const Runtime::Function* function = Runtime::FunctionForId(function_id);
1664 CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor( 1664 CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor(
1665 jsgraph()->zone(), function_id, function->nargs, Operator::kNoProperties, 1665 jsgraph()->zone(), function_id, function->nargs, Operator::kNoThrow,
1666 CallDescriptor::kNoFlags); 1666 CallDescriptor::kNoFlags);
1667 Node** control_ptr = control_; 1667 Node** control_ptr = control_;
1668 Node** effect_ptr = effect_; 1668 Node** effect_ptr = effect_;
1669 wasm::ModuleEnv* module = module_; 1669 wasm::ModuleEnv* module = module_;
1670 input = BuildChangeUint32ToSmi(input); 1670 input = BuildChangeUint32ToSmi(input);
1671 Node* inputs[] = { 1671 Node* inputs[] = {
1672 jsgraph()->CEntryStubConstant(function->result_size), input, // C entry 1672 jsgraph()->CEntryStubConstant(function->result_size), input, // C entry
1673 jsgraph()->ExternalConstant( 1673 jsgraph()->ExternalConstant(
1674 ExternalReference(function_id, jsgraph()->isolate())), // ref 1674 ExternalReference(function_id, jsgraph()->isolate())), // ref
1675 jsgraph()->Int32Constant(function->nargs), // arity 1675 jsgraph()->Int32Constant(function->nargs), // arity
1676 jsgraph()->HeapConstant(module->instance->context), // context 1676 jsgraph()->HeapConstant(module->instance->context), // context
1677 *effect_ptr, 1677 *effect_ptr,
1678 *control_ptr}; 1678 *control_ptr};
1679 Node* node = graph()->NewNode(jsgraph()->common()->Call(desc), 1679 Node* node = graph()->NewNode(jsgraph()->common()->Call(desc),
1680 static_cast<int>(arraysize(inputs)), inputs); 1680 static_cast<int>(arraysize(inputs)), inputs);
1681 *control_ptr = node;
1682 *effect_ptr = node; 1681 *effect_ptr = node;
1683 node = BuildChangeSmiToInt32(node); 1682 node = BuildChangeSmiToInt32(node);
1684 return node; 1683 return node;
1685 } 1684 }
1686 1685
1687 Node* WasmGraphBuilder::BuildI32DivS(Node* left, Node* right, 1686 Node* WasmGraphBuilder::BuildI32DivS(Node* left, Node* right,
1688 wasm::WasmCodePosition position) { 1687 wasm::WasmCodePosition position) {
1689 MachineOperatorBuilder* m = jsgraph()->machine(); 1688 MachineOperatorBuilder* m = jsgraph()->machine();
1690 trap_->ZeroCheck32(wasm::kTrapDivByZero, right, position); 1689 trap_->ZeroCheck32(wasm::kTrapDivByZero, right, position);
1691 Node* before = *control_; 1690 Node* before = *control_;
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
2222 Node* effect, Node* control) { 2221 Node* effect, Node* control) {
2223 Callable callable = CodeFactory::ToNumber(jsgraph()->isolate()); 2222 Callable callable = CodeFactory::ToNumber(jsgraph()->isolate());
2224 CallDescriptor* desc = Linkage::GetStubCallDescriptor( 2223 CallDescriptor* desc = Linkage::GetStubCallDescriptor(
2225 jsgraph()->isolate(), jsgraph()->zone(), callable.descriptor(), 0, 2224 jsgraph()->isolate(), jsgraph()->zone(), callable.descriptor(), 0,
2226 CallDescriptor::kNoFlags, Operator::kNoProperties); 2225 CallDescriptor::kNoFlags, Operator::kNoProperties);
2227 Node* stub_code = jsgraph()->HeapConstant(callable.code()); 2226 Node* stub_code = jsgraph()->HeapConstant(callable.code());
2228 2227
2229 Node* result = graph()->NewNode(jsgraph()->common()->Call(desc), stub_code, 2228 Node* result = graph()->NewNode(jsgraph()->common()->Call(desc), stub_code,
2230 node, context, effect, control); 2229 node, context, effect, control);
2231 2230
2232 *control_ = result;
2233 *effect_ = result; 2231 *effect_ = result;
2232 *control_ = graph()->NewNode(jsgraph()->common()->IfSuccess(), result);
2234 2233
2235 return result; 2234 return result;
2236 } 2235 }
2237 2236
2238 bool CanCover(Node* value, IrOpcode::Value opcode) { 2237 bool CanCover(Node* value, IrOpcode::Value opcode) {
2239 if (value->opcode() != opcode) return false; 2238 if (value->opcode() != opcode) return false;
2240 bool first = true; 2239 bool first = true;
2241 for (Edge const edge : value->use_edges()) { 2240 for (Edge const edge : value->use_edges()) {
2242 if (NodeProperties::IsControlEdge(edge)) continue; 2241 if (NodeProperties::IsControlEdge(edge)) continue;
2243 if (NodeProperties::IsEffectEdge(edge)) continue; 2242 if (NodeProperties::IsEffectEdge(edge)) continue;
(...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after
3324 function_->code_start_offset), 3323 function_->code_start_offset),
3325 compile_ms); 3324 compile_ms);
3326 } 3325 }
3327 3326
3328 return code; 3327 return code;
3329 } 3328 }
3330 3329
3331 } // namespace compiler 3330 } // namespace compiler
3332 } // namespace internal 3331 } // namespace internal
3333 } // namespace v8 3332 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-typed-lowering.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698