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

Side by Side Diff: src/hydrogen-instructions.h

Issue 180023002: Revert "Use stability to only conditionally flush information from the CheckMaps table." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Restore debug code Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/hydrogen-check-elimination.cc ('k') | src/hydrogen-instructions.cc » ('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 // 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 1546 matching lines...) Expand 10 before | Expand all | Expand 10 after
1557 expected_input_types_(expected_input_types) { 1557 expected_input_types_(expected_input_types) {
1558 SetFlag(kAllowUndefinedAsNaN); 1558 SetFlag(kAllowUndefinedAsNaN);
1559 } 1559 }
1560 1560
1561 ToBooleanStub::Types expected_input_types_; 1561 ToBooleanStub::Types expected_input_types_;
1562 }; 1562 };
1563 1563
1564 1564
1565 class HCompareMap V8_FINAL : public HUnaryControlInstruction { 1565 class HCompareMap V8_FINAL : public HUnaryControlInstruction {
1566 public: 1566 public:
1567 DECLARE_INSTRUCTION_FACTORY_P3(HCompareMap, HValue*, Handle<Map>, 1567 DECLARE_INSTRUCTION_FACTORY_P2(HCompareMap, HValue*, Handle<Map>);
1568 CompilationInfo*); 1568 DECLARE_INSTRUCTION_FACTORY_P4(HCompareMap, HValue*, Handle<Map>,
1569 DECLARE_INSTRUCTION_FACTORY_P5(HCompareMap, HValue*, Handle<Map>,
1570 CompilationInfo*,
1571 HBasicBlock*, HBasicBlock*); 1569 HBasicBlock*, HBasicBlock*);
1572 1570
1573 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE { 1571 virtual bool KnownSuccessorBlock(HBasicBlock** block) V8_OVERRIDE {
1574 if (known_successor_index() != kNoKnownSuccessorIndex) { 1572 if (known_successor_index() != kNoKnownSuccessorIndex) {
1575 *block = SuccessorAt(known_successor_index()); 1573 *block = SuccessorAt(known_successor_index());
1576 return true; 1574 return true;
1577 } 1575 }
1578 *block = NULL; 1576 *block = NULL;
1579 return false; 1577 return false;
1580 } 1578 }
1581 1579
1582 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 1580 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
1583 1581
1584 static const int kNoKnownSuccessorIndex = -1; 1582 static const int kNoKnownSuccessorIndex = -1;
1585 int known_successor_index() const { return known_successor_index_; } 1583 int known_successor_index() const { return known_successor_index_; }
1586 void set_known_successor_index(int known_successor_index) { 1584 void set_known_successor_index(int known_successor_index) {
1587 known_successor_index_ = known_successor_index; 1585 known_successor_index_ = known_successor_index;
1588 } 1586 }
1589 1587
1590 Unique<Map> map() const { return map_; } 1588 Unique<Map> map() const { return map_; }
1591 1589
1592 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 1590 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
1593 return Representation::Tagged(); 1591 return Representation::Tagged();
1594 } 1592 }
1595 1593
1596 bool is_stable() const {
1597 return is_stable_;
1598 }
1599
1600 DECLARE_CONCRETE_INSTRUCTION(CompareMap) 1594 DECLARE_CONCRETE_INSTRUCTION(CompareMap)
1601 1595
1602 protected: 1596 protected:
1603 virtual int RedefinedOperandIndex() { return 0; } 1597 virtual int RedefinedOperandIndex() { return 0; }
1604 1598
1605 private: 1599 private:
1606 HCompareMap(HValue* value, 1600 HCompareMap(HValue* value,
1607 Handle<Map> map, 1601 Handle<Map> map,
1608 CompilationInfo* info,
1609 HBasicBlock* true_target = NULL, 1602 HBasicBlock* true_target = NULL,
1610 HBasicBlock* false_target = NULL) 1603 HBasicBlock* false_target = NULL)
1611 : HUnaryControlInstruction(value, true_target, false_target), 1604 : HUnaryControlInstruction(value, true_target, false_target),
1612 known_successor_index_(kNoKnownSuccessorIndex), map_(Unique<Map>(map)) { 1605 known_successor_index_(kNoKnownSuccessorIndex), map_(Unique<Map>(map)) {
1613 ASSERT(!map.is_null()); 1606 ASSERT(!map.is_null());
1614 is_stable_ = map->is_stable();
1615
1616 if (is_stable_) {
1617 map->AddDependentCompilationInfo(
1618 DependentCode::kPrototypeCheckGroup, info);
1619 }
1620 set_representation(Representation::Tagged()); 1607 set_representation(Representation::Tagged());
1621 } 1608 }
1622 1609
1623 int known_successor_index_; 1610 int known_successor_index_;
1624 bool is_stable_;
1625 Unique<Map> map_; 1611 Unique<Map> map_;
1626 }; 1612 };
1627 1613
1628 1614
1629 class HContext V8_FINAL : public HTemplateInstruction<0> { 1615 class HContext V8_FINAL : public HTemplateInstruction<0> {
1630 public: 1616 public:
1631 static HContext* New(Zone* zone) { 1617 static HContext* New(Zone* zone) {
1632 return new(zone) HContext(); 1618 return new(zone) HContext();
1633 } 1619 }
1634 1620
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after
2700 }; 2686 };
2701 2687
2702 2688
2703 class HCheckMaps V8_FINAL : public HTemplateInstruction<2> { 2689 class HCheckMaps V8_FINAL : public HTemplateInstruction<2> {
2704 public: 2690 public:
2705 static HCheckMaps* New(Zone* zone, HValue* context, HValue* value, 2691 static HCheckMaps* New(Zone* zone, HValue* context, HValue* value,
2706 Handle<Map> map, CompilationInfo* info, 2692 Handle<Map> map, CompilationInfo* info,
2707 HValue* typecheck = NULL); 2693 HValue* typecheck = NULL);
2708 static HCheckMaps* New(Zone* zone, HValue* context, 2694 static HCheckMaps* New(Zone* zone, HValue* context,
2709 HValue* value, SmallMapList* maps, 2695 HValue* value, SmallMapList* maps,
2710 CompilationInfo* info,
2711 HValue* typecheck = NULL) { 2696 HValue* typecheck = NULL) {
2712 HCheckMaps* check_map = new(zone) HCheckMaps(value, zone, typecheck); 2697 HCheckMaps* check_map = new(zone) HCheckMaps(value, zone, typecheck);
2713 for (int i = 0; i < maps->length(); i++) { 2698 for (int i = 0; i < maps->length(); i++) {
2714 check_map->Add(maps->at(i), info, zone); 2699 check_map->Add(maps->at(i), zone);
2715 } 2700 }
2716 return check_map; 2701 return check_map;
2717 } 2702 }
2718 2703
2719 bool CanOmitMapChecks() { return omit_; } 2704 bool CanOmitMapChecks() { return omit_; }
2720 2705
2721 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; } 2706 virtual bool HasEscapingOperandAt(int index) V8_OVERRIDE { return false; }
2722 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 2707 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
2723 return Representation::Tagged(); 2708 return Representation::Tagged();
2724 } 2709 }
(...skipping 11 matching lines...) Expand all
2736 map_set_.Clear(); 2721 map_set_.Clear();
2737 for (int i = 0; i < maps->size(); i++) { 2722 for (int i = 0; i < maps->size(); i++) {
2738 map_set_.Add(maps->at(i), zone); 2723 map_set_.Add(maps->at(i), zone);
2739 } 2724 }
2740 } 2725 }
2741 2726
2742 bool has_migration_target() const { 2727 bool has_migration_target() const {
2743 return has_migration_target_; 2728 return has_migration_target_;
2744 } 2729 }
2745 2730
2746 bool is_stable() const {
2747 return is_stable_;
2748 }
2749
2750 DECLARE_CONCRETE_INSTRUCTION(CheckMaps) 2731 DECLARE_CONCRETE_INSTRUCTION(CheckMaps)
2751 2732
2752 protected: 2733 protected:
2753 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 2734 virtual bool DataEquals(HValue* other) V8_OVERRIDE {
2754 return this->map_set_.Equals(&HCheckMaps::cast(other)->map_set_); 2735 return this->map_set_.Equals(&HCheckMaps::cast(other)->map_set_);
2755 } 2736 }
2756 2737
2757 virtual int RedefinedOperandIndex() { return 0; } 2738 virtual int RedefinedOperandIndex() { return 0; }
2758 2739
2759 private: 2740 private:
2760 void Add(Handle<Map> map, CompilationInfo* info, Zone* zone) { 2741 void Add(Handle<Map> map, Zone* zone) {
2761 map_set_.Add(Unique<Map>(map), zone); 2742 map_set_.Add(Unique<Map>(map), zone);
2762 is_stable_ = is_stable_ && map->is_stable(); 2743 SetDependsOnFlag(kMaps);
2763 if (is_stable_) { 2744 SetDependsOnFlag(kElementsKind);
2764 map->AddDependentCompilationInfo(
2765 DependentCode::kPrototypeCheckGroup, info);
2766 } else {
2767 SetDependsOnFlag(kMaps);
2768 SetDependsOnFlag(kElementsKind);
2769 }
2770 2745
2771 if (!has_migration_target_ && map->is_migration_target()) { 2746 if (!has_migration_target_ && map->is_migration_target()) {
2772 has_migration_target_ = true; 2747 has_migration_target_ = true;
2773 SetChangesFlag(kNewSpacePromotion); 2748 SetChangesFlag(kNewSpacePromotion);
2774 } 2749 }
2775 } 2750 }
2776 2751
2777 // Clients should use one of the static New* methods above. 2752 // Clients should use one of the static New* methods above.
2778 HCheckMaps(HValue* value, Zone *zone, HValue* typecheck) 2753 HCheckMaps(HValue* value, Zone *zone, HValue* typecheck)
2779 : HTemplateInstruction<2>(value->type()), 2754 : HTemplateInstruction<2>(value->type()),
2780 omit_(false), has_migration_target_(false), is_stable_(true) { 2755 omit_(false), has_migration_target_(false) {
2781 SetOperandAt(0, value); 2756 SetOperandAt(0, value);
2782 // Use the object value for the dependency if NULL is passed. 2757 // Use the object value for the dependency if NULL is passed.
2783 SetOperandAt(1, typecheck != NULL ? typecheck : value); 2758 SetOperandAt(1, typecheck != NULL ? typecheck : value);
2784 set_representation(Representation::Tagged()); 2759 set_representation(Representation::Tagged());
2785 SetFlag(kUseGVN); 2760 SetFlag(kUseGVN);
2786 SetFlag(kTrackSideEffectDominators); 2761 SetFlag(kTrackSideEffectDominators);
2787 } 2762 }
2788 2763
2789 bool omit_; 2764 bool omit_;
2790 bool has_migration_target_; 2765 bool has_migration_target_;
2791 bool is_stable_;
2792 UniqueSet<Map> map_set_; 2766 UniqueSet<Map> map_set_;
2793 }; 2767 };
2794 2768
2795 2769
2796 class HCheckValue V8_FINAL : public HUnaryOperation { 2770 class HCheckValue V8_FINAL : public HUnaryOperation {
2797 public: 2771 public:
2798 static HCheckValue* New(Zone* zone, HValue* context, 2772 static HCheckValue* New(Zone* zone, HValue* context,
2799 HValue* value, Handle<JSFunction> func) { 2773 HValue* value, Handle<JSFunction> func) {
2800 bool in_new_space = zone->isolate()->heap()->InNewSpace(*func); 2774 bool in_new_space = zone->isolate()->heap()->InNewSpace(*func);
2801 // NOTE: We create an uninitialized Unique and initialize it later. 2775 // NOTE: We create an uninitialized Unique and initialize it later.
(...skipping 3760 matching lines...) Expand 10 before | Expand all | Expand 10 after
6562 } 6536 }
6563 6537
6564 void SetTransition(HConstant* map_constant, CompilationInfo* info) { 6538 void SetTransition(HConstant* map_constant, CompilationInfo* info) {
6565 ASSERT(!has_transition()); // Only set once. 6539 ASSERT(!has_transition()); // Only set once.
6566 Handle<Map> map = Handle<Map>::cast(map_constant->handle(info->isolate())); 6540 Handle<Map> map = Handle<Map>::cast(map_constant->handle(info->isolate()));
6567 if (map->CanBeDeprecated()) { 6541 if (map->CanBeDeprecated()) {
6568 map->AddDependentCompilationInfo(DependentCode::kTransitionGroup, info); 6542 map->AddDependentCompilationInfo(DependentCode::kTransitionGroup, info);
6569 } 6543 }
6570 SetOperandAt(2, map_constant); 6544 SetOperandAt(2, map_constant);
6571 has_transition_ = true; 6545 has_transition_ = true;
6572 is_stable_ = map->is_stable();
6573
6574 if (is_stable_) {
6575 map->AddDependentCompilationInfo(
6576 DependentCode::kPrototypeCheckGroup, info);
6577 }
6578 }
6579
6580 bool is_stable() const {
6581 return is_stable_;
6582 } 6546 }
6583 6547
6584 bool NeedsWriteBarrier() { 6548 bool NeedsWriteBarrier() {
6585 ASSERT(!(FLAG_track_double_fields && field_representation().IsDouble()) || 6549 ASSERT(!(FLAG_track_double_fields && field_representation().IsDouble()) ||
6586 !has_transition()); 6550 !has_transition());
6587 if (IsSkipWriteBarrier()) return false; 6551 if (IsSkipWriteBarrier()) return false;
6588 if (field_representation().IsDouble()) return false; 6552 if (field_representation().IsDouble()) return false;
6589 if (field_representation().IsSmi()) return false; 6553 if (field_representation().IsSmi()) return false;
6590 if (field_representation().IsInteger32()) return false; 6554 if (field_representation().IsInteger32()) return false;
6591 if (field_representation().IsExternal()) return false; 6555 if (field_representation().IsExternal()) return false;
(...skipping 18 matching lines...) Expand all
6610 6574
6611 private: 6575 private:
6612 HStoreNamedField(HValue* obj, 6576 HStoreNamedField(HValue* obj,
6613 HObjectAccess access, 6577 HObjectAccess access,
6614 HValue* val, 6578 HValue* val,
6615 StoreFieldOrKeyedMode store_mode = INITIALIZING_STORE) 6579 StoreFieldOrKeyedMode store_mode = INITIALIZING_STORE)
6616 : access_(access), 6580 : access_(access),
6617 new_space_dominator_(NULL), 6581 new_space_dominator_(NULL),
6618 write_barrier_mode_(UPDATE_WRITE_BARRIER), 6582 write_barrier_mode_(UPDATE_WRITE_BARRIER),
6619 has_transition_(false), 6583 has_transition_(false),
6620 is_stable_(false),
6621 store_mode_(store_mode) { 6584 store_mode_(store_mode) {
6622 // Stores to a non existing in-object property are allowed only to the 6585 // Stores to a non existing in-object property are allowed only to the
6623 // newly allocated objects (via HAllocate or HInnerAllocatedObject). 6586 // newly allocated objects (via HAllocate or HInnerAllocatedObject).
6624 ASSERT(!access.IsInobject() || access.existing_inobject_property() || 6587 ASSERT(!access.IsInobject() || access.existing_inobject_property() ||
6625 obj->IsAllocate() || obj->IsInnerAllocatedObject()); 6588 obj->IsAllocate() || obj->IsInnerAllocatedObject());
6626 SetOperandAt(0, obj); 6589 SetOperandAt(0, obj);
6627 SetOperandAt(1, val); 6590 SetOperandAt(1, val);
6628 SetOperandAt(2, obj); 6591 SetOperandAt(2, obj);
6629 access.SetGVNFlags(this, STORE); 6592 access.SetGVNFlags(this, STORE);
6630 } 6593 }
6631 6594
6632 HObjectAccess access_; 6595 HObjectAccess access_;
6633 HValue* new_space_dominator_; 6596 HValue* new_space_dominator_;
6634 WriteBarrierMode write_barrier_mode_ : 1; 6597 WriteBarrierMode write_barrier_mode_ : 1;
6635 bool has_transition_ : 1; 6598 bool has_transition_ : 1;
6636 bool is_stable_ : 1;
6637 StoreFieldOrKeyedMode store_mode_ : 1; 6599 StoreFieldOrKeyedMode store_mode_ : 1;
6638 }; 6600 };
6639 6601
6640 6602
6641 class HStoreNamedGeneric V8_FINAL : public HTemplateInstruction<3> { 6603 class HStoreNamedGeneric V8_FINAL : public HTemplateInstruction<3> {
6642 public: 6604 public:
6643 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreNamedGeneric, HValue*, 6605 DECLARE_INSTRUCTION_WITH_CONTEXT_FACTORY_P4(HStoreNamedGeneric, HValue*,
6644 Handle<String>, HValue*, 6606 Handle<String>, HValue*,
6645 StrictModeFlag); 6607 StrictModeFlag);
6646 HValue* object() { return OperandAt(0); } 6608 HValue* object() { return OperandAt(0); }
(...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after
7520 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7482 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7521 }; 7483 };
7522 7484
7523 7485
7524 #undef DECLARE_INSTRUCTION 7486 #undef DECLARE_INSTRUCTION
7525 #undef DECLARE_CONCRETE_INSTRUCTION 7487 #undef DECLARE_CONCRETE_INSTRUCTION
7526 7488
7527 } } // namespace v8::internal 7489 } } // namespace v8::internal
7528 7490
7529 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7491 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen-check-elimination.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698