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

Side by Side Diff: src/compiler/store-store-elimination.cc

Issue 2452403003: Changed statement ZoneList to a ZoneChunkList
Patch Set: Created 4 years, 1 month 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/compiler/state-values-utils.cc ('k') | src/crankshaft/arm/lithium-arm.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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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 <iterator> 5 #include <iterator>
6 6
7 #include "src/compiler/store-store-elimination.h" 7 #include "src/compiler/store-store-elimination.h"
8 8
9 #include "src/compiler/all-nodes.h" 9 #include "src/compiler/all-nodes.h"
10 #include "src/compiler/js-graph.h" 10 #include "src/compiler/js-graph.h"
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 } 466 }
467 467
468 UnobservablesSet UnobservablesSet::Unvisited() { return UnobservablesSet(); } 468 UnobservablesSet UnobservablesSet::Unvisited() { return UnobservablesSet(); }
469 469
470 UnobservablesSet::UnobservablesSet() : set_(nullptr) {} 470 UnobservablesSet::UnobservablesSet() : set_(nullptr) {}
471 471
472 UnobservablesSet UnobservablesSet::VisitedEmpty(Zone* zone) { 472 UnobservablesSet UnobservablesSet::VisitedEmpty(Zone* zone) {
473 // Create a new empty UnobservablesSet. This allocates in the zone, and 473 // Create a new empty UnobservablesSet. This allocates in the zone, and
474 // can probably be optimized to use a global singleton. 474 // can probably be optimized to use a global singleton.
475 ZoneSet<UnobservableStore>* empty_set = 475 ZoneSet<UnobservableStore>* empty_set =
476 new (zone->New(sizeof(ZoneSet<UnobservableStore>))) 476 new (zone) ZoneSet<UnobservableStore>(zone);
477 ZoneSet<UnobservableStore>(zone);
478 return UnobservablesSet(empty_set); 477 return UnobservablesSet(empty_set);
479 } 478 }
480 479
481 // Computes the intersection of two UnobservablesSets. May return 480 // Computes the intersection of two UnobservablesSets. May return
482 // UnobservablesSet::Unvisited() instead of an empty UnobservablesSet for 481 // UnobservablesSet::Unvisited() instead of an empty UnobservablesSet for
483 // speed. 482 // speed.
484 UnobservablesSet UnobservablesSet::Intersect(UnobservablesSet other, 483 UnobservablesSet UnobservablesSet::Intersect(UnobservablesSet other,
485 Zone* zone) const { 484 Zone* zone) const {
486 if (IsEmpty() || other.IsEmpty()) { 485 if (IsEmpty() || other.IsEmpty()) {
487 return Unvisited(); 486 return Unvisited();
488 } else { 487 } else {
489 ZoneSet<UnobservableStore>* intersection = 488 ZoneSet<UnobservableStore>* intersection =
490 new (zone->New(sizeof(ZoneSet<UnobservableStore>))) 489 new (zone) ZoneSet<UnobservableStore>(zone);
491 ZoneSet<UnobservableStore>(zone);
492 // Put the intersection of set() and other.set() in intersection. 490 // Put the intersection of set() and other.set() in intersection.
493 set_intersection(set()->begin(), set()->end(), other.set()->begin(), 491 set_intersection(set()->begin(), set()->end(), other.set()->begin(),
494 other.set()->end(), 492 other.set()->end(),
495 std::inserter(*intersection, intersection->end())); 493 std::inserter(*intersection, intersection->end()));
496 494
497 return UnobservablesSet(intersection); 495 return UnobservablesSet(intersection);
498 } 496 }
499 } 497 }
500 498
501 UnobservablesSet UnobservablesSet::Add(UnobservableStore obs, 499 UnobservablesSet UnobservablesSet::Add(UnobservableStore obs,
502 Zone* zone) const { 500 Zone* zone) const {
503 bool present = (set()->find(obs) != set()->end()); 501 bool present = (set()->find(obs) != set()->end());
504 if (present) { 502 if (present) {
505 return *this; 503 return *this;
506 } else { 504 } else {
507 // Make a new empty set. 505 // Make a new empty set.
508 ZoneSet<UnobservableStore>* new_set = 506 ZoneSet<UnobservableStore>* new_set =
509 new (zone->New(sizeof(ZoneSet<UnobservableStore>))) 507 new (zone) ZoneSet<UnobservableStore>(zone);
510 ZoneSet<UnobservableStore>(zone);
511 // Copy the old elements over. 508 // Copy the old elements over.
512 *new_set = *set(); 509 *new_set = *set();
513 // Add the new element. 510 // Add the new element.
514 bool inserted = new_set->insert(obs).second; 511 bool inserted = new_set->insert(obs).second;
515 DCHECK(inserted); 512 DCHECK(inserted);
516 USE(inserted); // silence warning about unused variable 513 USE(inserted); // silence warning about unused variable
517 514
518 return UnobservablesSet(new_set); 515 return UnobservablesSet(new_set);
519 } 516 }
520 } 517 }
521 518
522 UnobservablesSet UnobservablesSet::RemoveSameOffset(StoreOffset offset, 519 UnobservablesSet UnobservablesSet::RemoveSameOffset(StoreOffset offset,
523 Zone* zone) const { 520 Zone* zone) const {
524 // Make a new empty set. 521 // Make a new empty set.
525 ZoneSet<UnobservableStore>* new_set = 522 ZoneSet<UnobservableStore>* new_set =
526 new (zone->New(sizeof(ZoneSet<UnobservableStore>))) 523 new (zone) ZoneSet<UnobservableStore>(zone);
527 ZoneSet<UnobservableStore>(zone);
528 // Copy all elements over that have a different offset. 524 // Copy all elements over that have a different offset.
529 for (auto obs : *set()) { 525 for (auto obs : *set()) {
530 if (obs.offset_ != offset) { 526 if (obs.offset_ != offset) {
531 new_set->insert(obs); 527 new_set->insert(obs);
532 } 528 }
533 } 529 }
534 530
535 return UnobservablesSet(new_set); 531 return UnobservablesSet(new_set);
536 } 532 }
537 533
(...skipping 19 matching lines...) Expand all
557 return !(*this == other); 553 return !(*this == other);
558 } 554 }
559 555
560 bool UnobservableStore::operator<(const UnobservableStore other) const { 556 bool UnobservableStore::operator<(const UnobservableStore other) const {
561 return (id_ < other.id_) || (id_ == other.id_ && offset_ < other.offset_); 557 return (id_ < other.id_) || (id_ == other.id_ && offset_ < other.offset_);
562 } 558 }
563 559
564 } // namespace compiler 560 } // namespace compiler
565 } // namespace internal 561 } // namespace internal
566 } // namespace v8 562 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/state-values-utils.cc ('k') | src/crankshaft/arm/lithium-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698