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

Side by Side Diff: src/property-details.h

Issue 90643003: Experimental implementation: Exposing SIMD instructions into JavaScript Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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/objects-visiting.cc ('k') | src/runtime.h » ('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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 public: 82 public:
83 enum Kind { 83 enum Kind {
84 kNone, 84 kNone,
85 kInteger8, 85 kInteger8,
86 kUInteger8, 86 kUInteger8,
87 kInteger16, 87 kInteger16,
88 kUInteger16, 88 kUInteger16,
89 kSmi, 89 kSmi,
90 kInteger32, 90 kInteger32,
91 kDouble, 91 kDouble,
92 kFloat32x4,
93 kInt32x4,
92 kHeapObject, 94 kHeapObject,
93 kTagged, 95 kTagged,
94 kExternal, 96 kExternal,
95 kNumRepresentations 97 kNumRepresentations
96 }; 98 };
97 99
98 Representation() : kind_(kNone) { } 100 Representation() : kind_(kNone) { }
99 101
100 static Representation None() { return Representation(kNone); } 102 static Representation None() { return Representation(kNone); }
101 static Representation Tagged() { return Representation(kTagged); } 103 static Representation Tagged() { return Representation(kTagged); }
102 static Representation Integer8() { return Representation(kInteger8); } 104 static Representation Integer8() { return Representation(kInteger8); }
103 static Representation UInteger8() { return Representation(kUInteger8); } 105 static Representation UInteger8() { return Representation(kUInteger8); }
104 static Representation Integer16() { return Representation(kInteger16); } 106 static Representation Integer16() { return Representation(kInteger16); }
105 static Representation UInteger16() { 107 static Representation UInteger16() {
106 return Representation(kUInteger16); 108 return Representation(kUInteger16);
107 } 109 }
108 static Representation Smi() { return Representation(kSmi); } 110 static Representation Smi() { return Representation(kSmi); }
109 static Representation Integer32() { return Representation(kInteger32); } 111 static Representation Integer32() { return Representation(kInteger32); }
110 static Representation Double() { return Representation(kDouble); } 112 static Representation Double() { return Representation(kDouble); }
113 static Representation Float32x4() { return Representation(kFloat32x4); }
114 static Representation Int32x4() { return Representation(kInt32x4); }
111 static Representation HeapObject() { return Representation(kHeapObject); } 115 static Representation HeapObject() { return Representation(kHeapObject); }
112 static Representation External() { return Representation(kExternal); } 116 static Representation External() { return Representation(kExternal); }
113 117
114 static Representation FromKind(Kind kind) { return Representation(kind); } 118 static Representation FromKind(Kind kind) { return Representation(kind); }
115 119
116 // TODO(rossberg): this should die eventually. 120 // TODO(rossberg): this should die eventually.
117 static Representation FromType(TypeInfo info); 121 static Representation FromType(TypeInfo info);
118 static Representation FromType(Handle<Type> type); 122 static Representation FromType(Handle<Type> type);
119 123
120 bool Equals(const Representation& other) const { 124 bool Equals(const Representation& other) const {
121 return kind_ == other.kind_; 125 return kind_ == other.kind_;
122 } 126 }
123 127
124 bool IsCompatibleForLoad(const Representation& other) const { 128 bool IsCompatibleForLoad(const Representation& other) const {
125 return (IsDouble() && other.IsDouble()) || 129 return (IsDouble() && other.IsDouble()) ||
126 (!IsDouble() && !other.IsDouble()); 130 (!IsDouble() && !other.IsDouble());
127 } 131 }
128 132
129 bool IsCompatibleForStore(const Representation& other) const { 133 bool IsCompatibleForStore(const Representation& other) const {
130 return Equals(other); 134 return Equals(other);
131 } 135 }
132 136
133 bool is_more_general_than(const Representation& other) const { 137 bool is_more_general_than(const Representation& other) const {
134 if (kind_ == kExternal && other.kind_ == kNone) return true; 138 if (kind_ == kExternal && other.kind_ == kNone) return true;
135 if (kind_ == kExternal && other.kind_ == kExternal) return false; 139 if (kind_ == kExternal && other.kind_ == kExternal) return false;
136 if (kind_ == kNone && other.kind_ == kExternal) return false; 140 if (kind_ == kNone && other.kind_ == kExternal) return false;
137 141
138 ASSERT(kind_ != kExternal); 142 ASSERT(kind_ != kExternal);
139 ASSERT(other.kind_ != kExternal); 143 ASSERT(other.kind_ != kExternal);
140 if (IsHeapObject()) return other.IsDouble() || other.IsNone(); 144 if (IsHeapObject()) {
145 return other.IsDouble() || other.IsFloat32x4() || other.IsInt32x4() ||
146 other.IsNone();
147 }
141 if (kind_ == kUInteger8 && other.kind_ == kInteger8) return false; 148 if (kind_ == kUInteger8 && other.kind_ == kInteger8) return false;
142 if (kind_ == kUInteger16 && other.kind_ == kInteger16) return false; 149 if (kind_ == kUInteger16 && other.kind_ == kInteger16) return false;
143 return kind_ > other.kind_; 150 return kind_ > other.kind_;
144 } 151 }
145 152
146 bool fits_into(const Representation& other) const { 153 bool fits_into(const Representation& other) const {
147 return other.is_more_general_than(*this) || other.Equals(*this); 154 return other.is_more_general_than(*this) || other.Equals(*this);
148 } 155 }
149 156
150 Representation generalize(Representation other) { 157 Representation generalize(Representation other) {
(...skipping 21 matching lines...) Expand all
172 bool IsInteger8() const { return kind_ == kInteger8; } 179 bool IsInteger8() const { return kind_ == kInteger8; }
173 bool IsUInteger8() const { return kind_ == kUInteger8; } 180 bool IsUInteger8() const { return kind_ == kUInteger8; }
174 bool IsInteger16() const { return kind_ == kInteger16; } 181 bool IsInteger16() const { return kind_ == kInteger16; }
175 bool IsUInteger16() const { return kind_ == kUInteger16; } 182 bool IsUInteger16() const { return kind_ == kUInteger16; }
176 bool IsTagged() const { return kind_ == kTagged; } 183 bool IsTagged() const { return kind_ == kTagged; }
177 bool IsSmi() const { return kind_ == kSmi; } 184 bool IsSmi() const { return kind_ == kSmi; }
178 bool IsSmiOrTagged() const { return IsSmi() || IsTagged(); } 185 bool IsSmiOrTagged() const { return IsSmi() || IsTagged(); }
179 bool IsInteger32() const { return kind_ == kInteger32; } 186 bool IsInteger32() const { return kind_ == kInteger32; }
180 bool IsSmiOrInteger32() const { return IsSmi() || IsInteger32(); } 187 bool IsSmiOrInteger32() const { return IsSmi() || IsInteger32(); }
181 bool IsDouble() const { return kind_ == kDouble; } 188 bool IsDouble() const { return kind_ == kDouble; }
189 bool IsFloat32x4() const { return kind_ == kFloat32x4; }
190 bool IsInt32x4() const { return kind_ == kInt32x4; }
182 bool IsHeapObject() const { return kind_ == kHeapObject; } 191 bool IsHeapObject() const { return kind_ == kHeapObject; }
183 bool IsExternal() const { return kind_ == kExternal; } 192 bool IsExternal() const { return kind_ == kExternal; }
184 bool IsSpecialization() const { 193 bool IsSpecialization() const {
185 return IsInteger8() || IsUInteger8() || 194 return IsInteger8() || IsUInteger8() ||
186 IsInteger16() || IsUInteger16() || 195 IsInteger16() || IsUInteger16() ||
187 IsSmi() || IsInteger32() || IsDouble(); 196 IsSmi() || IsInteger32() || IsDouble();
188 } 197 }
189 const char* Mnemonic() const; 198 const char* Mnemonic() const;
190 199
191 private: 200 private:
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 PropertyDetails(int value, PropertyAttributes attributes) { 328 PropertyDetails(int value, PropertyAttributes attributes) {
320 value_ = AttributesField::update(value, attributes); 329 value_ = AttributesField::update(value, attributes);
321 } 330 }
322 331
323 uint32_t value_; 332 uint32_t value_;
324 }; 333 };
325 334
326 } } // namespace v8::internal 335 } } // namespace v8::internal
327 336
328 #endif // V8_PROPERTY_DETAILS_H_ 337 #endif // V8_PROPERTY_DETAILS_H_
OLDNEW
« no previous file with comments | « src/objects-visiting.cc ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698