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

Side by Side Diff: src/handles-inl.h

Issue 1192743005: Reland 'Additional HandleScopes to limit Handle consumption.' (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 5 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
« no previous file with comments | « src/handles.h ('k') | src/heap/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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 5
6 #ifndef V8_HANDLES_INL_H_ 6 #ifndef V8_HANDLES_INL_H_
7 #define V8_HANDLES_INL_H_ 7 #define V8_HANDLES_INL_H_
8 8
9 #include "src/api.h" 9 #include "src/api.h"
10 #include "src/handles.h" 10 #include "src/handles.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 HandleScope::HandleScope(Isolate* isolate) { 85 HandleScope::HandleScope(Isolate* isolate) {
86 HandleScopeData* current = isolate->handle_scope_data(); 86 HandleScopeData* current = isolate->handle_scope_data();
87 isolate_ = isolate; 87 isolate_ = isolate;
88 prev_next_ = current->next; 88 prev_next_ = current->next;
89 prev_limit_ = current->limit; 89 prev_limit_ = current->limit;
90 current->level++; 90 current->level++;
91 } 91 }
92 92
93 93
94 HandleScope::~HandleScope() { 94 HandleScope::~HandleScope() {
95 CloseScope(isolate_, prev_next_, prev_limit_); 95 #ifdef DEBUG
96 if (FLAG_check_handle_count) {
97 int before = NumberOfHandles(isolate_);
98 CloseScope(isolate_, prev_next_, prev_limit_);
99 int after = NumberOfHandles(isolate_);
100 DCHECK(after - before < kCheckHandleThreshold);
101 DCHECK(before < kCheckHandleThreshold);
102 } else {
103 #endif // DEBUG
104 CloseScope(isolate_, prev_next_, prev_limit_);
105 #ifdef DEBUG
106 }
107 #endif // DEBUG
96 } 108 }
97 109
98 110
99 void HandleScope::CloseScope(Isolate* isolate, 111 void HandleScope::CloseScope(Isolate* isolate,
100 Object** prev_next, 112 Object** prev_next,
101 Object** prev_limit) { 113 Object** prev_limit) {
102 HandleScopeData* current = isolate->handle_scope_data(); 114 HandleScopeData* current = isolate->handle_scope_data();
103 115
104 std::swap(current->next, prev_next); 116 std::swap(current->next, prev_next);
105 current->level--; 117 current->level--;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 current->level = level_; 186 current->level = level_;
175 DCHECK_EQ(current->next, current->limit); 187 DCHECK_EQ(current->next, current->limit);
176 current->limit = limit_; 188 current->limit = limit_;
177 } 189 }
178 190
179 #endif 191 #endif
180 192
181 } } // namespace v8::internal 193 } } // namespace v8::internal
182 194
183 #endif // V8_HANDLES_INL_H_ 195 #endif // V8_HANDLES_INL_H_
OLDNEW
« no previous file with comments | « src/handles.h ('k') | src/heap/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698