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

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

Issue 22831003: Pass checked values to HLoadNamedField, removing the need for extra type-check field. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 7 years, 4 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-escape-analysis.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 1341 matching lines...) Expand 10 before | Expand all | Expand 10 after
1352 virtual void PrintDataTo(StringStream* stream); 1352 virtual void PrintDataTo(StringStream* stream);
1353 1353
1354 Handle<Map> map() const { return map_; } 1354 Handle<Map> map() const { return map_; }
1355 1355
1356 virtual Representation RequiredInputRepresentation(int index) { 1356 virtual Representation RequiredInputRepresentation(int index) {
1357 return Representation::Tagged(); 1357 return Representation::Tagged();
1358 } 1358 }
1359 1359
1360 DECLARE_CONCRETE_INSTRUCTION(CompareMap) 1360 DECLARE_CONCRETE_INSTRUCTION(CompareMap)
1361 1361
1362 protected:
1363 virtual int RedefinedOperandIndex() { return 0; }
1364
1362 private: 1365 private:
1363 Handle<Map> map_; 1366 Handle<Map> map_;
1364 }; 1367 };
1365 1368
1366 1369
1367 class HContext: public HTemplateInstruction<0> { 1370 class HContext: public HTemplateInstruction<0> {
1368 public: 1371 public:
1369 static HContext* New(Zone* zone) { 1372 static HContext* New(Zone* zone) {
1370 return new(zone) HContext(); 1373 return new(zone) HContext();
1371 } 1374 }
(...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after
2591 return false; 2594 return false;
2592 } 2595 }
2593 for (int i = 0; i < map_unique_ids_.length(); i++) { 2596 for (int i = 0; i < map_unique_ids_.length(); i++) {
2594 if (map_unique_ids_.at(i) != b->map_unique_ids_.at(i)) { 2597 if (map_unique_ids_.at(i) != b->map_unique_ids_.at(i)) {
2595 return false; 2598 return false;
2596 } 2599 }
2597 } 2600 }
2598 return true; 2601 return true;
2599 } 2602 }
2600 2603
2604 virtual int RedefinedOperandIndex() { return 0; }
2605
2601 private: 2606 private:
2602 // Clients should use one of the static New* methods above. 2607 // Clients should use one of the static New* methods above.
2603 HCheckMaps(HValue* value, Zone *zone, HValue* typecheck) 2608 HCheckMaps(HValue* value, Zone *zone, HValue* typecheck)
2604 : HTemplateInstruction<2>(value->type()), 2609 : HTemplateInstruction<2>(value->type()),
2605 omit_(false), has_migration_target_(false), map_unique_ids_(0, zone) { 2610 omit_(false), has_migration_target_(false), map_unique_ids_(0, zone) {
2606 SetOperandAt(0, value); 2611 SetOperandAt(0, value);
2607 // Use the object value for the dependency if NULL is passed. 2612 // Use the object value for the dependency if NULL is passed.
2608 // TODO(titzer): do GVN flags already express this dependency? 2613 // TODO(titzer): do GVN flags already express this dependency?
2609 SetOperandAt(1, typecheck != NULL ? typecheck : value); 2614 SetOperandAt(1, typecheck != NULL ? typecheck : value);
2610 set_representation(Representation::Tagged()); 2615 set_representation(Representation::Tagged());
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
2707 2712
2708 protected: 2713 protected:
2709 // TODO(ager): It could be nice to allow the ommision of instance 2714 // TODO(ager): It could be nice to allow the ommision of instance
2710 // type checks if we have already performed an instance type check 2715 // type checks if we have already performed an instance type check
2711 // with a larger range. 2716 // with a larger range.
2712 virtual bool DataEquals(HValue* other) { 2717 virtual bool DataEquals(HValue* other) {
2713 HCheckInstanceType* b = HCheckInstanceType::cast(other); 2718 HCheckInstanceType* b = HCheckInstanceType::cast(other);
2714 return check_ == b->check_; 2719 return check_ == b->check_;
2715 } 2720 }
2716 2721
2722 virtual int RedefinedOperandIndex() { return 0; }
2723
2717 private: 2724 private:
2718 enum Check { 2725 enum Check {
2719 IS_SPEC_OBJECT, 2726 IS_SPEC_OBJECT,
2720 IS_JS_ARRAY, 2727 IS_JS_ARRAY,
2721 IS_STRING, 2728 IS_STRING,
2722 IS_INTERNALIZED_STRING, 2729 IS_INTERNALIZED_STRING,
2723 LAST_INTERVAL_CHECK = IS_JS_ARRAY 2730 LAST_INTERVAL_CHECK = IS_JS_ARRAY
2724 }; 2731 };
2725 2732
2726 const char* GetCheckName(); 2733 const char* GetCheckName();
(...skipping 2821 matching lines...) Expand 10 before | Expand all | Expand 10 after
5548 5555
5549 friend class HLoadNamedField; 5556 friend class HLoadNamedField;
5550 friend class HStoreNamedField; 5557 friend class HStoreNamedField;
5551 5558
5552 inline Portion portion() const { 5559 inline Portion portion() const {
5553 return PortionField::decode(value_); 5560 return PortionField::decode(value_);
5554 } 5561 }
5555 }; 5562 };
5556 5563
5557 5564
5558 class HLoadNamedField: public HTemplateInstruction<2> { 5565 class HLoadNamedField: public HTemplateInstruction<1> {
5559 public: 5566 public:
5560 DECLARE_INSTRUCTION_FACTORY_P2(HLoadNamedField, HValue*, HObjectAccess); 5567 DECLARE_INSTRUCTION_FACTORY_P2(HLoadNamedField, HValue*, HObjectAccess);
5561 DECLARE_INSTRUCTION_FACTORY_P3(HLoadNamedField, HValue*, HObjectAccess,
5562 HValue*);
5563 5568
5564 HValue* object() { return OperandAt(0); } 5569 HValue* object() { return OperandAt(0); }
5565 HValue* typecheck() { 5570 bool HasTypeCheck() { return object()->IsCheckMaps(); }
5566 ASSERT(HasTypeCheck()); 5571 void ClearTypeCheck() { SetOperandAt(0, object()->ActualValue()); }
5567 return OperandAt(1);
5568 }
5569
5570 bool HasTypeCheck() const { return OperandAt(0) != OperandAt(1); }
5571 void ClearTypeCheck() { SetOperandAt(1, object()); }
5572 HObjectAccess access() const { return access_; } 5572 HObjectAccess access() const { return access_; }
5573 Representation field_representation() const { 5573 Representation field_representation() const {
5574 return access_.representation(); 5574 return access_.representation();
5575 } 5575 }
5576 5576
5577 virtual bool HasEscapingOperandAt(int index) { return false; } 5577 virtual bool HasEscapingOperandAt(int index) { return false; }
5578 virtual Representation RequiredInputRepresentation(int index) { 5578 virtual Representation RequiredInputRepresentation(int index) {
5579 if (index == 0 && access().IsExternalMemory()) { 5579 if (index == 0 && access().IsExternalMemory()) {
5580 // object must be external in case of external memory access 5580 // object must be external in case of external memory access
5581 return Representation::External(); 5581 return Representation::External();
5582 } 5582 }
5583 return Representation::Tagged(); 5583 return Representation::Tagged();
5584 } 5584 }
5585 virtual Range* InferRange(Zone* zone); 5585 virtual Range* InferRange(Zone* zone);
5586 virtual void PrintDataTo(StringStream* stream); 5586 virtual void PrintDataTo(StringStream* stream);
5587 5587
5588 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) 5588 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField)
5589 5589
5590 protected: 5590 protected:
5591 virtual bool DataEquals(HValue* other) { 5591 virtual bool DataEquals(HValue* other) {
5592 HLoadNamedField* b = HLoadNamedField::cast(other); 5592 HLoadNamedField* b = HLoadNamedField::cast(other);
5593 return access_.Equals(b->access_); 5593 return access_.Equals(b->access_);
5594 } 5594 }
5595 5595
5596 private: 5596 private:
5597 HLoadNamedField(HValue* object, 5597 HLoadNamedField(HValue* object, HObjectAccess access) : access_(access) {
5598 HObjectAccess access,
5599 HValue* typecheck = NULL)
5600 : access_(access) {
5601 ASSERT(object != NULL); 5598 ASSERT(object != NULL);
5602 SetOperandAt(0, object); 5599 SetOperandAt(0, object);
5603 SetOperandAt(1, typecheck != NULL ? typecheck : object);
5604 5600
5605 Representation representation = access.representation(); 5601 Representation representation = access.representation();
5606 if (representation.IsSmi()) { 5602 if (representation.IsSmi()) {
5607 set_type(HType::Smi()); 5603 set_type(HType::Smi());
5608 set_representation(representation); 5604 set_representation(representation);
5609 } else if (representation.IsDouble() || 5605 } else if (representation.IsDouble() ||
5610 representation.IsExternal() || 5606 representation.IsExternal() ||
5611 representation.IsInteger32()) { 5607 representation.IsInteger32()) {
5612 set_representation(representation); 5608 set_representation(representation);
5613 } else if (FLAG_track_heap_object_fields && 5609 } else if (FLAG_track_heap_object_fields &&
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after
6766 virtual bool IsDeletable() const { return true; } 6762 virtual bool IsDeletable() const { return true; }
6767 }; 6763 };
6768 6764
6769 6765
6770 #undef DECLARE_INSTRUCTION 6766 #undef DECLARE_INSTRUCTION
6771 #undef DECLARE_CONCRETE_INSTRUCTION 6767 #undef DECLARE_CONCRETE_INSTRUCTION
6772 6768
6773 } } // namespace v8::internal 6769 } } // namespace v8::internal
6774 6770
6775 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 6771 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen-escape-analysis.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698