| 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/ast.h" | 5 #include "src/ast/ast.h" |
| 6 | 6 |
| 7 #include <cmath> // For isfinite. | 7 #include <cmath> // For isfinite. |
| 8 | 8 |
| 9 #include "src/ast/prettyprinter.h" | 9 #include "src/ast/prettyprinter.h" |
| 10 #include "src/ast/scopes.h" | 10 #include "src/ast/scopes.h" |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 if (m_literal->depth() >= depth_acc) depth_acc = m_literal->depth() + 1; | 445 if (m_literal->depth() >= depth_acc) depth_acc = m_literal->depth() + 1; |
| 446 } | 446 } |
| 447 | 447 |
| 448 // Add CONSTANT and COMPUTED properties to boilerplate. Use undefined | 448 // Add CONSTANT and COMPUTED properties to boilerplate. Use undefined |
| 449 // value for COMPUTED properties, the real value is filled in at | 449 // value for COMPUTED properties, the real value is filled in at |
| 450 // runtime. The enumeration order is maintained. | 450 // runtime. The enumeration order is maintained. |
| 451 Handle<Object> key = property->key()->AsLiteral()->value(); | 451 Handle<Object> key = property->key()->AsLiteral()->value(); |
| 452 Handle<Object> value = GetBoilerplateValue(property->value(), isolate); | 452 Handle<Object> value = GetBoilerplateValue(property->value(), isolate); |
| 453 | 453 |
| 454 // Ensure objects that may, at any point in time, contain fields with double | 454 // Ensure objects that may, at any point in time, contain fields with double |
| 455 // representation are always treated as nested objects. This is true for | 455 // representation are treated as nested objects if they are not unboxed. |
| 456 // computed fields (value is undefined), and smi and double literals | 456 // This is true for computed fields (value is undefined), and smi and double |
| 457 // (value->IsNumber()). | 457 // literals (value->IsNumber()). |
| 458 // TODO(verwaest): Remove once we can store them inline. | |
| 459 if (FLAG_track_double_fields && | 458 if (FLAG_track_double_fields && |
| 460 (value->IsNumber() || value->IsUninitialized())) { | 459 (value->IsNumber() || value->IsUninitialized())) { |
| 461 may_store_doubles_ = true; | 460 may_store_doubles_ = true; |
| 462 } | 461 } |
| 463 | 462 |
| 464 is_simple = is_simple && !value->IsUninitialized(); | 463 is_simple = is_simple && !value->IsUninitialized(); |
| 465 | 464 |
| 466 // Keep track of the number of elements in the object literal and | 465 // Keep track of the number of elements in the object literal and |
| 467 // the largest element index. If the largest element index is | 466 // the largest element index. If the largest element index is |
| 468 // much larger than the number of elements, creating an object | 467 // much larger than the number of elements, creating an object |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 bool Literal::Match(void* literal1, void* literal2) { | 830 bool Literal::Match(void* literal1, void* literal2) { |
| 832 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 831 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
| 833 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 832 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
| 834 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 833 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || |
| 835 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 834 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
| 836 } | 835 } |
| 837 | 836 |
| 838 | 837 |
| 839 } // namespace internal | 838 } // namespace internal |
| 840 } // namespace v8 | 839 } // namespace v8 |
| OLD | NEW |