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/assembler-inl.h" | 9 #include "src/assembler-inl.h" |
10 #include "src/base/platform/elapsed-timer.h" | 10 #include "src/base/platform/elapsed-timer.h" |
(...skipping 2838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2849 return mem_buffer_; | 2849 return mem_buffer_; |
2850 } else { | 2850 } else { |
2851 return jsgraph()->RelocatableIntPtrConstant( | 2851 return jsgraph()->RelocatableIntPtrConstant( |
2852 mem_start + offset, RelocInfo::WASM_MEMORY_REFERENCE); | 2852 mem_start + offset, RelocInfo::WASM_MEMORY_REFERENCE); |
2853 } | 2853 } |
2854 } | 2854 } |
2855 | 2855 |
2856 Node* WasmGraphBuilder::CurrentMemoryPages() { | 2856 Node* WasmGraphBuilder::CurrentMemoryPages() { |
2857 // CurrentMemoryPages will not be called from asm.js, hence we cannot be in | 2857 // CurrentMemoryPages will not be called from asm.js, hence we cannot be in |
2858 // lazy-compilation mode, hence the instance will be set. | 2858 // lazy-compilation mode, hence the instance will be set. |
2859 DCHECK_EQ(wasm::kWasmOrigin, module_->module->origin); | 2859 DCHECK_EQ(wasm::kWasmOrigin, module_->module->get_origin()); |
2860 DCHECK_NOT_NULL(module_); | 2860 DCHECK_NOT_NULL(module_); |
2861 DCHECK_NOT_NULL(module_->instance); | 2861 DCHECK_NOT_NULL(module_->instance); |
2862 | 2862 |
2863 Runtime::FunctionId function_id = Runtime::kWasmMemorySize; | 2863 Runtime::FunctionId function_id = Runtime::kWasmMemorySize; |
2864 const Runtime::Function* function = Runtime::FunctionForId(function_id); | 2864 const Runtime::Function* function = Runtime::FunctionForId(function_id); |
2865 CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor( | 2865 CallDescriptor* desc = Linkage::GetRuntimeCallDescriptor( |
2866 jsgraph()->zone(), function_id, function->nargs, Operator::kNoThrow, | 2866 jsgraph()->zone(), function_id, function->nargs, Operator::kNoThrow, |
2867 CallDescriptor::kNoFlags); | 2867 CallDescriptor::kNoFlags); |
2868 Node* inputs[] = { | 2868 Node* inputs[] = { |
2869 jsgraph()->CEntryStubConstant(function->result_size), // C entry | 2869 jsgraph()->CEntryStubConstant(function->result_size), // C entry |
(...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3960 | 3960 |
3961 // Run the compiler pipeline to generate machine code. | 3961 // Run the compiler pipeline to generate machine code. |
3962 CallDescriptor* descriptor = wasm::ModuleEnv::GetWasmCallDescriptor( | 3962 CallDescriptor* descriptor = wasm::ModuleEnv::GetWasmCallDescriptor( |
3963 &compilation_zone_, func_body_.sig); | 3963 &compilation_zone_, func_body_.sig); |
3964 if (jsgraph_->machine()->Is32()) { | 3964 if (jsgraph_->machine()->Is32()) { |
3965 descriptor = | 3965 descriptor = |
3966 module_env_->GetI32WasmCallDescriptor(&compilation_zone_, descriptor); | 3966 module_env_->GetI32WasmCallDescriptor(&compilation_zone_, descriptor); |
3967 } | 3967 } |
3968 job_.reset(Pipeline::NewWasmCompilationJob( | 3968 job_.reset(Pipeline::NewWasmCompilationJob( |
3969 &info_, jsgraph_, descriptor, source_positions, &protected_instructions_, | 3969 &info_, jsgraph_, descriptor, source_positions, &protected_instructions_, |
3970 module_env_->module->origin != wasm::kWasmOrigin)); | 3970 !module_env_->module->is_wasm())); |
3971 ok_ = job_->ExecuteJob() == CompilationJob::SUCCEEDED; | 3971 ok_ = job_->ExecuteJob() == CompilationJob::SUCCEEDED; |
3972 // TODO(bradnelson): Improve histogram handling of size_t. | 3972 // TODO(bradnelson): Improve histogram handling of size_t. |
3973 // TODO(ahaas): The counters are not thread-safe at the moment. | 3973 // TODO(ahaas): The counters are not thread-safe at the moment. |
3974 // isolate_->counters()->wasm_compile_function_peak_memory_bytes() | 3974 // isolate_->counters()->wasm_compile_function_peak_memory_bytes() |
3975 // ->AddSample( | 3975 // ->AddSample( |
3976 // static_cast<int>(jsgraph->graph()->zone()->allocation_size())); | 3976 // static_cast<int>(jsgraph->graph()->zone()->allocation_size())); |
3977 | 3977 |
3978 if (FLAG_trace_wasm_decode_time) { | 3978 if (FLAG_trace_wasm_decode_time) { |
3979 double pipeline_ms = pipeline_timer.Elapsed().InMillisecondsF(); | 3979 double pipeline_ms = pipeline_timer.Elapsed().InMillisecondsF(); |
3980 PrintF( | 3980 PrintF( |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4035 wasm::ErrorThrower* thrower, Isolate* isolate, | 4035 wasm::ErrorThrower* thrower, Isolate* isolate, |
4036 wasm::ModuleBytesEnv* module_env, const wasm::WasmFunction* function) { | 4036 wasm::ModuleBytesEnv* module_env, const wasm::WasmFunction* function) { |
4037 WasmCompilationUnit unit(isolate, module_env, function); | 4037 WasmCompilationUnit unit(isolate, module_env, function); |
4038 unit.ExecuteCompilation(); | 4038 unit.ExecuteCompilation(); |
4039 return unit.FinishCompilation(thrower); | 4039 return unit.FinishCompilation(thrower); |
4040 } | 4040 } |
4041 | 4041 |
4042 } // namespace compiler | 4042 } // namespace compiler |
4043 } // namespace internal | 4043 } // namespace internal |
4044 } // namespace v8 | 4044 } // namespace v8 |
OLD | NEW |