| 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/compile-time-value.h" | 9 #include "src/ast/compile-time-value.h" |
| 10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 } | 450 } |
| 451 } | 451 } |
| 452 | 452 |
| 453 | 453 |
| 454 void ObjectLiteral::CalculateEmitStore(Zone* zone) { | 454 void ObjectLiteral::CalculateEmitStore(Zone* zone) { |
| 455 const auto GETTER = ObjectLiteral::Property::GETTER; | 455 const auto GETTER = ObjectLiteral::Property::GETTER; |
| 456 const auto SETTER = ObjectLiteral::Property::SETTER; | 456 const auto SETTER = ObjectLiteral::Property::SETTER; |
| 457 | 457 |
| 458 ZoneAllocationPolicy allocator(zone); | 458 ZoneAllocationPolicy allocator(zone); |
| 459 | 459 |
| 460 ZoneHashMap table(Literal::Match, ZoneHashMap::kDefaultHashMapCapacity, | 460 CustomMatcherZoneHashMap table( |
| 461 allocator); | 461 Literal::Match, ZoneHashMap::kDefaultHashMapCapacity, allocator); |
| 462 for (int i = properties()->length() - 1; i >= 0; i--) { | 462 for (int i = properties()->length() - 1; i >= 0; i--) { |
| 463 ObjectLiteral::Property* property = properties()->at(i); | 463 ObjectLiteral::Property* property = properties()->at(i); |
| 464 if (property->is_computed_name()) continue; | 464 if (property->is_computed_name()) continue; |
| 465 if (property->kind() == ObjectLiteral::Property::PROTOTYPE) continue; | 465 if (property->kind() == ObjectLiteral::Property::PROTOTYPE) continue; |
| 466 Literal* literal = property->key()->AsLiteral(); | 466 Literal* literal = property->key()->AsLiteral(); |
| 467 DCHECK(!literal->IsNullLiteral()); | 467 DCHECK(!literal->IsNullLiteral()); |
| 468 | 468 |
| 469 // If there is an existing entry do not emit a store unless the previous | 469 // If there is an existing entry do not emit a store unless the previous |
| 470 // entry was also an accessor. | 470 // entry was also an accessor. |
| 471 uint32_t hash = literal->Hash(); | 471 uint32_t hash = literal->Hash(); |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 961 // static | 961 // static |
| 962 bool Literal::Match(void* literal1, void* literal2) { | 962 bool Literal::Match(void* literal1, void* literal2) { |
| 963 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); | 963 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); |
| 964 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); | 964 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); |
| 965 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || | 965 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || |
| 966 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); | 966 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); |
| 967 } | 967 } |
| 968 | 968 |
| 969 } // namespace internal | 969 } // namespace internal |
| 970 } // namespace v8 | 970 } // namespace v8 |
| OLD | NEW |