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

Side by Side Diff: src/deoptimizer.cc

Issue 23641009: Refactor and cleanup VirtualMemory. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed nits. Created 7 years, 3 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
« no previous file with comments | « src/arm/codegen-arm.cc ('k') | src/heap.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 24 matching lines...) Expand all
35 #include "global-handles.h" 35 #include "global-handles.h"
36 #include "macro-assembler.h" 36 #include "macro-assembler.h"
37 #include "prettyprinter.h" 37 #include "prettyprinter.h"
38 38
39 39
40 namespace v8 { 40 namespace v8 {
41 namespace internal { 41 namespace internal {
42 42
43 static MemoryChunk* AllocateCodeChunk(MemoryAllocator* allocator) { 43 static MemoryChunk* AllocateCodeChunk(MemoryAllocator* allocator) {
44 return allocator->AllocateChunk(Deoptimizer::GetMaxDeoptTableSize(), 44 return allocator->AllocateChunk(Deoptimizer::GetMaxDeoptTableSize(),
45 OS::CommitPageSize(), 45 VirtualMemory::GetPageSize(),
46 #if defined(__native_client__) 46 VirtualMemory::EXECUTABLE,
47 // The Native Client port of V8 uses an interpreter,
48 // so code pages don't need PROT_EXEC.
49 NOT_EXECUTABLE,
50 #else
51 EXECUTABLE,
52 #endif
53 NULL); 47 NULL);
54 } 48 }
55 49
56 50
57 DeoptimizerData::DeoptimizerData(MemoryAllocator* allocator) 51 DeoptimizerData::DeoptimizerData(MemoryAllocator* allocator)
58 : allocator_(allocator), 52 : allocator_(allocator),
59 #ifdef ENABLE_DEBUGGER_SUPPORT 53 #ifdef ENABLE_DEBUGGER_SUPPORT
60 deoptimized_frame_info_(NULL), 54 deoptimized_frame_info_(NULL),
61 #endif 55 #endif
62 current_(NULL) { 56 current_(NULL) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 } 115 }
122 116
123 117
124 // No larger than 2K on all platforms 118 // No larger than 2K on all platforms
125 static const int kDeoptTableMaxEpilogueCodeSize = 2 * KB; 119 static const int kDeoptTableMaxEpilogueCodeSize = 2 * KB;
126 120
127 121
128 size_t Deoptimizer::GetMaxDeoptTableSize() { 122 size_t Deoptimizer::GetMaxDeoptTableSize() {
129 int entries_size = 123 int entries_size =
130 Deoptimizer::kMaxNumberOfEntries * Deoptimizer::table_entry_size_; 124 Deoptimizer::kMaxNumberOfEntries * Deoptimizer::table_entry_size_;
131 int commit_page_size = static_cast<int>(OS::CommitPageSize()); 125 int commit_page_size = static_cast<int>(VirtualMemory::GetPageSize());
132 int page_count = ((kDeoptTableMaxEpilogueCodeSize + entries_size - 1) / 126 int page_count = ((kDeoptTableMaxEpilogueCodeSize + entries_size - 1) /
133 commit_page_size) + 1; 127 commit_page_size) + 1;
134 return static_cast<size_t>(commit_page_size * page_count); 128 return static_cast<size_t>(commit_page_size * page_count);
135 } 129 }
136 130
137 131
138 Deoptimizer* Deoptimizer::Grab(Isolate* isolate) { 132 Deoptimizer* Deoptimizer::Grab(Isolate* isolate) {
139 Deoptimizer* result = isolate->deoptimizer_data()->current_; 133 Deoptimizer* result = isolate->deoptimizer_data()->current_;
140 ASSERT(result != NULL); 134 ASSERT(result != NULL);
141 result->DeleteFrameDescriptions(); 135 result->DeleteFrameDescriptions();
(...skipping 2909 matching lines...) Expand 10 before | Expand all | Expand 10 after
3051 3045
3052 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { 3046 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) {
3053 v->VisitPointer(BitCast<Object**>(&function_)); 3047 v->VisitPointer(BitCast<Object**>(&function_));
3054 v->VisitPointers(parameters_, parameters_ + parameters_count_); 3048 v->VisitPointers(parameters_, parameters_ + parameters_count_);
3055 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); 3049 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_);
3056 } 3050 }
3057 3051
3058 #endif // ENABLE_DEBUGGER_SUPPORT 3052 #endif // ENABLE_DEBUGGER_SUPPORT
3059 3053
3060 } } // namespace v8::internal 3054 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/codegen-arm.cc ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698