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

Unified Diff: src/builtins.cc

Issue 1814933002: Throw the right exceptions from setting elements in Array.prototype.concat (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Depend on CreateDataProperty to throw 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 | « no previous file | test/mjsunit/regress/regress-595319.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins.cc
diff --git a/src/builtins.cc b/src/builtins.cc
index 1af71de0f19d39a7d7a952171d5ce800cf94bbea..ecad63adcc4b3dec6229379134c6115378623700 100644
--- a/src/builtins.cc
+++ b/src/builtins.cc
@@ -718,10 +718,11 @@ class ArrayConcatVisitor {
}
if (!is_fixed_array()) {
- Handle<Object> element_value;
- ASSIGN_RETURN_ON_EXCEPTION_VALUE(
- isolate_, element_value,
- Object::SetElement(isolate_, storage_, index, elm, STRICT), false);
+ LookupIterator it(isolate_, storage_, index, LookupIterator::OWN);
+ Maybe<bool> success =
+ JSReceiver::CreateDataProperty(&it, elm, Object::THROW_ON_ERROR);
+ if (!success.IsJust()) return false;
adamk 2016/03/17 21:31:31 The usual way of writing this is: MAYBE_RETURN(JS
Dan Ehrenberg 2016/03/17 22:11:01 Done (I'm sad about the lost DCHECK though)
+ DCHECK(success.FromJust());
return true;
}
@@ -823,9 +824,7 @@ class ArrayConcatVisitor {
set_fast_elements(false);
}
- inline void clear_storage() {
- GlobalHandles::Destroy(Handle<Object>::cast(storage_).location());
- }
+ inline void clear_storage() { GlobalHandles::Destroy(storage_.location()); }
inline void set_storage(FixedArray* storage) {
DCHECK(is_fixed_array());
@@ -1409,7 +1408,9 @@ Object* Slow_ArrayConcat(Arguments* args, Handle<Object> species,
return isolate->heap()->exception();
}
} else {
- visitor.visit(0, obj);
+ bool success = visitor.visit(0, obj);
+ DCHECK_EQ(success, !isolate->has_pending_exception());
+ if (isolate->has_pending_exception()) return isolate->heap()->exception();
adamk 2016/03/17 21:31:31 The pattern elsewhere in this file is: if (!Somet
Dan Ehrenberg 2016/03/17 22:11:01 Done (but I'm also sad about this DCHECK)
adamk 2016/03/17 22:16:25 Not sure what's really to be done here, this patte
visitor.increase_index_offset(1);
}
}
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-595319.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698