Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: src/ast/ast.cc

Issue 2351393003: [base] Revert "Move hashmap allocator to a field" (Closed)
Patch Set: Whoops, patch sets should build Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ast/ast.h ('k') | src/ast/scopes.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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); 475 ZoneHashMap::Entry* entry = table.LookupOrInsert(literal, hash, allocator);
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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 // static 960 // static
961 bool Literal::Match(void* literal1, void* literal2) { 961 bool Literal::Match(void* literal1, void* literal2) {
962 const AstValue* x = static_cast<Literal*>(literal1)->raw_value(); 962 const AstValue* x = static_cast<Literal*>(literal1)->raw_value();
963 const AstValue* y = static_cast<Literal*>(literal2)->raw_value(); 963 const AstValue* y = static_cast<Literal*>(literal2)->raw_value();
964 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) || 964 return (x->IsString() && y->IsString() && x->AsString() == y->AsString()) ||
965 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber()); 965 (x->IsNumber() && y->IsNumber() && x->AsNumber() == y->AsNumber());
966 } 966 }
967 967
968 } // namespace internal 968 } // namespace internal
969 } // namespace v8 969 } // namespace v8
OLDNEW
« no previous file with comments | « src/ast/ast.h ('k') | src/ast/scopes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698