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

Unified Diff: src/debug/liveedit.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
« no previous file with comments | « src/debug/debug-scopes.cc ('k') | src/isolate.h » ('j') | src/isolate.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/debug/liveedit.cc
diff --git a/src/debug/liveedit.cc b/src/debug/liveedit.cc
index 393d142093ab77b9acec964f657bee1afa5cdf0c..3e2f0ff2c7b1e6e1178f44a2efad02b542d439dd 100644
--- a/src/debug/liveedit.cc
+++ b/src/debug/liveedit.cc
@@ -1180,15 +1180,14 @@ static int TranslatePosition(int original_position,
int array_len = GetArrayLength(position_change_array);
Isolate* isolate = position_change_array->GetIsolate();
// TODO(635): binary search may be used here
- for (int i = 0; i < array_len; i += 3) {
- HandleScope scope(isolate);
+ FOR_WITH_HANDLE_SCOPE(isolate, int, i = 0, i, i < array_len, i += 3, {
Handle<Object> element =
JSReceiver::GetElement(isolate, position_change_array, i)
.ToHandleChecked();
CHECK(element->IsSmi());
int chunk_start = Handle<Smi>::cast(element)->value();
if (original_position < chunk_start) {
- break;
+ return original_position + position_diff;
}
element = JSReceiver::GetElement(isolate, position_change_array, i + 1)
.ToHandleChecked();
@@ -1201,7 +1200,7 @@ static int TranslatePosition(int original_position,
CHECK(element->IsSmi());
int chunk_changed_end = Handle<Smi>::cast(element)->value();
position_diff = chunk_changed_end - chunk_end;
- }
+ });
return original_position + position_diff;
}
@@ -1443,8 +1442,7 @@ static bool CheckActivation(Handle<JSArray> shared_info_array,
Isolate* isolate = shared_info_array->GetIsolate();
int len = GetArrayLength(shared_info_array);
- for (int i = 0; i < len; i++) {
- HandleScope scope(isolate);
+ FOR_WITH_HANDLE_SCOPE(isolate, int, i = 0, i, i < len, i++, {
Handle<Object> element =
JSReceiver::GetElement(isolate, shared_info_array, i).ToHandleChecked();
Handle<JSValue> jsvalue = Handle<JSValue>::cast(element);
@@ -1455,7 +1453,7 @@ static bool CheckActivation(Handle<JSArray> shared_info_array,
SetElementSloppy(result, i, Handle<Smi>(Smi::FromInt(status), isolate));
return true;
}
- }
+ });
return false;
}
@@ -1656,8 +1654,7 @@ class MultipleFunctionTarget {
int len = GetArrayLength(old_shared_array_);
// Find corresponding new shared function info and return whether it
// references new.target.
- for (int i = 0; i < len; i++) {
- HandleScope scope(isolate);
+ FOR_WITH_HANDLE_SCOPE(isolate, int, i = 0, i, i < len, i++, {
Handle<Object> old_element =
JSReceiver::GetElement(isolate, old_shared_array_, i)
.ToHandleChecked();
@@ -1683,7 +1680,7 @@ class MultipleFunctionTarget {
return true;
}
return false;
- }
+ });
return false;
}
« no previous file with comments | « src/debug/debug-scopes.cc ('k') | src/isolate.h » ('j') | src/isolate.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698