OLD | NEW |
---|---|
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/deoptimizer.h" | 5 #include "src/deoptimizer.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
11 #include "src/codegen.h" | 11 #include "src/codegen.h" |
12 #include "src/disasm.h" | 12 #include "src/disasm.h" |
13 #include "src/frames-inl.h" | 13 #include "src/frames-inl.h" |
14 #include "src/full-codegen/full-codegen.h" | 14 #include "src/full-codegen/full-codegen.h" |
15 #include "src/global-handles.h" | 15 #include "src/global-handles.h" |
16 #include "src/interpreter/interpreter.h" | 16 #include "src/interpreter/interpreter.h" |
17 #include "src/macro-assembler.h" | 17 #include "src/macro-assembler.h" |
18 #include "src/tracing/trace-event.h" | 18 #include "src/tracing/trace-event.h" |
19 #include "src/v8.h" | 19 #include "src/v8.h" |
20 | 20 |
21 | 21 |
22 namespace v8 { | 22 namespace v8 { |
23 namespace internal { | 23 namespace internal { |
24 | 24 |
25 static MemoryChunk* AllocateCodeChunk(MemoryAllocator* allocator) { | 25 static MemoryChunk* AllocateCodeChunk(MemoryAllocator* allocator) { |
26 return allocator->AllocateChunk(Deoptimizer::GetMaxDeoptTableSize(), | 26 return allocator->AllocateChunk(Deoptimizer::GetMaxDeoptTableSize(), |
27 base::OS::CommitPageSize(), | 27 FLAG_target_os_page_size != 0 |
Michael Lippautz
2016/11/14 09:24:43
The deoptimizer already uses the allocator here, s
| |
28 EXECUTABLE, | 28 ? FLAG_target_os_page_size |
29 NULL); | 29 : base::OS::CommitPageSize(), |
30 EXECUTABLE, NULL); | |
30 } | 31 } |
31 | 32 |
32 | 33 |
33 DeoptimizerData::DeoptimizerData(MemoryAllocator* allocator) | 34 DeoptimizerData::DeoptimizerData(MemoryAllocator* allocator) |
34 : allocator_(allocator), | 35 : allocator_(allocator), |
35 current_(NULL) { | 36 current_(NULL) { |
36 for (int i = 0; i <= Deoptimizer::kLastBailoutType; ++i) { | 37 for (int i = 0; i <= Deoptimizer::kLastBailoutType; ++i) { |
37 deopt_entry_code_entries_[i] = -1; | 38 deopt_entry_code_entries_[i] = -1; |
38 deopt_entry_code_[i] = AllocateCodeChunk(allocator); | 39 deopt_entry_code_[i] = AllocateCodeChunk(allocator); |
39 } | 40 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
81 } | 82 } |
82 | 83 |
83 | 84 |
84 // No larger than 2K on all platforms | 85 // No larger than 2K on all platforms |
85 static const int kDeoptTableMaxEpilogueCodeSize = 2 * KB; | 86 static const int kDeoptTableMaxEpilogueCodeSize = 2 * KB; |
86 | 87 |
87 | 88 |
88 size_t Deoptimizer::GetMaxDeoptTableSize() { | 89 size_t Deoptimizer::GetMaxDeoptTableSize() { |
89 int entries_size = | 90 int entries_size = |
90 Deoptimizer::kMaxNumberOfEntries * Deoptimizer::table_entry_size_; | 91 Deoptimizer::kMaxNumberOfEntries * Deoptimizer::table_entry_size_; |
91 int commit_page_size = static_cast<int>(base::OS::CommitPageSize()); | 92 int commit_page_size = static_cast<int>(FLAG_target_os_page_size != 0 |
93 ? FLAG_target_os_page_size | |
94 : base::OS::CommitPageSize()); | |
92 int page_count = ((kDeoptTableMaxEpilogueCodeSize + entries_size - 1) / | 95 int page_count = ((kDeoptTableMaxEpilogueCodeSize + entries_size - 1) / |
93 commit_page_size) + 1; | 96 commit_page_size) + 1; |
94 return static_cast<size_t>(commit_page_size * page_count); | 97 return static_cast<size_t>(commit_page_size * page_count); |
95 } | 98 } |
96 | 99 |
97 | 100 |
98 Deoptimizer* Deoptimizer::Grab(Isolate* isolate) { | 101 Deoptimizer* Deoptimizer::Grab(Isolate* isolate) { |
99 Deoptimizer* result = isolate->deoptimizer_data()->current_; | 102 Deoptimizer* result = isolate->deoptimizer_data()->current_; |
100 CHECK_NOT_NULL(result); | 103 CHECK_NOT_NULL(result); |
101 result->DeleteFrameDescriptions(); | 104 result->DeleteFrameDescriptions(); |
(...skipping 3916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4018 CHECK(value_info->IsMaterializedObject()); | 4021 CHECK(value_info->IsMaterializedObject()); |
4019 | 4022 |
4020 value_info->value_ = | 4023 value_info->value_ = |
4021 Handle<Object>(previously_materialized_objects->get(i), isolate_); | 4024 Handle<Object>(previously_materialized_objects->get(i), isolate_); |
4022 } | 4025 } |
4023 } | 4026 } |
4024 } | 4027 } |
4025 | 4028 |
4026 } // namespace internal | 4029 } // namespace internal |
4027 } // namespace v8 | 4030 } // namespace v8 |
OLD | NEW |