Commit 535a5f96 authored by Mircea Trofin's avatar Mircea Trofin Committed by Commit Bot

[wasm] Disabling wasm-opts

It appears we actually get a compile time boost, and sometimes a 
runtime boost, at the cost of some reloc info growth.

Bug: 
Change-Id: I1d1dc48f364e6611f895ebd00f86451199dd8626
Reviewed-on: https://chromium-review.googlesource.com/544713
Commit-Queue: Mircea Trofin <mtrofin@chromium.org>
Reviewed-by: 's avatarBrad Nelson <bradnelson@chromium.org>
Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46302}
parent e4753d28
......@@ -75,6 +75,7 @@
#include "src/register-configuration.h"
#include "src/trap-handler/trap-handler.h"
#include "src/utils.h"
#include "src/wasm/wasm-module.h"
namespace v8 {
namespace internal {
......@@ -733,7 +734,7 @@ class PipelineWasmCompilationJob final : public CompilationJob {
CompilationInfo* info, JSGraph* jsgraph, CallDescriptor* descriptor,
SourcePositionTable* source_positions,
ZoneVector<trap_handler::ProtectedInstructionData>* protected_insts,
bool allow_signalling_nan)
wasm::ModuleOrigin wasm_origin)
: CompilationJob(info->isolate(), info, "TurboFan",
State::kReadyToExecute),
zone_stats_(info->isolate()->allocator()),
......@@ -742,7 +743,7 @@ class PipelineWasmCompilationJob final : public CompilationJob {
source_positions, protected_insts),
pipeline_(&data_),
linkage_(descriptor),
allow_signalling_nan_(allow_signalling_nan) {}
wasm_origin_(wasm_origin) {}
protected:
Status PrepareJobImpl() final;
......@@ -757,7 +758,7 @@ class PipelineWasmCompilationJob final : public CompilationJob {
PipelineData data_;
PipelineImpl pipeline_;
Linkage linkage_;
bool allow_signalling_nan_;
wasm::ModuleOrigin wasm_origin_;
};
PipelineWasmCompilationJob::Status
......@@ -775,15 +776,15 @@ PipelineWasmCompilationJob::ExecuteJobImpl() {
}
pipeline_.RunPrintAndVerify("Machine", true);
if (FLAG_wasm_opt) {
if (FLAG_wasm_opt || wasm_origin_ == wasm::ModuleOrigin::kAsmJsOrigin) {
PipelineData* data = &data_;
PipelineRunScope scope(data, "Wasm optimization");
JSGraphReducer graph_reducer(data->jsgraph(), scope.zone());
DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
data->common());
ValueNumberingReducer value_numbering(scope.zone(), data->graph()->zone());
MachineOperatorReducer machine_reducer(data->jsgraph(),
allow_signalling_nan_);
MachineOperatorReducer machine_reducer(
data->jsgraph(), wasm_origin_ == wasm::ModuleOrigin::kAsmJsOrigin);
CommonOperatorReducer common_reducer(&graph_reducer, data->graph(),
data->common(), data->machine());
AddReducer(data, &graph_reducer, &dead_code_elimination);
......@@ -1886,10 +1887,10 @@ CompilationJob* Pipeline::NewWasmCompilationJob(
CompilationInfo* info, JSGraph* jsgraph, CallDescriptor* descriptor,
SourcePositionTable* source_positions,
ZoneVector<trap_handler::ProtectedInstructionData>* protected_instructions,
bool allow_signalling_nan) {
return new PipelineWasmCompilationJob(
info, jsgraph, descriptor, source_positions, protected_instructions,
allow_signalling_nan);
wasm::ModuleOrigin wasm_origin) {
return new PipelineWasmCompilationJob(info, jsgraph, descriptor,
source_positions,
protected_instructions, wasm_origin);
}
bool Pipeline::AllocateRegistersForTesting(const RegisterConfiguration* config,
......
......@@ -22,6 +22,10 @@ namespace trap_handler {
struct ProtectedInstructionData;
} // namespace trap_handler
namespace wasm {
enum ModuleOrigin : uint8_t;
} // namespace wasm
namespace compiler {
class CallDescriptor;
......@@ -43,7 +47,7 @@ class Pipeline : public AllStatic {
SourcePositionTable* source_positions,
ZoneVector<trap_handler::ProtectedInstructionData>*
protected_instructions,
bool wasm_origin);
wasm::ModuleOrigin wasm_origin);
// Run the pipeline on a machine graph and generate code. The {schedule} must
// be valid, hence the given {graph} does not need to be schedulable.
......
......@@ -4010,7 +4010,7 @@ void WasmCompilationUnit::ExecuteCompilation() {
job_.reset(Pipeline::NewWasmCompilationJob(
info_.get(), jsgraph_, descriptor, source_positions,
&protected_instructions, !module_env_->module->is_wasm()));
&protected_instructions, module_env_->module->get_origin()));
ok_ = job_->ExecuteJob() == CompilationJob::SUCCEEDED;
// TODO(bradnelson): Improve histogram handling of size_t.
if (is_sync_)
......
......@@ -567,7 +567,7 @@ DEFINE_BOOL(experimental_wasm_mv, false,
DEFINE_BOOL(experimental_wasm_atomics, false,
"enable prototype atomic opcodes for wasm")
DEFINE_BOOL(wasm_opt, true, "enable wasm optimization")
DEFINE_BOOL(wasm_opt, false, "enable wasm optimization")
DEFINE_BOOL(wasm_no_bounds_checks, false,
"disable bounds checks (performance testing only)")
DEFINE_BOOL(wasm_no_stack_checks, false,
......
......@@ -612,7 +612,8 @@ class WasmFunctionCompiler : private GraphAndBuilders {
CompilationInfo info(comp_name, this->isolate(), this->zone(),
Code::ComputeFlags(Code::WASM_FUNCTION));
std::unique_ptr<CompilationJob> job(Pipeline::NewWasmCompilationJob(
&info, &jsgraph, desc, &source_position_table_, nullptr, false));
&info, &jsgraph, desc, &source_position_table_, nullptr,
ModuleOrigin::kAsmJsOrigin));
if (job->ExecuteJob() != CompilationJob::SUCCEEDED ||
job->FinalizeJob() != CompilationJob::SUCCEEDED)
return Handle<Code>::null();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment