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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 for (int i = properties()->length() - 1; i >= 0; i--) { | 465 for (int i = properties()->length() - 1; i >= 0; i--) { |
466 ObjectLiteral::Property* property = properties()->at(i); | 466 ObjectLiteral::Property* property = properties()->at(i); |
467 if (property->is_computed_name()) continue; | 467 if (property->is_computed_name()) continue; |
468 if (property->kind() == ObjectLiteral::Property::PROTOTYPE) continue; | 468 if (property->kind() == ObjectLiteral::Property::PROTOTYPE) continue; |
469 Literal* literal = property->key()->AsLiteral(); | 469 Literal* literal = property->key()->AsLiteral(); |
470 DCHECK(!literal->IsNullLiteral()); | 470 DCHECK(!literal->IsNullLiteral()); |
471 | 471 |
472 // If there is an existing entry do not emit a store unless the previous | 472 // If there is an existing entry do not emit a store unless the previous |
473 // entry was also an accessor. | 473 // entry was also an accessor. |
474 uint32_t hash = literal->Hash(); | 474 uint32_t hash = literal->Hash(); |
475 ZoneHashMap::Entry* entry = table.LookupOrInsert(literal, hash, allocator); | 475 ZoneHashMap::Entry* entry = table.LookupOrInsert(literal, hash); |
476 if (entry->value != NULL) { | 476 if (entry->value != NULL) { |
477 auto previous_kind = | 477 auto previous_kind = |
478 static_cast<ObjectLiteral::Property*>(entry->value)->kind(); | 478 static_cast<ObjectLiteral::Property*>(entry->value)->kind(); |
479 if (!((property->kind() == GETTER && previous_kind == SETTER) || | 479 if (!((property->kind() == GETTER && previous_kind == SETTER) || |
480 (property->kind() == SETTER && previous_kind == GETTER))) { | 480 (property->kind() == SETTER && previous_kind == GETTER))) { |
481 property->set_emit_store(false); | 481 property->set_emit_store(false); |
482 } | 482 } |
483 } | 483 } |
484 entry->value = property; | 484 entry->value = property; |
485 } | 485 } |
(...skipping 472 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 |