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

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: 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') | test/mjsunit/regress/regress-595319.js » ('J')
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..5e6ec4e4feacda86b72cb4c10e907bf4bd21fc83 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, AbstractCode::ShouldThrow::THROW_ON_ERROR);
adamk 2016/03/17 19:22:21 "Object::THROW_ON_ERROR" is the usual way of namin
Dan Ehrenberg 2016/03/17 20:26:33 Done
+ if (!success.IsJust()) return false;
+ DCHECK(success.FromJust());
adamk 2016/03/17 19:22:21 I agree that this ought to be the case, but I'm no
Dan Ehrenberg 2016/03/17 20:26:33 For this patch, I just fixed it on this side, WDYT
adamk 2016/03/17 20:33:59 I'd prefer it be fixed properly, the CreateDataPro
adamk 2016/03/17 20:39:54 I do think it would make sense to do the CreateDat
Dan Ehrenberg 2016/03/17 21:15:53 This new version depends on https://codereview.chr
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();
visitor.increase_index_offset(1);
}
}
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-595319.js » ('j') | test/mjsunit/regress/regress-595319.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698