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