| OLD | NEW |
| 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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 | 513 |
| 514 int constants_length = | 514 int constants_length = |
| 515 first_spread_index_ >= 0 ? first_spread_index_ : values()->length(); | 515 first_spread_index_ >= 0 ? first_spread_index_ : values()->length(); |
| 516 | 516 |
| 517 // Allocate a fixed array to hold all the object literals. | 517 // Allocate a fixed array to hold all the object literals. |
| 518 Handle<JSArray> array = isolate->factory()->NewJSArray( | 518 Handle<JSArray> array = isolate->factory()->NewJSArray( |
| 519 FAST_HOLEY_SMI_ELEMENTS, constants_length, constants_length, | 519 FAST_HOLEY_SMI_ELEMENTS, constants_length, constants_length, |
| 520 Strength::WEAK, INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE); | 520 Strength::WEAK, INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE); |
| 521 | 521 |
| 522 // Fill in the literals. | 522 // Fill in the literals. |
| 523 bool is_simple = true; | 523 bool is_simple = (first_spread_index_ < 0); |
| 524 int depth_acc = 1; | 524 int depth_acc = 1; |
| 525 bool is_holey = false; | 525 bool is_holey = false; |
| 526 int array_index = 0; | 526 int array_index = 0; |
| 527 for (; array_index < constants_length; array_index++) { | 527 for (; array_index < constants_length; array_index++) { |
| 528 Expression* element = values()->at(array_index); | 528 Expression* element = values()->at(array_index); |
| 529 DCHECK(!element->IsSpread()); | 529 DCHECK(!element->IsSpread()); |
| 530 MaterializedLiteral* m_literal = element->AsMaterializedLiteral(); | 530 MaterializedLiteral* m_literal = element->AsMaterializedLiteral(); |
| 531 if (m_literal != NULL) { | 531 if (m_literal != NULL) { |
| 532 m_literal->BuildConstants(isolate); | 532 m_literal->BuildConstants(isolate); |
| 533 if (m_literal->depth() + 1 > depth_acc) { | 533 if (m_literal->depth() + 1 > depth_acc) { |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1151 bool Literal::Match(void* literal1, void* literal2) { | 1151 bool Literal::Match(void* literal1, void* literal2) { |
| 1152 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 1152 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
| 1153 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 1153 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
| 1154 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 1154 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || |
| 1155 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 1155 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
| 1156 } | 1156 } |
| 1157 | 1157 |
| 1158 | 1158 |
| 1159 } // namespace internal | 1159 } // namespace internal |
| 1160 } // namespace v8 | 1160 } // namespace v8 |
| OLD | NEW |