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/optional.h" | 10 #include "src/base/optional.h" |
(...skipping 2812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2823 return mem_buffer_; | 2823 return mem_buffer_; |
2824 } else { | 2824 } else { |
2825 return jsgraph()->RelocatableIntPtrConstant( | 2825 return jsgraph()->RelocatableIntPtrConstant( |
2826 static_cast<uintptr_t>(mem_start + offset), | 2826 static_cast<uintptr_t>(mem_start + offset), |
2827 RelocInfo::WASM_MEMORY_REFERENCE); | 2827 RelocInfo::WASM_MEMORY_REFERENCE); |
2828 } | 2828 } |
2829 } | 2829 } |
2830 | 2830 |
2831 Node* WasmGraphBuilder::CurrentMemoryPages() { | 2831 Node* WasmGraphBuilder::CurrentMemoryPages() { |
2832 // CurrentMemoryPages can not be called from asm.js. | 2832 // CurrentMemoryPages can not be called from asm.js. |
2833 DCHECK_EQ(wasm::kWasmOrigin, module_->module->get_origin()); | 2833 DCHECK_EQ(wasm::kWasmOrigin, module_->module->origin()); |
2834 SetNeedsStackCheck(); | 2834 SetNeedsStackCheck(); |
2835 Node* call = BuildCallToRuntime(Runtime::kWasmMemorySize, nullptr, 0); | 2835 Node* call = BuildCallToRuntime(Runtime::kWasmMemorySize, nullptr, 0); |
2836 Node* result = BuildChangeSmiToInt32(call); | 2836 Node* result = BuildChangeSmiToInt32(call); |
2837 return result; | 2837 return result; |
2838 } | 2838 } |
2839 | 2839 |
2840 Node* WasmGraphBuilder::MemSize() { | 2840 Node* WasmGraphBuilder::MemSize() { |
2841 DCHECK_NOT_NULL(module_); | 2841 DCHECK_NOT_NULL(module_); |
2842 if (mem_size_) return mem_size_; | 2842 if (mem_size_) return mem_size_; |
2843 uint32_t size = module_->instance ? module_->instance->mem_size : 0; | 2843 uint32_t size = module_->instance ? module_->instance->mem_size : 0; |
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4003 } | 4003 } |
4004 info_.reset(new CompilationInfo( | 4004 info_.reset(new CompilationInfo( |
4005 GetDebugName(compilation_zone_.get(), func_name_, func_index_), | 4005 GetDebugName(compilation_zone_.get(), func_name_, func_index_), |
4006 isolate_, compilation_zone_.get(), | 4006 isolate_, compilation_zone_.get(), |
4007 Code::ComputeFlags(Code::WASM_FUNCTION))); | 4007 Code::ComputeFlags(Code::WASM_FUNCTION))); |
4008 ZoneVector<trap_handler::ProtectedInstructionData> protected_instructions( | 4008 ZoneVector<trap_handler::ProtectedInstructionData> protected_instructions( |
4009 compilation_zone_.get()); | 4009 compilation_zone_.get()); |
4010 | 4010 |
4011 job_.reset(Pipeline::NewWasmCompilationJob( | 4011 job_.reset(Pipeline::NewWasmCompilationJob( |
4012 info_.get(), jsgraph_, descriptor, source_positions, | 4012 info_.get(), jsgraph_, descriptor, source_positions, |
4013 &protected_instructions, module_env_->module->get_origin())); | 4013 &protected_instructions, module_env_->module->origin())); |
4014 ok_ = job_->ExecuteJob() == CompilationJob::SUCCEEDED; | 4014 ok_ = job_->ExecuteJob() == CompilationJob::SUCCEEDED; |
4015 // TODO(bradnelson): Improve histogram handling of size_t. | 4015 // TODO(bradnelson): Improve histogram handling of size_t. |
4016 if (is_sync_) | 4016 if (is_sync_) |
4017 // TODO(karlschimpf): Make this work when asynchronous. | 4017 // TODO(karlschimpf): Make this work when asynchronous. |
4018 // https://bugs.chromium.org/p/v8/issues/detail?id=6361 | 4018 // https://bugs.chromium.org/p/v8/issues/detail?id=6361 |
4019 isolate_->counters() | 4019 isolate_->counters() |
4020 ->wasm_compile_function_peak_memory_bytes() | 4020 ->wasm_compile_function_peak_memory_bytes() |
4021 ->AddSample( | 4021 ->AddSample( |
4022 static_cast<int>(jsgraph_->graph()->zone()->allocation_size())); | 4022 static_cast<int>(jsgraph_->graph()->zone()->allocation_size())); |
4023 | 4023 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4089 wasm::ModuleBytesEnv* module_env, const wasm::WasmFunction* function) { | 4089 wasm::ModuleBytesEnv* module_env, const wasm::WasmFunction* function) { |
4090 WasmCompilationUnit unit(isolate, module_env, function, | 4090 WasmCompilationUnit unit(isolate, module_env, function, |
4091 CEntryStub(isolate, 1).GetCode()); | 4091 CEntryStub(isolate, 1).GetCode()); |
4092 unit.ExecuteCompilation(); | 4092 unit.ExecuteCompilation(); |
4093 return unit.FinishCompilation(thrower); | 4093 return unit.FinishCompilation(thrower); |
4094 } | 4094 } |
4095 | 4095 |
4096 } // namespace compiler | 4096 } // namespace compiler |
4097 } // namespace internal | 4097 } // namespace internal |
4098 } // namespace v8 | 4098 } // namespace v8 |
OLD | NEW |