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

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

Issue 6410112: Implement crankshaft support for pixel array loads. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: review feedback, x64 and arm impl Created 9 years, 10 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
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 V(ClassOfTest) \ 119 V(ClassOfTest) \
120 V(LeaveInlined) \ 120 V(LeaveInlined) \
121 V(LoadContextSlot) \ 121 V(LoadContextSlot) \
122 V(LoadElements) \ 122 V(LoadElements) \
123 V(LoadFunctionPrototype) \ 123 V(LoadFunctionPrototype) \
124 V(LoadGlobal) \ 124 V(LoadGlobal) \
125 V(LoadKeyedFastElement) \ 125 V(LoadKeyedFastElement) \
126 V(LoadKeyedGeneric) \ 126 V(LoadKeyedGeneric) \
127 V(LoadNamedField) \ 127 V(LoadNamedField) \
128 V(LoadNamedGeneric) \ 128 V(LoadNamedGeneric) \
129 V(LoadPixelArrayElement) \
130 V(LoadPixelArrayExternalPointer) \
129 V(Mod) \ 131 V(Mod) \
130 V(Mul) \ 132 V(Mul) \
131 V(ObjectLiteral) \ 133 V(ObjectLiteral) \
132 V(OsrEntry) \ 134 V(OsrEntry) \
133 V(OuterContext) \ 135 V(OuterContext) \
134 V(Parameter) \ 136 V(Parameter) \
137 V(PixelArrayLength) \
135 V(Power) \ 138 V(Power) \
136 V(PushArgument) \ 139 V(PushArgument) \
137 V(RegExpLiteral) \ 140 V(RegExpLiteral) \
138 V(Return) \ 141 V(Return) \
139 V(Sar) \ 142 V(Sar) \
140 V(Shl) \ 143 V(Shl) \
141 V(Shr) \ 144 V(Shr) \
142 V(Simulate) \ 145 V(Simulate) \
143 V(StackCheck) \ 146 V(StackCheck) \
144 V(StoreContextSlot) \ 147 V(StoreContextSlot) \
(...skipping 11 matching lines...) Expand all
156 V(TypeofIs) \ 159 V(TypeofIs) \
157 V(UnaryMathOperation) \ 160 V(UnaryMathOperation) \
158 V(UnknownOSRValue) \ 161 V(UnknownOSRValue) \
159 V(ValueOf) 162 V(ValueOf)
160 163
161 #define GVN_FLAG_LIST(V) \ 164 #define GVN_FLAG_LIST(V) \
162 V(Calls) \ 165 V(Calls) \
163 V(InobjectFields) \ 166 V(InobjectFields) \
164 V(BackingStoreFields) \ 167 V(BackingStoreFields) \
165 V(ArrayElements) \ 168 V(ArrayElements) \
169 V(PixelArrayElements) \
166 V(GlobalVars) \ 170 V(GlobalVars) \
167 V(Maps) \ 171 V(Maps) \
168 V(ArrayLengths) \ 172 V(ArrayLengths) \
169 V(ContextSlots) \ 173 V(ContextSlots) \
170 V(OsrEntries) 174 V(OsrEntries)
171 175
172 #define DECLARE_INSTRUCTION(type) \ 176 #define DECLARE_INSTRUCTION(type) \
173 virtual bool Is##type() const { return true; } \ 177 virtual bool Is##type() const { return true; } \
174 static H##type* cast(HValue* value) { \ 178 static H##type* cast(HValue* value) { \
175 ASSERT(value->Is##type()); \ 179 ASSERT(value->Is##type()); \
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 }; 285 };
282 286
283 287
284 class Representation { 288 class Representation {
285 public: 289 public:
286 enum Kind { 290 enum Kind {
287 kNone, 291 kNone,
288 kTagged, 292 kTagged,
289 kDouble, 293 kDouble,
290 kInteger32, 294 kInteger32,
295 kExternal,
291 kNumRepresentations 296 kNumRepresentations
292 }; 297 };
293 298
294 Representation() : kind_(kNone) { } 299 Representation() : kind_(kNone) { }
295 300
296 static Representation None() { return Representation(kNone); } 301 static Representation None() { return Representation(kNone); }
297 static Representation Tagged() { return Representation(kTagged); } 302 static Representation Tagged() { return Representation(kTagged); }
298 static Representation Integer32() { return Representation(kInteger32); } 303 static Representation Integer32() { return Representation(kInteger32); }
299 static Representation Double() { return Representation(kDouble); } 304 static Representation Double() { return Representation(kDouble); }
305 static Representation External() { return Representation(kExternal); }
300 306
301 bool Equals(const Representation& other) const { 307 bool Equals(const Representation& other) const {
302 return kind_ == other.kind_; 308 return kind_ == other.kind_;
303 } 309 }
304 310
305 Kind kind() const { return kind_; } 311 Kind kind() const { return kind_; }
306 bool IsNone() const { return kind_ == kNone; } 312 bool IsNone() const { return kind_ == kNone; }
307 bool IsTagged() const { return kind_ == kTagged; } 313 bool IsTagged() const { return kind_ == kTagged; }
308 bool IsInteger32() const { return kind_ == kInteger32; } 314 bool IsInteger32() const { return kind_ == kInteger32; }
309 bool IsDouble() const { return kind_ == kDouble; } 315 bool IsDouble() const { return kind_ == kDouble; }
316 bool IsExternal() const { return kind_ == kExternal; }
310 bool IsSpecialization() const { 317 bool IsSpecialization() const {
311 return kind_ == kInteger32 || kind_ == kDouble; 318 return kind_ == kInteger32 || kind_ == kDouble;
312 } 319 }
313 const char* Mnemonic() const; 320 const char* Mnemonic() const;
314 321
315 private: 322 private:
316 explicit Representation(Kind k) : kind_(k) { } 323 explicit Representation(Kind k) : kind_(k) { }
317 324
318 Kind kind_; 325 Kind kind_;
319 }; 326 };
(...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 return Representation::Tagged(); 1333 return Representation::Tagged();
1327 } 1334 }
1328 1335
1329 DECLARE_CONCRETE_INSTRUCTION(FixedArrayLength, "fixed_array_length") 1336 DECLARE_CONCRETE_INSTRUCTION(FixedArrayLength, "fixed_array_length")
1330 1337
1331 protected: 1338 protected:
1332 virtual bool DataEquals(HValue* other) const { return true; } 1339 virtual bool DataEquals(HValue* other) const { return true; }
1333 }; 1340 };
1334 1341
1335 1342
1343 class HPixelArrayLength: public HUnaryOperation {
1344 public:
1345 explicit HPixelArrayLength(HValue* value) : HUnaryOperation(value) {
1346 set_representation(Representation::Integer32());
1347 SetFlag(kUseGVN);
Mads Ager (chromium) 2011/02/08 17:26:31 I get a little worried when I see kUseGVN without
1348 }
1349
1350 virtual Representation RequiredInputRepresentation(int index) const {
1351 return Representation::Tagged();
1352 }
1353
1354 DECLARE_CONCRETE_INSTRUCTION(PixelArrayLength, "pixel_array_length")
1355
1356 protected:
1357 virtual bool DataEquals(HValue* other) const { return true; }
1358 };
1359
1360
1336 class HBitNot: public HUnaryOperation { 1361 class HBitNot: public HUnaryOperation {
1337 public: 1362 public:
1338 explicit HBitNot(HValue* value) : HUnaryOperation(value) { 1363 explicit HBitNot(HValue* value) : HUnaryOperation(value) {
1339 set_representation(Representation::Integer32()); 1364 set_representation(Representation::Integer32());
1340 SetFlag(kUseGVN); 1365 SetFlag(kUseGVN);
1341 SetFlag(kTruncatingToInt32); 1366 SetFlag(kTruncatingToInt32);
1342 } 1367 }
1343 1368
1344 virtual Representation RequiredInputRepresentation(int index) const { 1369 virtual Representation RequiredInputRepresentation(int index) const {
1345 return Representation::Integer32(); 1370 return Representation::Integer32();
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 return Representation::Tagged(); 1469 return Representation::Tagged();
1445 } 1470 }
1446 1471
1447 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements") 1472 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements")
1448 1473
1449 protected: 1474 protected:
1450 virtual bool DataEquals(HValue* other) const { return true; } 1475 virtual bool DataEquals(HValue* other) const { return true; }
1451 }; 1476 };
1452 1477
1453 1478
1479 class HLoadPixelArrayExternalPointer: public HUnaryOperation {
1480 public:
1481 explicit HLoadPixelArrayExternalPointer(HValue* value)
1482 : HUnaryOperation(value) {
1483 set_representation(Representation::External());
1484 SetFlag(kUseGVN);
Mads Ager (chromium) 2011/02/08 17:26:31 Same comment here. I see why we don't need a kDepe
1485 }
1486
1487 virtual Representation RequiredInputRepresentation(int index) const {
1488 return Representation::Tagged();
1489 }
1490
1491 DECLARE_CONCRETE_INSTRUCTION(LoadPixelArrayExternalPointer,
1492 "load-pixel-array-external-pointer")
1493
1494 protected:
1495 virtual bool DataEquals(HValue* other) const { return true; }
1496 };
1497
1498
1454 class HCheckMap: public HUnaryOperation { 1499 class HCheckMap: public HUnaryOperation {
1455 public: 1500 public:
1456 HCheckMap(HValue* value, Handle<Map> map) 1501 HCheckMap(HValue* value, Handle<Map> map)
1457 : HUnaryOperation(value), map_(map) { 1502 : HUnaryOperation(value), map_(map) {
1458 set_representation(Representation::Tagged()); 1503 set_representation(Representation::Tagged());
1459 SetFlag(kUseGVN); 1504 SetFlag(kUseGVN);
1460 SetFlag(kDependsOnMaps); 1505 SetFlag(kDependsOnMaps);
1461 } 1506 }
1462 1507
1463 virtual bool IsCheckInstruction() const { return true; } 1508 virtual bool IsCheckInstruction() const { return true; }
(...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after
2822 } 2867 }
2823 2868
2824 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement, 2869 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement,
2825 "load_keyed_fast_element") 2870 "load_keyed_fast_element")
2826 2871
2827 protected: 2872 protected:
2828 virtual bool DataEquals(HValue* other) const { return true; } 2873 virtual bool DataEquals(HValue* other) const { return true; }
2829 }; 2874 };
2830 2875
2831 2876
2877 class HLoadPixelArrayElement: public HBinaryOperation {
2878 public:
2879 HLoadPixelArrayElement(HValue* external_elements, HValue* key)
2880 : HBinaryOperation(external_elements, key) {
2881 set_representation(Representation::Integer32());
2882 SetFlag(kDependsOnPixelArrayElements);
2883 // Native code could change the pixel array.
2884 SetFlag(kDependsOnCalls);
2885 SetFlag(kUseGVN);
2886 }
2887
2888 virtual void PrintDataTo(StringStream* stream) const;
2889
2890 virtual Representation RequiredInputRepresentation(int index) const {
2891 // The key is supposed to be Integer32, but the base pointer
2892 // for the element load is a naked pointer.
2893 return (index == 1) ? Representation::Integer32()
2894 : Representation::External();
2895 }
2896
2897 HValue* external_pointer() const { return OperandAt(0); }
2898 HValue* key() const { return OperandAt(1); }
2899
2900 DECLARE_CONCRETE_INSTRUCTION(LoadPixelArrayElement,
2901 "load_pixel_array_element")
2902
2903 protected:
2904 virtual bool DataEquals(HValue* other) const { return true; }
2905 };
2906
2907
2832 class HLoadKeyedGeneric: public HLoadKeyed { 2908 class HLoadKeyedGeneric: public HLoadKeyed {
2833 public: 2909 public:
2834 HLoadKeyedGeneric(HValue* obj, HValue* key) : HLoadKeyed(obj, key) { 2910 HLoadKeyedGeneric(HValue* obj, HValue* key) : HLoadKeyed(obj, key) {
2835 SetAllSideEffects(); 2911 SetAllSideEffects();
2836 } 2912 }
2837 2913
2838 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load_keyed_generic") 2914 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric, "load_keyed_generic")
2839 }; 2915 };
2840 2916
2841 2917
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
3177 HValue* object() const { return left(); } 3253 HValue* object() const { return left(); }
3178 HValue* key() const { return right(); } 3254 HValue* key() const { return right(); }
3179 }; 3255 };
3180 3256
3181 #undef DECLARE_INSTRUCTION 3257 #undef DECLARE_INSTRUCTION
3182 #undef DECLARE_CONCRETE_INSTRUCTION 3258 #undef DECLARE_CONCRETE_INSTRUCTION
3183 3259
3184 } } // namespace v8::internal 3260 } } // namespace v8::internal
3185 3261
3186 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 3262 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« src/hydrogen.cc ('K') | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698