[wasm] Enable wasm loop analysis by default.
Loop analysis results in smaller graphs (fewer phis), thus faster compilation time and better code. R=ahaas@chromium.org BUG= Review URL: https://codereview.chromium.org/1836223002 Cr-Commit-Position: refs/heads/master@{#35103}
This commit is contained in:
parent
6ffbae7f8f
commit
945a2b7a86
@ -352,8 +352,7 @@ Node* WasmGraphBuilder::Merge(unsigned count, Node** controls) {
|
|||||||
Node* WasmGraphBuilder::Phi(wasm::LocalType type, unsigned count, Node** vals,
|
Node* WasmGraphBuilder::Phi(wasm::LocalType type, unsigned count, Node** vals,
|
||||||
Node* control) {
|
Node* control) {
|
||||||
DCHECK(IrOpcode::IsMergeOpcode(control->opcode()));
|
DCHECK(IrOpcode::IsMergeOpcode(control->opcode()));
|
||||||
Node** buf = Realloc(vals, count);
|
Node** buf = Realloc(vals, count, count + 1);
|
||||||
buf = Realloc(buf, count + 1);
|
|
||||||
buf[count] = control;
|
buf[count] = control;
|
||||||
return graph()->NewNode(jsgraph()->common()->Phi(type, count), count + 1,
|
return graph()->NewNode(jsgraph()->common()->Phi(type, count), count + 1,
|
||||||
buf);
|
buf);
|
||||||
@ -363,8 +362,7 @@ Node* WasmGraphBuilder::Phi(wasm::LocalType type, unsigned count, Node** vals,
|
|||||||
Node* WasmGraphBuilder::EffectPhi(unsigned count, Node** effects,
|
Node* WasmGraphBuilder::EffectPhi(unsigned count, Node** effects,
|
||||||
Node* control) {
|
Node* control) {
|
||||||
DCHECK(IrOpcode::IsMergeOpcode(control->opcode()));
|
DCHECK(IrOpcode::IsMergeOpcode(control->opcode()));
|
||||||
Node** buf = Realloc(effects, count);
|
Node** buf = Realloc(effects, count, count + 1);
|
||||||
buf = Realloc(buf, count + 1);
|
|
||||||
buf[count] = control;
|
buf[count] = control;
|
||||||
return graph()->NewNode(jsgraph()->common()->EffectPhi(count), count + 1,
|
return graph()->NewNode(jsgraph()->common()->EffectPhi(count), count + 1,
|
||||||
buf);
|
buf);
|
||||||
@ -976,8 +974,7 @@ Node* WasmGraphBuilder::Return(unsigned count, Node** vals) {
|
|||||||
count = 1;
|
count = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Node** buf = Realloc(vals, count);
|
Node** buf = Realloc(vals, count, count + 2);
|
||||||
buf = Realloc(buf, count + 2);
|
|
||||||
buf[count] = *effect_;
|
buf[count] = *effect_;
|
||||||
buf[count + 1] = *control_;
|
buf[count + 1] = *control_;
|
||||||
Node* ret = graph()->NewNode(jsgraph()->common()->Return(), count + 2, vals);
|
Node* ret = graph()->NewNode(jsgraph()->common()->Return(), count + 2, vals);
|
||||||
@ -1569,7 +1566,7 @@ Node* WasmGraphBuilder::BuildCFuncInstruction(ExternalReference ref,
|
|||||||
*control_);
|
*control_);
|
||||||
|
|
||||||
Node* function = graph()->NewNode(jsgraph()->common()->ExternalConstant(ref));
|
Node* function = graph()->NewNode(jsgraph()->common()->ExternalConstant(ref));
|
||||||
Node** args = Buffer(4);
|
Node** args = Buffer(5);
|
||||||
args[0] = function;
|
args[0] = function;
|
||||||
args[1] = stack_slot_param0;
|
args[1] = stack_slot_param0;
|
||||||
int input_count = 1;
|
int input_count = 1;
|
||||||
@ -1582,7 +1579,6 @@ Node* WasmGraphBuilder::BuildCFuncInstruction(ExternalReference ref,
|
|||||||
*effect_ = graph()->NewNode(store_op1, stack_slot_param1,
|
*effect_ = graph()->NewNode(store_op1, stack_slot_param1,
|
||||||
jsgraph()->Int32Constant(0), input1, *effect_,
|
jsgraph()->Int32Constant(0), input1, *effect_,
|
||||||
*control_);
|
*control_);
|
||||||
args = Realloc(args, 5);
|
|
||||||
args[2] = stack_slot_param1;
|
args[2] = stack_slot_param1;
|
||||||
++input_count;
|
++input_count;
|
||||||
}
|
}
|
||||||
@ -1855,7 +1851,7 @@ Node* WasmGraphBuilder::BuildCCall(MachineSignature* sig, Node** args) {
|
|||||||
const size_t count = 1 + params + extra;
|
const size_t count = 1 + params + extra;
|
||||||
|
|
||||||
// Reallocate the buffer to make space for extra inputs.
|
// Reallocate the buffer to make space for extra inputs.
|
||||||
args = Realloc(args, count);
|
args = Realloc(args, 1 + params, count);
|
||||||
|
|
||||||
// Add effect and control inputs.
|
// Add effect and control inputs.
|
||||||
args[params + 1] = *effect_;
|
args[params + 1] = *effect_;
|
||||||
@ -1876,7 +1872,7 @@ Node* WasmGraphBuilder::BuildWasmCall(wasm::FunctionSig* sig, Node** args) {
|
|||||||
const size_t count = 1 + params + extra;
|
const size_t count = 1 + params + extra;
|
||||||
|
|
||||||
// Reallocate the buffer to make space for extra inputs.
|
// Reallocate the buffer to make space for extra inputs.
|
||||||
args = Realloc(args, count);
|
args = Realloc(args, 1 + params, count);
|
||||||
|
|
||||||
// Add effect and control inputs.
|
// Add effect and control inputs.
|
||||||
args[params + 1] = *effect_;
|
args[params + 1] = *effect_;
|
||||||
|
@ -232,9 +232,9 @@ class WasmGraphBuilder {
|
|||||||
Node* BuildDiv64Call(Node* left, Node* right, ExternalReference ref,
|
Node* BuildDiv64Call(Node* left, Node* right, ExternalReference ref,
|
||||||
MachineType result_type, int trap_zero);
|
MachineType result_type, int trap_zero);
|
||||||
|
|
||||||
Node** Realloc(Node** buffer, size_t count) {
|
Node** Realloc(Node** buffer, size_t old_count, size_t new_count) {
|
||||||
Node** buf = Buffer(count);
|
Node** buf = Buffer(new_count);
|
||||||
if (buf != buffer) memcpy(buf, buffer, count * sizeof(Node*));
|
if (buf != buffer) memcpy(buf, buffer, old_count * sizeof(Node*));
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -468,7 +468,7 @@ DEFINE_INT(trace_wasm_ast_end, 0, "end function for WASM AST trace (exclusive)")
|
|||||||
DEFINE_INT(skip_compiling_wasm_funcs, 0, "start compiling at function N")
|
DEFINE_INT(skip_compiling_wasm_funcs, 0, "start compiling at function N")
|
||||||
DEFINE_BOOL(wasm_break_on_decoder_error, false,
|
DEFINE_BOOL(wasm_break_on_decoder_error, false,
|
||||||
"debug break when wasm decoder encounters an error")
|
"debug break when wasm decoder encounters an error")
|
||||||
DEFINE_BOOL(wasm_loop_assignment_analysis, false,
|
DEFINE_BOOL(wasm_loop_assignment_analysis, true,
|
||||||
"perform loop assignment analysis for WASM")
|
"perform loop assignment analysis for WASM")
|
||||||
|
|
||||||
DEFINE_BOOL(enable_simd_asmjs, false, "enable SIMD.js in asm.js stdlib")
|
DEFINE_BOOL(enable_simd_asmjs, false, "enable SIMD.js in asm.js stdlib")
|
||||||
|
Loading…
Reference in New Issue
Block a user