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

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: merge with latest 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
« no previous file with comments | « src/hydrogen.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 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 V(ClassOfTest) \ 120 V(ClassOfTest) \
121 V(LeaveInlined) \ 121 V(LeaveInlined) \
122 V(LoadContextSlot) \ 122 V(LoadContextSlot) \
123 V(LoadElements) \ 123 V(LoadElements) \
124 V(LoadFunctionPrototype) \ 124 V(LoadFunctionPrototype) \
125 V(LoadGlobal) \ 125 V(LoadGlobal) \
126 V(LoadKeyedFastElement) \ 126 V(LoadKeyedFastElement) \
127 V(LoadKeyedGeneric) \ 127 V(LoadKeyedGeneric) \
128 V(LoadNamedField) \ 128 V(LoadNamedField) \
129 V(LoadNamedGeneric) \ 129 V(LoadNamedGeneric) \
130 V(LoadPixelArrayElement) \
131 V(LoadPixelArrayExternalPointer) \
130 V(Mod) \ 132 V(Mod) \
131 V(Mul) \ 133 V(Mul) \
132 V(ObjectLiteral) \ 134 V(ObjectLiteral) \
133 V(OsrEntry) \ 135 V(OsrEntry) \
134 V(OuterContext) \ 136 V(OuterContext) \
135 V(Parameter) \ 137 V(Parameter) \
138 V(PixelArrayLength) \
136 V(Power) \ 139 V(Power) \
137 V(PushArgument) \ 140 V(PushArgument) \
138 V(RegExpLiteral) \ 141 V(RegExpLiteral) \
139 V(Return) \ 142 V(Return) \
140 V(Sar) \ 143 V(Sar) \
141 V(Shl) \ 144 V(Shl) \
142 V(Shr) \ 145 V(Shr) \
143 V(Simulate) \ 146 V(Simulate) \
144 V(StackCheck) \ 147 V(StackCheck) \
145 V(StoreContextSlot) \ 148 V(StoreContextSlot) \
(...skipping 11 matching lines...) Expand all
157 V(TypeofIs) \ 160 V(TypeofIs) \
158 V(UnaryMathOperation) \ 161 V(UnaryMathOperation) \
159 V(UnknownOSRValue) \ 162 V(UnknownOSRValue) \
160 V(ValueOf) 163 V(ValueOf)
161 164
162 #define GVN_FLAG_LIST(V) \ 165 #define GVN_FLAG_LIST(V) \
163 V(Calls) \ 166 V(Calls) \
164 V(InobjectFields) \ 167 V(InobjectFields) \
165 V(BackingStoreFields) \ 168 V(BackingStoreFields) \
166 V(ArrayElements) \ 169 V(ArrayElements) \
170 V(PixelArrayElements) \
167 V(GlobalVars) \ 171 V(GlobalVars) \
168 V(Maps) \ 172 V(Maps) \
169 V(ArrayLengths) \ 173 V(ArrayLengths) \
170 V(ContextSlots) \ 174 V(ContextSlots) \
171 V(OsrEntries) 175 V(OsrEntries)
172 176
173 #define DECLARE_INSTRUCTION(type) \ 177 #define DECLARE_INSTRUCTION(type) \
174 virtual bool Is##type() const { return true; } \ 178 virtual bool Is##type() const { return true; } \
175 static H##type* cast(HValue* value) { \ 179 static H##type* cast(HValue* value) { \
176 ASSERT(value->Is##type()); \ 180 ASSERT(value->Is##type()); \
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 }; 286 };
283 287
284 288
285 class Representation { 289 class Representation {
286 public: 290 public:
287 enum Kind { 291 enum Kind {
288 kNone, 292 kNone,
289 kTagged, 293 kTagged,
290 kDouble, 294 kDouble,
291 kInteger32, 295 kInteger32,
296 kExternal,
292 kNumRepresentations 297 kNumRepresentations
293 }; 298 };
294 299
295 Representation() : kind_(kNone) { } 300 Representation() : kind_(kNone) { }
296 301
297 static Representation None() { return Representation(kNone); } 302 static Representation None() { return Representation(kNone); }
298 static Representation Tagged() { return Representation(kTagged); } 303 static Representation Tagged() { return Representation(kTagged); }
299 static Representation Integer32() { return Representation(kInteger32); } 304 static Representation Integer32() { return Representation(kInteger32); }
300 static Representation Double() { return Representation(kDouble); } 305 static Representation Double() { return Representation(kDouble); }
306 static Representation External() { return Representation(kExternal); }
301 307
302 bool Equals(const Representation& other) const { 308 bool Equals(const Representation& other) const {
303 return kind_ == other.kind_; 309 return kind_ == other.kind_;
304 } 310 }
305 311
306 Kind kind() const { return kind_; } 312 Kind kind() const { return kind_; }
307 bool IsNone() const { return kind_ == kNone; } 313 bool IsNone() const { return kind_ == kNone; }
308 bool IsTagged() const { return kind_ == kTagged; } 314 bool IsTagged() const { return kind_ == kTagged; }
309 bool IsInteger32() const { return kind_ == kInteger32; } 315 bool IsInteger32() const { return kind_ == kInteger32; }
310 bool IsDouble() const { return kind_ == kDouble; } 316 bool IsDouble() const { return kind_ == kDouble; }
317 bool IsExternal() const { return kind_ == kExternal; }
311 bool IsSpecialization() const { 318 bool IsSpecialization() const {
312 return kind_ == kInteger32 || kind_ == kDouble; 319 return kind_ == kInteger32 || kind_ == kDouble;
313 } 320 }
314 const char* Mnemonic() const; 321 const char* Mnemonic() const;
315 322
316 private: 323 private:
317 explicit Representation(Kind k) : kind_(k) { } 324 explicit Representation(Kind k) : kind_(k) { }
318 325
319 Kind kind_; 326 Kind kind_;
320 }; 327 };
(...skipping 1090 matching lines...) Expand 10 before | Expand all | Expand 10 after
1411 return Representation::Tagged(); 1418 return Representation::Tagged();
1412 } 1419 }
1413 1420
1414 DECLARE_CONCRETE_INSTRUCTION(FixedArrayLength, "fixed_array_length") 1421 DECLARE_CONCRETE_INSTRUCTION(FixedArrayLength, "fixed_array_length")
1415 1422
1416 protected: 1423 protected:
1417 virtual bool DataEquals(HValue* other) const { return true; } 1424 virtual bool DataEquals(HValue* other) const { return true; }
1418 }; 1425 };
1419 1426
1420 1427
1428 class HPixelArrayLength: public HUnaryOperation {
1429 public:
1430 explicit HPixelArrayLength(HValue* value) : HUnaryOperation(value) {
1431 set_representation(Representation::Integer32());
1432 // The result of this instruction is idempotent as long as its inputs don't
1433 // change. The length of a pixel array cannot change once set, so it's not
1434 // necessary to introduce a kDependsOnArrayLengths or any other dependency.
1435 SetFlag(kUseGVN);
1436 }
1437
1438 virtual Representation RequiredInputRepresentation(int index) const {
1439 return Representation::Tagged();
1440 }
1441
1442 DECLARE_CONCRETE_INSTRUCTION(PixelArrayLength, "pixel_array_length")
1443
1444 protected:
1445 virtual bool DataEquals(HValue* other) const { return true; }
1446 };
1447
1448
1421 class HBitNot: public HUnaryOperation { 1449 class HBitNot: public HUnaryOperation {
1422 public: 1450 public:
1423 explicit HBitNot(HValue* value) : HUnaryOperation(value) { 1451 explicit HBitNot(HValue* value) : HUnaryOperation(value) {
1424 set_representation(Representation::Integer32()); 1452 set_representation(Representation::Integer32());
1425 SetFlag(kUseGVN); 1453 SetFlag(kUseGVN);
1426 SetFlag(kTruncatingToInt32); 1454 SetFlag(kTruncatingToInt32);
1427 } 1455 }
1428 1456
1429 virtual Representation RequiredInputRepresentation(int index) const { 1457 virtual Representation RequiredInputRepresentation(int index) const {
1430 return Representation::Integer32(); 1458 return Representation::Integer32();
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1529 return Representation::Tagged(); 1557 return Representation::Tagged();
1530 } 1558 }
1531 1559
1532 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements") 1560 DECLARE_CONCRETE_INSTRUCTION(LoadElements, "load-elements")
1533 1561
1534 protected: 1562 protected:
1535 virtual bool DataEquals(HValue* other) const { return true; } 1563 virtual bool DataEquals(HValue* other) const { return true; }
1536 }; 1564 };
1537 1565
1538 1566
1567 class HLoadPixelArrayExternalPointer: public HUnaryOperation {
1568 public:
1569 explicit HLoadPixelArrayExternalPointer(HValue* value)
1570 : HUnaryOperation(value) {
1571 set_representation(Representation::External());
1572 // The result of this instruction is idempotent as long as its inputs don't
1573 // change. The external array of a pixel array elements object cannot
1574 // change once set, so it's no necessary to introduce any additional
1575 // dependencies on top of the inputs.
1576 SetFlag(kUseGVN);
1577 }
1578
1579 virtual Representation RequiredInputRepresentation(int index) const {
1580 return Representation::Tagged();
1581 }
1582
1583 DECLARE_CONCRETE_INSTRUCTION(LoadPixelArrayExternalPointer,
1584 "load-pixel-array-external-pointer")
1585
1586 protected:
1587 virtual bool DataEquals(HValue* other) const { return true; }
1588 };
1589
1590
1539 class HCheckMap: public HUnaryOperation { 1591 class HCheckMap: public HUnaryOperation {
1540 public: 1592 public:
1541 HCheckMap(HValue* value, Handle<Map> map) 1593 HCheckMap(HValue* value, Handle<Map> map)
1542 : HUnaryOperation(value), map_(map) { 1594 : HUnaryOperation(value), map_(map) {
1543 set_representation(Representation::Tagged()); 1595 set_representation(Representation::Tagged());
1544 SetFlag(kUseGVN); 1596 SetFlag(kUseGVN);
1545 SetFlag(kDependsOnMaps); 1597 SetFlag(kDependsOnMaps);
1546 } 1598 }
1547 1599
1548 virtual bool IsCheckInstruction() const { return true; } 1600 virtual bool IsCheckInstruction() const { return true; }
(...skipping 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after
2945 } 2997 }
2946 2998
2947 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement, 2999 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement,
2948 "load_keyed_fast_element") 3000 "load_keyed_fast_element")
2949 3001
2950 protected: 3002 protected:
2951 virtual bool DataEquals(HValue* other) const { return true; } 3003 virtual bool DataEquals(HValue* other) const { return true; }
2952 }; 3004 };
2953 3005
2954 3006
3007 class HLoadPixelArrayElement: public HBinaryOperation {
3008 public:
3009 HLoadPixelArrayElement(HValue* external_elements, HValue* key)
3010 : HBinaryOperation(external_elements, key) {
3011 set_representation(Representation::Integer32());
3012 SetFlag(kDependsOnPixelArrayElements);
3013 // Native code could change the pixel array.
3014 SetFlag(kDependsOnCalls);
3015 SetFlag(kUseGVN);
3016 }
3017
3018 virtual void PrintDataTo(StringStream* stream) const;
3019
3020 virtual Representation RequiredInputRepresentation(int index) const {
3021 // The key is supposed to be Integer32, but the base pointer
3022 // for the element load is a naked pointer.
3023 return (index == 1) ? Representation::Integer32()
3024 : Representation::External();
3025 }
3026
3027 HValue* external_pointer() const { return OperandAt(0); }
3028 HValue* key() const { return OperandAt(1); }
3029
3030 DECLARE_CONCRETE_INSTRUCTION(LoadPixelArrayElement,
3031 "load_pixel_array_element")
3032
3033 protected:
3034 virtual bool DataEquals(HValue* other) const { return true; }
3035 };
3036
3037
2955 class HLoadKeyedGeneric: public HLoadKeyed { 3038 class HLoadKeyedGeneric: public HLoadKeyed {
2956 public: 3039 public:
2957 HLoadKeyedGeneric(HContext* context, HValue* obj, HValue* key) 3040 HLoadKeyedGeneric(HContext* context, HValue* obj, HValue* key)
2958 : HLoadKeyed(obj, key), context_(NULL) { 3041 : HLoadKeyed(obj, key), context_(NULL) {
2959 SetOperandAt(2, context); 3042 SetOperandAt(2, context);
2960 SetAllSideEffects(); 3043 SetAllSideEffects();
2961 } 3044 }
2962 3045
2963 HValue* context() const { return context_; } 3046 HValue* context() const { return context_; }
2964 HValue* object() const { return operands_[0]; } 3047 HValue* object() const { return operands_[0]; }
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
3371 HValue* object() const { return left(); } 3454 HValue* object() const { return left(); }
3372 HValue* key() const { return right(); } 3455 HValue* key() const { return right(); }
3373 }; 3456 };
3374 3457
3375 #undef DECLARE_INSTRUCTION 3458 #undef DECLARE_INSTRUCTION
3376 #undef DECLARE_CONCRETE_INSTRUCTION 3459 #undef DECLARE_CONCRETE_INSTRUCTION
3377 3460
3378 } } // namespace v8::internal 3461 } } // namespace v8::internal
3379 3462
3380 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 3463 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698