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

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: format 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 dd6889bcdbf32a0bad044e2def7d439871e44bb3..1c27415907854b1751275958b4cda49e350674f4 100644
--- a/src/builtins.cc
+++ b/src/builtins.cc
@@ -706,7 +706,7 @@ class ArrayConcatVisitor {
~ArrayConcatVisitor() { clear_storage(); }
- bool visit(uint32_t i, Handle<Object> elm) {
+ MUST_USE_RESULT bool visit(uint32_t i, Handle<Object> elm) {
uint32_t index = index_offset_ + i;
if (i >= JSObject::kMaxElementCount - index_offset_) {
@@ -718,10 +718,10 @@ 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_RETURN(
+ JSReceiver::CreateDataProperty(&it, elm, Object::THROW_ON_ERROR),
+ false);
return true;
}
@@ -823,9 +823,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());
@@ -1402,7 +1400,7 @@ Object* Slow_ArrayConcat(Arguments* args, Handle<Object> species,
return isolate->heap()->exception();
}
} else {
- visitor.visit(0, obj);
+ if (!visitor.visit(0, obj)) return isolate->heap()->exception();
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