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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | test/mjsunit/harmony/spread-array.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/ast.h" 5 #include "src/ast.h"
6 6
7 #include <cmath> // For isfinite. 7 #include <cmath> // For isfinite.
8 #include "src/builtins.h" 8 #include "src/builtins.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/contexts.h" 10 #include "src/contexts.h"
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 541
542 JSObject::AddDataElement(array, array_index, boilerplate_value, NONE) 542 JSObject::AddDataElement(array, array_index, boilerplate_value, NONE)
543 .Assert(); 543 .Assert();
544 } 544 }
545 545
546 if (array_index != values()->length()) { 546 if (array_index != values()->length()) {
547 JSArray::SetLength(array, array_index); 547 JSArray::SetLength(array, array_index);
548 } 548 }
549 JSObject::ValidateElements(array); 549 JSObject::ValidateElements(array);
550 Handle<FixedArrayBase> element_values(array->elements()); 550 Handle<FixedArrayBase> element_values(array->elements());
551 if (array_index != values()->length()) {
552 element_values->set_length(array_index);
553 }
551 554
552 // Simple and shallow arrays can be lazily copied, we transform the 555 // Simple and shallow arrays can be lazily copied, we transform the
553 // elements array to a copy-on-write array. 556 // elements array to a copy-on-write array.
554 if (is_simple && depth_acc == 1 && array_index > 0 && 557 if (is_simple && depth_acc == 1 && array_index > 0 &&
555 array->HasFastSmiOrObjectElements()) { 558 array->HasFastSmiOrObjectElements()) {
556 element_values->set_map(isolate->heap()->fixed_cow_array_map()); 559 element_values->set_map(isolate->heap()->fixed_cow_array_map());
557 } 560 }
558 561
559 // Remember both the literal's constant values as well as the ElementsKind 562 // Remember both the literal's constant values as well as the ElementsKind
560 // in a 2-element FixedArray. 563 // in a 2-element FixedArray.
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 bool Literal::Match(void* literal1, void* literal2) { 1148 bool Literal::Match(void* literal1, void* literal2) {
1146 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); 1149 const AstValue* x = static_cast<Literal*>(literal1)->raw_value();
1147 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); 1150 const AstValue* y = static_cast<Literal*>(literal2)->raw_value();
1148 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || 1151 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) ||
1149 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); 1152 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber());
1150 } 1153 }
1151 1154
1152 1155
1153 } // namespace internal 1156 } // namespace internal
1154 } // namespace v8 1157 } // namespace v8
OLDNEW
« 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