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

Unified Diff: src/keys.cc

Issue 2219803002: [keys] Throw a range error if the number of keys overflow FixedArray::kMaxLength (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: formatting Created 4 years, 4 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/elements.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/keys.cc
diff --git a/src/keys.cc b/src/keys.cc
index 81e2696cda6ac749283cba4254a037ba2dc38e50..c6e31e3f231ccc855356d33c9c61b518fd3061e5 100644
--- a/src/keys.cc
+++ b/src/keys.cc
@@ -348,9 +348,9 @@ Handle<FixedArray> GetFastEnumPropertyKeys(Isolate* isolate,
}
template <bool fast_properties>
-Handle<FixedArray> GetOwnKeysWithElements(Isolate* isolate,
- Handle<JSObject> object,
- GetKeysConversion convert) {
+MaybeHandle<FixedArray> GetOwnKeysWithElements(Isolate* isolate,
+ Handle<JSObject> object,
+ GetKeysConversion convert) {
Handle<FixedArray> keys;
ElementsAccessor* accessor = object->GetElementsAccessor();
if (fast_properties) {
@@ -359,12 +359,12 @@ Handle<FixedArray> GetOwnKeysWithElements(Isolate* isolate,
// TODO(cbruni): preallocate big enough array to also hold elements.
keys = KeyAccumulator::GetOwnEnumPropertyKeys(isolate, object);
}
- Handle<FixedArray> result =
+ MaybeHandle<FixedArray> result =
accessor->PrependElementIndices(object, keys, convert, ONLY_ENUMERABLE);
if (FLAG_trace_for_in_enumerate) {
PrintF("| strings=%d symbols=0 elements=%u || prototypes>=1 ||\n",
- keys->length(), result->length() - keys->length());
+ keys->length(), result.ToHandleChecked()->length() - keys->length());
}
return result;
}
@@ -396,11 +396,14 @@ bool OnlyHasSimpleProperties(Map* map) {
MaybeHandle<FixedArray> FastKeyAccumulator::GetKeys(
GetKeysConversion keys_conversion) {
- Handle<FixedArray> keys;
- if (filter_ == ENUMERABLE_STRINGS &&
- GetKeysFast(keys_conversion).ToHandle(&keys)) {
- return keys;
+ if (filter_ == ENUMERABLE_STRINGS) {
+ Handle<FixedArray> keys;
+ if (GetKeysFast(keys_conversion).ToHandle(&keys)) {
+ return keys;
+ }
+ if (isolate_->has_pending_exception()) return MaybeHandle<FixedArray>();
}
+
return GetKeysSlow(keys_conversion);
}
« no previous file with comments | « src/elements.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698