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

Side by Side Diff: src/ast.cc

Issue 1307943007: [es6] Fix computed property names in nested literals (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 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/es6/computed-property-names.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 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 uint32_t elements = 0; 439 uint32_t elements = 0;
440 for (int i = 0; i < properties()->length(); i++) { 440 for (int i = 0; i < properties()->length(); i++) {
441 ObjectLiteral::Property* property = properties()->at(i); 441 ObjectLiteral::Property* property = properties()->at(i);
442 if (!IsBoilerplateProperty(property)) { 442 if (!IsBoilerplateProperty(property)) {
443 is_simple = false; 443 is_simple = false;
444 continue; 444 continue;
445 } 445 }
446 446
447 if (position == boilerplate_properties_ * 2) { 447 if (position == boilerplate_properties_ * 2) {
448 DCHECK(property->is_computed_name()); 448 DCHECK(property->is_computed_name());
449 is_simple = false;
449 break; 450 break;
450 } 451 }
451 DCHECK(!property->is_computed_name()); 452 DCHECK(!property->is_computed_name());
452 453
453 MaterializedLiteral* m_literal = property->value()->AsMaterializedLiteral(); 454 MaterializedLiteral* m_literal = property->value()->AsMaterializedLiteral();
454 if (m_literal != NULL) { 455 if (m_literal != NULL) {
455 m_literal->BuildConstants(isolate); 456 m_literal->BuildConstants(isolate);
456 if (m_literal->depth() >= depth_acc) depth_acc = m_literal->depth() + 1; 457 if (m_literal->depth() >= depth_acc) depth_acc = m_literal->depth() + 1;
457 } 458 }
458 459
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 bool Literal::Match(void* literal1, void* literal2) { 1151 bool Literal::Match(void* literal1, void* literal2) {
1151 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); 1152 const AstValue* x = static_cast<Literal*>(literal1)->raw_value();
1152 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); 1153 const AstValue* y = static_cast<Literal*>(literal2)->raw_value();
1153 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || 1154 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) ||
1154 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); 1155 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber());
1155 } 1156 }
1156 1157
1157 1158
1158 } // namespace internal 1159 } // namespace internal
1159 } // namespace v8 1160 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/es6/computed-property-names.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698