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

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

Issue 35413007: HCheckInstanceType factories unified (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 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.cc ('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 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 2759 matching lines...) Expand 10 before | Expand all | Expand 10 after
2770 SetFlag(kUseGVN); 2770 SetFlag(kUseGVN);
2771 } 2771 }
2772 2772
2773 Unique<HeapObject> object_; 2773 Unique<HeapObject> object_;
2774 bool object_in_new_space_; 2774 bool object_in_new_space_;
2775 }; 2775 };
2776 2776
2777 2777
2778 class HCheckInstanceType V8_FINAL : public HUnaryOperation { 2778 class HCheckInstanceType V8_FINAL : public HUnaryOperation {
2779 public: 2779 public:
2780 static HCheckInstanceType* NewIsSpecObject(HValue* value, Zone* zone) { 2780 enum Check {
2781 return new(zone) HCheckInstanceType(value, IS_SPEC_OBJECT); 2781 IS_SPEC_OBJECT,
2782 } 2782 IS_JS_ARRAY,
2783 static HCheckInstanceType* NewIsJSArray(HValue* value, Zone* zone) { 2783 IS_STRING,
2784 return new(zone) HCheckInstanceType(value, IS_JS_ARRAY); 2784 IS_INTERNALIZED_STRING,
2785 } 2785 LAST_INTERVAL_CHECK = IS_JS_ARRAY
2786 static HCheckInstanceType* NewIsString(HValue* value, Zone* zone) { 2786 };
2787 return new(zone) HCheckInstanceType(value, IS_STRING); 2787
2788 } 2788 DECLARE_INSTRUCTION_FACTORY_P2(HCheckInstanceType, HValue*, Check);
2789 static HCheckInstanceType* NewIsInternalizedString(
2790 HValue* value, Zone* zone) {
2791 return new(zone) HCheckInstanceType(value, IS_INTERNALIZED_STRING);
2792 }
2793 2789
2794 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE; 2790 virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
2795 2791
2796 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE { 2792 virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
2797 return Representation::Tagged(); 2793 return Representation::Tagged();
2798 } 2794 }
2799 2795
2800 virtual HValue* Canonicalize() V8_OVERRIDE; 2796 virtual HValue* Canonicalize() V8_OVERRIDE;
2801 2797
2802 bool is_interval_check() const { return check_ <= LAST_INTERVAL_CHECK; } 2798 bool is_interval_check() const { return check_ <= LAST_INTERVAL_CHECK; }
2803 void GetCheckInterval(InstanceType* first, InstanceType* last); 2799 void GetCheckInterval(InstanceType* first, InstanceType* last);
2804 void GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag); 2800 void GetCheckMaskAndTag(uint8_t* mask, uint8_t* tag);
2805 2801
2806 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType) 2802 DECLARE_CONCRETE_INSTRUCTION(CheckInstanceType)
2807 2803
2808 protected: 2804 protected:
2809 // TODO(ager): It could be nice to allow the ommision of instance 2805 // TODO(ager): It could be nice to allow the ommision of instance
2810 // type checks if we have already performed an instance type check 2806 // type checks if we have already performed an instance type check
2811 // with a larger range. 2807 // with a larger range.
2812 virtual bool DataEquals(HValue* other) V8_OVERRIDE { 2808 virtual bool DataEquals(HValue* other) V8_OVERRIDE {
2813 HCheckInstanceType* b = HCheckInstanceType::cast(other); 2809 HCheckInstanceType* b = HCheckInstanceType::cast(other);
2814 return check_ == b->check_; 2810 return check_ == b->check_;
2815 } 2811 }
2816 2812
2817 virtual int RedefinedOperandIndex() { return 0; } 2813 virtual int RedefinedOperandIndex() { return 0; }
2818 2814
2819 private: 2815 private:
2820 enum Check {
2821 IS_SPEC_OBJECT,
2822 IS_JS_ARRAY,
2823 IS_STRING,
2824 IS_INTERNALIZED_STRING,
2825 LAST_INTERVAL_CHECK = IS_JS_ARRAY
2826 };
2827
2828 const char* GetCheckName(); 2816 const char* GetCheckName();
2829 2817
2830 HCheckInstanceType(HValue* value, Check check) 2818 HCheckInstanceType(HValue* value, Check check)
2831 : HUnaryOperation(value), check_(check) { 2819 : HUnaryOperation(value), check_(check) {
2832 set_representation(Representation::Tagged()); 2820 set_representation(Representation::Tagged());
2833 SetFlag(kUseGVN); 2821 SetFlag(kUseGVN);
2834 } 2822 }
2835 2823
2836 const Check check_; 2824 const Check check_;
2837 }; 2825 };
(...skipping 4375 matching lines...) Expand 10 before | Expand all | Expand 10 after
7213 virtual bool IsDeletable() const V8_OVERRIDE { return true; } 7201 virtual bool IsDeletable() const V8_OVERRIDE { return true; }
7214 }; 7202 };
7215 7203
7216 7204
7217 #undef DECLARE_INSTRUCTION 7205 #undef DECLARE_INSTRUCTION
7218 #undef DECLARE_CONCRETE_INSTRUCTION 7206 #undef DECLARE_CONCRETE_INSTRUCTION
7219 7207
7220 } } // namespace v8::internal 7208 } } // namespace v8::internal
7221 7209
7222 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 7210 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698