OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 2535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2546 | 2546 |
2547 class HCheckMaps: public HTemplateInstruction<2> { | 2547 class HCheckMaps: public HTemplateInstruction<2> { |
2548 public: | 2548 public: |
2549 static HCheckMaps* New(Zone* zone, HValue* context, HValue* value, | 2549 static HCheckMaps* New(Zone* zone, HValue* context, HValue* value, |
2550 Handle<Map> map, CompilationInfo* info, | 2550 Handle<Map> map, CompilationInfo* info, |
2551 HValue *typecheck = NULL); | 2551 HValue *typecheck = NULL); |
2552 static HCheckMaps* New(Zone* zone, HValue* context, | 2552 static HCheckMaps* New(Zone* zone, HValue* context, |
2553 HValue* value, SmallMapList* maps, | 2553 HValue* value, SmallMapList* maps, |
2554 HValue *typecheck = NULL) { | 2554 HValue *typecheck = NULL) { |
2555 HCheckMaps* check_map = new(zone) HCheckMaps(value, zone, typecheck); | 2555 HCheckMaps* check_map = new(zone) HCheckMaps(value, zone, typecheck); |
2556 bool has_migration_target = false; | |
2556 for (int i = 0; i < maps->length(); i++) { | 2557 for (int i = 0; i < maps->length(); i++) { |
2557 check_map->map_set_.Add(maps->at(i), zone); | 2558 check_map->map_set_.Add(maps->at(i), zone); |
danno
2013/08/13 09:17:41
Why not choke-point the Add method, looking for ma
| |
2558 check_map->has_migration_target_ |= maps->at(i)->is_migration_target(); | 2559 has_migration_target |= maps->at(i)->is_migration_target(); |
2559 } | 2560 } |
2561 if (has_migration_target) check_map->MarkMigrationTarget(); | |
2560 check_map->map_set_.Sort(); | 2562 check_map->map_set_.Sort(); |
2561 return check_map; | 2563 return check_map; |
2562 } | 2564 } |
2563 | 2565 |
2564 bool CanOmitMapChecks() { return omit_; } | 2566 bool CanOmitMapChecks() { return omit_; } |
2565 | 2567 |
2566 virtual bool HasEscapingOperandAt(int index) { return false; } | 2568 virtual bool HasEscapingOperandAt(int index) { return false; } |
2567 virtual Representation RequiredInputRepresentation(int index) { | 2569 virtual Representation RequiredInputRepresentation(int index) { |
2568 return Representation::Tagged(); | 2570 return Representation::Tagged(); |
2569 } | 2571 } |
(...skipping 22 matching lines...) Expand all Loading... | |
2592 } | 2594 } |
2593 for (int i = 0; i < map_unique_ids_.length(); i++) { | 2595 for (int i = 0; i < map_unique_ids_.length(); i++) { |
2594 if (map_unique_ids_.at(i) != b->map_unique_ids_.at(i)) { | 2596 if (map_unique_ids_.at(i) != b->map_unique_ids_.at(i)) { |
2595 return false; | 2597 return false; |
2596 } | 2598 } |
2597 } | 2599 } |
2598 return true; | 2600 return true; |
2599 } | 2601 } |
2600 | 2602 |
2601 private: | 2603 private: |
2604 void MarkMigrationTarget() { | |
2605 has_migration_target_ = true; | |
2606 SetGVNFlag(kChangesNewSpacePromotion); | |
2607 } | |
2608 | |
2602 // Clients should use one of the static New* methods above. | 2609 // Clients should use one of the static New* methods above. |
2603 HCheckMaps(HValue* value, Zone *zone, HValue* typecheck) | 2610 HCheckMaps(HValue* value, Zone *zone, HValue* typecheck) |
2604 : HTemplateInstruction<2>(value->type()), | 2611 : HTemplateInstruction<2>(value->type()), |
2605 omit_(false), has_migration_target_(false), map_unique_ids_(0, zone) { | 2612 omit_(false), has_migration_target_(false), map_unique_ids_(0, zone) { |
2606 SetOperandAt(0, value); | 2613 SetOperandAt(0, value); |
2607 // Use the object value for the dependency if NULL is passed. | 2614 // Use the object value for the dependency if NULL is passed. |
2608 // TODO(titzer): do GVN flags already express this dependency? | 2615 // TODO(titzer): do GVN flags already express this dependency? |
2609 SetOperandAt(1, typecheck != NULL ? typecheck : value); | 2616 SetOperandAt(1, typecheck != NULL ? typecheck : value); |
2610 set_representation(Representation::Tagged()); | 2617 set_representation(Representation::Tagged()); |
2611 SetFlag(kUseGVN); | 2618 SetFlag(kUseGVN); |
(...skipping 4154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6766 virtual bool IsDeletable() const { return true; } | 6773 virtual bool IsDeletable() const { return true; } |
6767 }; | 6774 }; |
6768 | 6775 |
6769 | 6776 |
6770 #undef DECLARE_INSTRUCTION | 6777 #undef DECLARE_INSTRUCTION |
6771 #undef DECLARE_CONCRETE_INSTRUCTION | 6778 #undef DECLARE_CONCRETE_INSTRUCTION |
6772 | 6779 |
6773 } } // namespace v8::internal | 6780 } } // namespace v8::internal |
6774 | 6781 |
6775 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 6782 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |