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

Side by Side Diff: src/ast.cc

Issue 1162903002: Avoid creating too many handles during array/object literals compilation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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
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 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 for (int n = values()->length(); array_index < n; array_index++) { 497 for (int n = values()->length(); array_index < n; array_index++) {
498 Expression* element = values()->at(array_index); 498 Expression* element = values()->at(array_index);
499 if (element->IsSpread()) break; 499 if (element->IsSpread()) break;
500 MaterializedLiteral* m_literal = element->AsMaterializedLiteral(); 500 MaterializedLiteral* m_literal = element->AsMaterializedLiteral();
501 if (m_literal != NULL) { 501 if (m_literal != NULL) {
502 m_literal->BuildConstants(isolate); 502 m_literal->BuildConstants(isolate);
503 if (m_literal->depth() + 1 > depth_acc) { 503 if (m_literal->depth() + 1 > depth_acc) {
504 depth_acc = m_literal->depth() + 1; 504 depth_acc = m_literal->depth() + 1;
505 } 505 }
506 } 506 }
507 HandleScope loop_scope(isolate);
507 Handle<Object> boilerplate_value = GetBoilerplateValue(element, isolate); 508 Handle<Object> boilerplate_value = GetBoilerplateValue(element, isolate);
508 if (boilerplate_value->IsTheHole()) { 509 if (boilerplate_value->IsTheHole()) {
509 is_holey = true; 510 is_holey = true;
510 } else if (boilerplate_value->IsUninitialized()) { 511 } else if (boilerplate_value->IsUninitialized()) {
511 is_simple = false; 512 is_simple = false;
512 JSObject::SetOwnElement(array, array_index, 513 JSObject::SetOwnElement(array, array_index,
513 handle(Smi::FromInt(0), isolate), 514 handle(Smi::FromInt(0), isolate),
514 SLOPPY).Assert(); 515 SLOPPY).Assert();
515 } else { 516 } else {
516 JSObject::SetOwnElement(array, array_index, boilerplate_value, SLOPPY) 517 JSObject::SetOwnElement(array, array_index, boilerplate_value, SLOPPY)
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 // static 1120 // static
1120 bool Literal::Match(void* literal1, void* literal2) { 1121 bool Literal::Match(void* literal1, void* literal2) {
1121 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); 1122 const AstValue* x = static_cast<Literal*>(literal1)->raw_value();
1122 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); 1123 const AstValue* y = static_cast<Literal*>(literal2)->raw_value();
1123 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || 1124 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) ||
1124 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); 1125 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber());
1125 } 1126 }
1126 1127
1127 1128
1128 } } // namespace v8::internal 1129 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-493289.js » ('j') | test/mjsunit/regress/regress-crbug-493289.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698