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

Side by Side Diff: runtime/vm/redundancy_elimination.cc

Issue 1722733002: In background compilation make a copy of Field in order to freeze its state (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: s Created 4 years, 9 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 | « runtime/vm/raw_object.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/redundancy_elimination.h" 5 #include "vm/redundancy_elimination.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/flow_graph.h" 8 #include "vm/flow_graph.h"
9 #include "vm/hash_map.h" 9 #include "vm/hash_map.h"
10 #include "vm/il_printer.h" 10 #include "vm/il_printer.h"
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 474
475 private: 475 private:
476 Place(uword flags, Definition* instance, intptr_t selector) 476 Place(uword flags, Definition* instance, intptr_t selector)
477 : flags_(flags), 477 : flags_(flags),
478 instance_(instance), 478 instance_(instance),
479 raw_selector_(selector), 479 raw_selector_(selector),
480 id_(0) { 480 id_(0) {
481 } 481 }
482 482
483 bool SameField(const Place* other) const { 483 bool SameField(const Place* other) const {
484 return (kind() == kField) ? (field().raw() == other->field().raw()) 484 return (kind() == kField) ?
485 : (offset_in_bytes_ == other->offset_in_bytes_); 485 (field().Original() == other->field().Original()) :
486 (offset_in_bytes_ == other->offset_in_bytes_);
486 } 487 }
487 488
488 intptr_t FieldHashcode() const { 489 intptr_t FieldHashcode() const {
489 return (kind() == kField) ? reinterpret_cast<intptr_t>(field().raw()) 490 return (kind() == kField) ? reinterpret_cast<intptr_t>(field().Original())
490 : offset_in_bytes_; 491 : offset_in_bytes_;
491 } 492 }
492 493
493 void set_representation(Representation rep) { 494 void set_representation(Representation rep) {
494 flags_ = RepresentationBits::update(rep, flags_); 495 flags_ = RepresentationBits::update(rep, flags_);
495 } 496 }
496 497
497 void set_kind(Kind kind) { 498 void set_kind(Kind kind) {
498 flags_ = KindBits::update(kind, flags_); 499 flags_ = KindBits::update(kind, flags_);
499 } 500 }
(...skipping 2578 matching lines...) Expand 10 before | Expand all | Expand 10 after
3078 void AllocationSinking::DetachMaterializations() { 3079 void AllocationSinking::DetachMaterializations() {
3079 for (intptr_t i = 0; i < materializations_.length(); i++) { 3080 for (intptr_t i = 0; i < materializations_.length(); i++) {
3080 materializations_[i]->previous()->LinkTo(materializations_[i]->next()); 3081 materializations_[i]->previous()->LinkTo(materializations_[i]->next());
3081 } 3082 }
3082 } 3083 }
3083 3084
3084 3085
3085 // Add a field/offset to the list of fields if it is not yet present there. 3086 // Add a field/offset to the list of fields if it is not yet present there.
3086 static bool AddSlot(ZoneGrowableArray<const Object*>* slots, 3087 static bool AddSlot(ZoneGrowableArray<const Object*>* slots,
3087 const Object& slot) { 3088 const Object& slot) {
3089 ASSERT(slot.IsSmi() || slot.IsField());
3090 ASSERT(!slot.IsField() || Field::Cast(slot).IsOriginal());
3088 for (intptr_t i = 0; i < slots->length(); i++) { 3091 for (intptr_t i = 0; i < slots->length(); i++) {
3089 if ((*slots)[i]->raw() == slot.raw()) { 3092 if ((*slots)[i]->raw() == slot.raw()) {
3090 return false; 3093 return false;
3091 } 3094 }
3092 } 3095 }
3093 slots->Add(&slot); 3096 slots->Add(&slot);
3094 return true; 3097 return true;
3095 } 3098 }
3096 3099
3097 3100
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
3274 // Collect all fields that are written for this instance. 3277 // Collect all fields that are written for this instance.
3275 ZoneGrowableArray<const Object*>* slots = 3278 ZoneGrowableArray<const Object*>* slots =
3276 new(Z) ZoneGrowableArray<const Object*>(5); 3279 new(Z) ZoneGrowableArray<const Object*>(5);
3277 3280
3278 for (Value* use = alloc->input_use_list(); 3281 for (Value* use = alloc->input_use_list();
3279 use != NULL; 3282 use != NULL;
3280 use = use->next_use()) { 3283 use = use->next_use()) {
3281 StoreInstanceFieldInstr* store = use->instruction()->AsStoreInstanceField(); 3284 StoreInstanceFieldInstr* store = use->instruction()->AsStoreInstanceField();
3282 if ((store != NULL) && (store->instance()->definition() == alloc)) { 3285 if ((store != NULL) && (store->instance()->definition() == alloc)) {
3283 if (!store->field().IsNull()) { 3286 if (!store->field().IsNull()) {
3284 AddSlot(slots, store->field()); 3287 AddSlot(slots, Field::ZoneHandle(Z, store->field().Original()));
3285 } else { 3288 } else {
3286 AddSlot(slots, Smi::ZoneHandle(Z, Smi::New(store->offset_in_bytes()))); 3289 AddSlot(slots, Smi::ZoneHandle(Z, Smi::New(store->offset_in_bytes())));
3287 } 3290 }
3288 } 3291 }
3289 } 3292 }
3290 3293
3291 if (alloc->ArgumentCount() > 0) { 3294 if (alloc->ArgumentCount() > 0) {
3292 AllocateObjectInstr* alloc_object = alloc->AsAllocateObject(); 3295 AllocateObjectInstr* alloc_object = alloc->AsAllocateObject();
3293 ASSERT(alloc_object->ArgumentCount() == 1); 3296 ASSERT(alloc_object->ArgumentCount() == 1);
3294 intptr_t type_args_offset = 3297 intptr_t type_args_offset =
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
3458 join->phis_ = NULL; 3461 join->phis_ = NULL;
3459 } else { 3462 } else {
3460 join->phis_->TruncateTo(to_index); 3463 join->phis_->TruncateTo(to_index);
3461 } 3464 }
3462 } 3465 }
3463 } 3466 }
3464 } 3467 }
3465 3468
3466 3469
3467 } // namespace dart 3470 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/raw_object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698