| 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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 | 426 |
| 427 void ObjectLiteral::BuildConstantProperties(Isolate* isolate) { | 427 void ObjectLiteral::BuildConstantProperties(Isolate* isolate) { |
| 428 if (!constant_properties_.is_null()) return; | 428 if (!constant_properties_.is_null()) return; |
| 429 | 429 |
| 430 // Allocate a fixed array to hold all the constant properties. | 430 // Allocate a fixed array to hold all the constant properties. |
| 431 Handle<FixedArray> constant_properties = isolate->factory()->NewFixedArray( | 431 Handle<FixedArray> constant_properties = isolate->factory()->NewFixedArray( |
| 432 boilerplate_properties_ * 2, TENURED); | 432 boilerplate_properties_ * 2, TENURED); |
| 433 | 433 |
| 434 int position = 0; | 434 int position = 0; |
| 435 // Accumulate the value in local variables and store it at the end. | 435 // Accumulate the value in local variables and store it at the end. |
| 436 bool is_simple = true; | 436 // If computed property names are used, the literal is never simple. |
| 437 bool is_simple = !has_computed_property_names(); |
| 437 int depth_acc = 1; | 438 int depth_acc = 1; |
| 438 uint32_t max_element_index = 0; | 439 uint32_t max_element_index = 0; |
| 439 uint32_t elements = 0; | 440 uint32_t elements = 0; |
| 440 for (int i = 0; i < properties()->length(); i++) { | 441 for (int i = 0; i < properties()->length(); i++) { |
| 441 ObjectLiteral::Property* property = properties()->at(i); | 442 ObjectLiteral::Property* property = properties()->at(i); |
| 442 if (!IsBoilerplateProperty(property)) { | 443 if (!IsBoilerplateProperty(property)) { |
| 443 is_simple = false; | 444 is_simple = false; |
| 444 continue; | 445 continue; |
| 445 } | 446 } |
| 446 | 447 |
| (...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |