Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(387)

Side by Side Diff: src/deoptimizer.cc

Issue 358363002: Move platform abstraction to base library (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/disasm.h" 10 #include "src/disasm.h"
11 #include "src/full-codegen.h" 11 #include "src/full-codegen.h"
12 #include "src/global-handles.h" 12 #include "src/global-handles.h"
13 #include "src/macro-assembler.h" 13 #include "src/macro-assembler.h"
14 #include "src/prettyprinter.h" 14 #include "src/prettyprinter.h"
15 15
16 16
17 namespace v8 { 17 namespace v8 {
18 namespace internal { 18 namespace internal {
19 19
20 static MemoryChunk* AllocateCodeChunk(MemoryAllocator* allocator) { 20 static MemoryChunk* AllocateCodeChunk(MemoryAllocator* allocator) {
21 return allocator->AllocateChunk(Deoptimizer::GetMaxDeoptTableSize(), 21 return allocator->AllocateChunk(Deoptimizer::GetMaxDeoptTableSize(),
22 OS::CommitPageSize(), 22 base::OS::CommitPageSize(),
23 #if defined(__native_client__) 23 #if defined(__native_client__)
24 // The Native Client port of V8 uses an interpreter, 24 // The Native Client port of V8 uses an interpreter,
25 // so code pages don't need PROT_EXEC. 25 // so code pages don't need PROT_EXEC.
26 NOT_EXECUTABLE, 26 NOT_EXECUTABLE,
27 #else 27 #else
28 EXECUTABLE, 28 EXECUTABLE,
29 #endif 29 #endif
30 NULL); 30 NULL);
31 } 31 }
32 32
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } 94 }
95 95
96 96
97 // No larger than 2K on all platforms 97 // No larger than 2K on all platforms
98 static const int kDeoptTableMaxEpilogueCodeSize = 2 * KB; 98 static const int kDeoptTableMaxEpilogueCodeSize = 2 * KB;
99 99
100 100
101 size_t Deoptimizer::GetMaxDeoptTableSize() { 101 size_t Deoptimizer::GetMaxDeoptTableSize() {
102 int entries_size = 102 int entries_size =
103 Deoptimizer::kMaxNumberOfEntries * Deoptimizer::table_entry_size_; 103 Deoptimizer::kMaxNumberOfEntries * Deoptimizer::table_entry_size_;
104 int commit_page_size = static_cast<int>(OS::CommitPageSize()); 104 int commit_page_size = static_cast<int>(base::OS::CommitPageSize());
105 int page_count = ((kDeoptTableMaxEpilogueCodeSize + entries_size - 1) / 105 int page_count = ((kDeoptTableMaxEpilogueCodeSize + entries_size - 1) /
106 commit_page_size) + 1; 106 commit_page_size) + 1;
107 return static_cast<size_t>(commit_page_size * page_count); 107 return static_cast<size_t>(commit_page_size * page_count);
108 } 108 }
109 109
110 110
111 Deoptimizer* Deoptimizer::Grab(Isolate* isolate) { 111 Deoptimizer* Deoptimizer::Grab(Isolate* isolate) {
112 Deoptimizer* result = isolate->deoptimizer_data()->current_; 112 Deoptimizer* result = isolate->deoptimizer_data()->current_;
113 CHECK_NE(result, NULL); 113 CHECK_NE(result, NULL);
114 result->DeleteFrameDescriptions(); 114 result->DeleteFrameDescriptions();
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 732
733 733
734 // We rely on this function not causing a GC. It is called from generated code 734 // We rely on this function not causing a GC. It is called from generated code
735 // without having a real stack frame in place. 735 // without having a real stack frame in place.
736 void Deoptimizer::DoComputeOutputFrames() { 736 void Deoptimizer::DoComputeOutputFrames() {
737 // Print some helpful diagnostic information. 737 // Print some helpful diagnostic information.
738 if (FLAG_log_timer_events && 738 if (FLAG_log_timer_events &&
739 compiled_code_->kind() == Code::OPTIMIZED_FUNCTION) { 739 compiled_code_->kind() == Code::OPTIMIZED_FUNCTION) {
740 LOG(isolate(), CodeDeoptEvent(compiled_code_)); 740 LOG(isolate(), CodeDeoptEvent(compiled_code_));
741 } 741 }
742 ElapsedTimer timer; 742 base::ElapsedTimer timer;
743 743
744 // Determine basic deoptimization information. The optimized frame is 744 // Determine basic deoptimization information. The optimized frame is
745 // described by the input data. 745 // described by the input data.
746 DeoptimizationInputData* input_data = 746 DeoptimizationInputData* input_data =
747 DeoptimizationInputData::cast(compiled_code_->deoptimization_data()); 747 DeoptimizationInputData::cast(compiled_code_->deoptimization_data());
748 748
749 if (trace_scope_ != NULL) { 749 if (trace_scope_ != NULL) {
750 timer.Start(); 750 timer.Start();
751 PrintF(trace_scope_->file(), 751 PrintF(trace_scope_->file(),
752 "[deoptimizing (DEOPT %s): begin 0x%08" V8PRIxPTR " ", 752 "[deoptimizing (DEOPT %s): begin 0x%08" V8PRIxPTR " ",
(...skipping 2020 matching lines...) Expand 10 before | Expand all | Expand 10 after
2773 CodeDesc desc; 2773 CodeDesc desc;
2774 masm.GetCode(&desc); 2774 masm.GetCode(&desc);
2775 ASSERT(!RelocInfo::RequiresRelocation(desc)); 2775 ASSERT(!RelocInfo::RequiresRelocation(desc));
2776 2776
2777 MemoryChunk* chunk = data->deopt_entry_code_[type]; 2777 MemoryChunk* chunk = data->deopt_entry_code_[type];
2778 CHECK(static_cast<int>(Deoptimizer::GetMaxDeoptTableSize()) >= 2778 CHECK(static_cast<int>(Deoptimizer::GetMaxDeoptTableSize()) >=
2779 desc.instr_size); 2779 desc.instr_size);
2780 chunk->CommitArea(desc.instr_size); 2780 chunk->CommitArea(desc.instr_size);
2781 CopyBytes(chunk->area_start(), desc.buffer, 2781 CopyBytes(chunk->area_start(), desc.buffer,
2782 static_cast<size_t>(desc.instr_size)); 2782 static_cast<size_t>(desc.instr_size));
2783 CPU::FlushICache(chunk->area_start(), desc.instr_size); 2783 CpuFeatures::FlushICache(chunk->area_start(), desc.instr_size);
2784 2784
2785 data->deopt_entry_code_entries_[type] = entry_count; 2785 data->deopt_entry_code_entries_[type] = entry_count;
2786 } 2786 }
2787 2787
2788 2788
2789 FrameDescription::FrameDescription(uint32_t frame_size, 2789 FrameDescription::FrameDescription(uint32_t frame_size,
2790 JSFunction* function) 2790 JSFunction* function)
2791 : frame_size_(frame_size), 2791 : frame_size_(frame_size),
2792 function_(function), 2792 function_(function),
2793 top_(kZapUint32), 2793 top_(kZapUint32),
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
3582 } 3582 }
3583 3583
3584 3584
3585 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { 3585 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) {
3586 v->VisitPointer(BitCast<Object**>(&function_)); 3586 v->VisitPointer(BitCast<Object**>(&function_));
3587 v->VisitPointers(parameters_, parameters_ + parameters_count_); 3587 v->VisitPointers(parameters_, parameters_ + parameters_count_);
3588 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); 3588 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_);
3589 } 3589 }
3590 3590
3591 } } // namespace v8::internal 3591 } } // namespace v8::internal
OLDNEW
« src/base/macros.h ('K') | « src/debug.cc ('k') | src/diy-fp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698