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 2536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 for (int i = 0; i < maps->length(); i++) { | 2556 for (int i = 0; i < maps->length(); i++) { |
2557 check_map->map_set_.Add(maps->at(i), zone); | 2557 check_map->Add(maps->at(i), zone); |
2558 check_map->has_migration_target_ |= maps->at(i)->is_migration_target(); | |
2559 } | 2558 } |
2560 check_map->map_set_.Sort(); | 2559 check_map->map_set_.Sort(); |
2561 return check_map; | 2560 return check_map; |
2562 } | 2561 } |
2563 | 2562 |
2564 bool CanOmitMapChecks() { return omit_; } | 2563 bool CanOmitMapChecks() { return omit_; } |
2565 | 2564 |
2566 virtual bool HasEscapingOperandAt(int index) { return false; } | 2565 virtual bool HasEscapingOperandAt(int index) { return false; } |
2567 virtual Representation RequiredInputRepresentation(int index) { | 2566 virtual Representation RequiredInputRepresentation(int index) { |
2568 return Representation::Tagged(); | 2567 return Representation::Tagged(); |
(...skipping 23 matching lines...) Expand all Loading... |
2592 } | 2591 } |
2593 for (int i = 0; i < map_unique_ids_.length(); i++) { | 2592 for (int i = 0; i < map_unique_ids_.length(); i++) { |
2594 if (map_unique_ids_.at(i) != b->map_unique_ids_.at(i)) { | 2593 if (map_unique_ids_.at(i) != b->map_unique_ids_.at(i)) { |
2595 return false; | 2594 return false; |
2596 } | 2595 } |
2597 } | 2596 } |
2598 return true; | 2597 return true; |
2599 } | 2598 } |
2600 | 2599 |
2601 private: | 2600 private: |
| 2601 void Add(Handle<Map> map, Zone* zone) { |
| 2602 map_set_.Add(map, zone); |
| 2603 if (!has_migration_target_ && map->is_migration_target()) { |
| 2604 has_migration_target_ = true; |
| 2605 SetGVNFlag(kChangesNewSpacePromotion); |
| 2606 } |
| 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 |