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

Unified Diff: src/ast.cc

Issue 1237003002: [es6] correct constant_elements backing-store when spread is used (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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/harmony/spread-array.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast.cc
diff --git a/src/ast.cc b/src/ast.cc
index f7eab6ec710dd438fbe3d9095e90f5e00e086d85..5d76efd6be2c4f090af6e38e92fe25022d634ce3 100644
--- a/src/ast.cc
+++ b/src/ast.cc
@@ -548,6 +548,9 @@ void ArrayLiteral::BuildConstantElements(Isolate* isolate) {
}
JSObject::ValidateElements(array);
Handle<FixedArrayBase> element_values(array->elements());
+ if (array_index != values()->length()) {
+ element_values->set_length(array_index);
+ }
// Simple and shallow arrays can be lazily copied, we transform the
// elements array to a copy-on-write array.
« no previous file with comments | « no previous file | test/mjsunit/harmony/spread-array.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698