| 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 MemoryAllocator::GetCommitPageSize(), |
| 28 EXECUTABLE, | 28 EXECUTABLE, NULL); |
| 29 NULL); | |
| 30 } | 29 } |
| 31 | 30 |
| 32 | 31 |
| 33 DeoptimizerData::DeoptimizerData(MemoryAllocator* allocator) | 32 DeoptimizerData::DeoptimizerData(MemoryAllocator* allocator) |
| 34 : allocator_(allocator), | 33 : allocator_(allocator), |
| 35 current_(NULL) { | 34 current_(NULL) { |
| 36 for (int i = 0; i <= Deoptimizer::kLastBailoutType; ++i) { | 35 for (int i = 0; i <= Deoptimizer::kLastBailoutType; ++i) { |
| 37 deopt_entry_code_entries_[i] = -1; | 36 deopt_entry_code_entries_[i] = -1; |
| 38 deopt_entry_code_[i] = AllocateCodeChunk(allocator); | 37 deopt_entry_code_[i] = AllocateCodeChunk(allocator); |
| 39 } | 38 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 } | 80 } |
| 82 | 81 |
| 83 | 82 |
| 84 // No larger than 2K on all platforms | 83 // No larger than 2K on all platforms |
| 85 static const int kDeoptTableMaxEpilogueCodeSize = 2 * KB; | 84 static const int kDeoptTableMaxEpilogueCodeSize = 2 * KB; |
| 86 | 85 |
| 87 | 86 |
| 88 size_t Deoptimizer::GetMaxDeoptTableSize() { | 87 size_t Deoptimizer::GetMaxDeoptTableSize() { |
| 89 int entries_size = | 88 int entries_size = |
| 90 Deoptimizer::kMaxNumberOfEntries * Deoptimizer::table_entry_size_; | 89 Deoptimizer::kMaxNumberOfEntries * Deoptimizer::table_entry_size_; |
| 91 int commit_page_size = static_cast<int>(base::OS::CommitPageSize()); | 90 int commit_page_size = static_cast<int>(MemoryAllocator::GetCommitPageSize()); |
| 92 int page_count = ((kDeoptTableMaxEpilogueCodeSize + entries_size - 1) / | 91 int page_count = ((kDeoptTableMaxEpilogueCodeSize + entries_size - 1) / |
| 93 commit_page_size) + 1; | 92 commit_page_size) + 1; |
| 94 return static_cast<size_t>(commit_page_size * page_count); | 93 return static_cast<size_t>(commit_page_size * page_count); |
| 95 } | 94 } |
| 96 | 95 |
| 97 | 96 |
| 98 Deoptimizer* Deoptimizer::Grab(Isolate* isolate) { | 97 Deoptimizer* Deoptimizer::Grab(Isolate* isolate) { |
| 99 Deoptimizer* result = isolate->deoptimizer_data()->current_; | 98 Deoptimizer* result = isolate->deoptimizer_data()->current_; |
| 100 CHECK_NOT_NULL(result); | 99 CHECK_NOT_NULL(result); |
| 101 result->DeleteFrameDescriptions(); | 100 result->DeleteFrameDescriptions(); |
| (...skipping 3915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4017 CHECK(value_info->IsMaterializedObject()); | 4016 CHECK(value_info->IsMaterializedObject()); |
| 4018 | 4017 |
| 4019 value_info->value_ = | 4018 value_info->value_ = |
| 4020 Handle<Object>(previously_materialized_objects->get(i), isolate_); | 4019 Handle<Object>(previously_materialized_objects->get(i), isolate_); |
| 4021 } | 4020 } |
| 4022 } | 4021 } |
| 4023 } | 4022 } |
| 4024 | 4023 |
| 4025 } // namespace internal | 4024 } // namespace internal |
| 4026 } // namespace v8 | 4025 } // namespace v8 |
| OLD | NEW |