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

Unified Diff: src/runtime/runtime-forin.cc

Issue 1162833006: [for-in] Make ForInNext and ForInFilter deal properly with exceptions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-forin.cc
diff --git a/src/runtime/runtime-forin.cc b/src/runtime/runtime-forin.cc
index fadd2978379408c88bb2c7a1e1df963f6cd6963a..c793e88b9203611cd67532d1777d803d1af88b7a 100644
--- a/src/runtime/runtime-forin.cc
+++ b/src/runtime/runtime-forin.cc
@@ -26,9 +26,13 @@ RUNTIME_FUNCTION(Runtime_ForInFilter) {
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
// TODO(turbofan): Fast case for array indices.
- Handle<Name> name = Runtime::ToName(isolate, key).ToHandleChecked();
+ Handle<Name> name;
+ if (!Runtime::ToName(isolate, key).ToHandle(&name)) {
+ return isolate->heap()->exception();
+ }
Maybe<bool> result = JSReceiver::HasProperty(receiver, name);
- if (result.IsJust() && result.FromJust()) return *name;
+ if (!result.IsJust()) return isolate->heap()->exception();
+ if (result.FromJust()) return *name;
return isolate->heap()->undefined_value();
}
@@ -47,9 +51,13 @@ RUNTIME_FUNCTION(Runtime_ForInNext) {
return *key;
}
// TODO(turbofan): Fast case for array indices.
- Handle<Name> name = Runtime::ToName(isolate, key).ToHandleChecked();
+ Handle<Name> name;
+ if (!Runtime::ToName(isolate, key).ToHandle(&name)) {
+ return isolate->heap()->exception();
+ }
Maybe<bool> result = JSReceiver::HasProperty(receiver, name);
- if (result.IsJust() && result.FromJust()) return *name;
+ if (!result.IsJust()) return isolate->heap()->exception();
+ if (result.FromJust()) return *name;
return isolate->heap()->undefined_value();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698