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

Unified Diff: src/messages.cc

Issue 1785403002: [runtime] split up loops with HandleScopes (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: making windose happy Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: src/messages.cc
diff --git a/src/messages.cc b/src/messages.cc
index 67ab36f6cf0af2f6cc65a17fb3b69589d8eeedd8..1f8f8cf789bbb68748813c1ebbfc60ccd000aa47 100644
--- a/src/messages.cc
+++ b/src/messages.cc
@@ -116,8 +116,7 @@ void MessageHandler::ReportMessage(Isolate* isolate, MessageLocation* loc,
isolate->clear_scheduled_exception();
}
} else {
- for (int i = 0; i < global_length; i++) {
- HandleScope scope(isolate);
+ FOR_WITH_HANDLE_SCOPE(isolate, int, i = 0, i, i < global_length, i++, {
if (global_listeners.get(i)->IsUndefined()) continue;
v8::NeanderObject listener(JSObject::cast(global_listeners.get(i)));
Handle<Foreign> callback_obj(Foreign::cast(listener.get(0)));
@@ -134,7 +133,7 @@ void MessageHandler::ReportMessage(Isolate* isolate, MessageLocation* loc,
if (isolate->has_scheduled_exception()) {
isolate->clear_scheduled_exception();
}
- }
+ });
}
}
@@ -262,8 +261,7 @@ Handle<Object> CallSite::GetMethodName() {
Handle<JSObject> current_obj = Handle<JSObject>::cast(current);
if (current_obj->IsAccessCheckNeeded()) break;
Handle<FixedArray> keys = JSObject::GetEnumPropertyKeys(current_obj);
- for (int i = 0; i < keys->length(); i++) {
- HandleScope inner_scope(isolate_);
+ FOR_WITH_HANDLE_SCOPE(isolate_, int, i = 0, i, i < keys->length(), i++, {
if (!keys->get(i)->IsName()) continue;
Handle<Name> name_key(Name::cast(keys->get(i)), isolate_);
if (!CheckMethodName(isolate_, current_obj, name_key, fun_,
@@ -271,8 +269,8 @@ Handle<Object> CallSite::GetMethodName() {
continue;
// Return null in case of duplicates to avoid confusion.
if (!result.is_null()) return isolate_->factory()->null_value();
- result = inner_scope.CloseAndEscape(name_key);
- }
+ result = loop_scope.CloseAndEscape(name_key);
+ });
}
if (!result.is_null()) return outer_scope.CloseAndEscape(result);
« src/isolate.h ('K') | « src/isolate.cc ('k') | src/runtime/runtime-literals.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698