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

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

Issue 6813091: Fit Representation and HType in one word to make HValue smaller. (Closed)
Patch Set: Created 9 years, 8 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
« no previous file with comments | « no previous file | 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 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 static Representation None() { return Representation(kNone); } 267 static Representation None() { return Representation(kNone); }
268 static Representation Tagged() { return Representation(kTagged); } 268 static Representation Tagged() { return Representation(kTagged); }
269 static Representation Integer32() { return Representation(kInteger32); } 269 static Representation Integer32() { return Representation(kInteger32); }
270 static Representation Double() { return Representation(kDouble); } 270 static Representation Double() { return Representation(kDouble); }
271 static Representation External() { return Representation(kExternal); } 271 static Representation External() { return Representation(kExternal); }
272 272
273 bool Equals(const Representation& other) { 273 bool Equals(const Representation& other) {
274 return kind_ == other.kind_; 274 return kind_ == other.kind_;
275 } 275 }
276 276
277 Kind kind() const { return kind_; } 277 Kind kind() const { return static_cast<Kind>(kind_); }
278 bool IsNone() const { return kind_ == kNone; } 278 bool IsNone() const { return kind_ == kNone; }
279 bool IsTagged() const { return kind_ == kTagged; } 279 bool IsTagged() const { return kind_ == kTagged; }
280 bool IsInteger32() const { return kind_ == kInteger32; } 280 bool IsInteger32() const { return kind_ == kInteger32; }
281 bool IsDouble() const { return kind_ == kDouble; } 281 bool IsDouble() const { return kind_ == kDouble; }
282 bool IsExternal() const { return kind_ == kExternal; } 282 bool IsExternal() const { return kind_ == kExternal; }
283 bool IsSpecialization() const { 283 bool IsSpecialization() const {
284 return kind_ == kInteger32 || kind_ == kDouble; 284 return kind_ == kInteger32 || kind_ == kDouble;
285 } 285 }
286 const char* Mnemonic() const; 286 const char* Mnemonic() const;
287 287
288 private: 288 private:
289 explicit Representation(Kind k) : kind_(k) { } 289 explicit Representation(Kind k) : kind_(k) { }
290 290
291 Kind kind_; 291 // Make sure kind fits in int8.
292 STATIC_ASSERT(kNumRepresentations <= (1 << kBitsPerByte));
293
294 int8_t kind_;
292 }; 295 };
293 296
294 297
295 class HType { 298 class HType {
296 public: 299 public:
297 HType() : type_(kUninitialized) { } 300 HType() : type_(kUninitialized) { }
298 301
299 static HType Tagged() { return HType(kTagged); } 302 static HType Tagged() { return HType(kTagged); }
300 static HType TaggedPrimitive() { return HType(kTaggedPrimitive); } 303 static HType TaggedPrimitive() { return HType(kTaggedPrimitive); }
301 static HType TaggedNumber() { return HType(kTaggedNumber); } 304 static HType TaggedNumber() { return HType(kTaggedNumber); }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 kSmi = 0x1d, // 0000 0000 0001 1101 391 kSmi = 0x1d, // 0000 0000 0001 1101
389 kHeapNumber = 0x2d, // 0000 0000 0010 1101 392 kHeapNumber = 0x2d, // 0000 0000 0010 1101
390 kString = 0x45, // 0000 0000 0100 0101 393 kString = 0x45, // 0000 0000 0100 0101
391 kBoolean = 0x85, // 0000 0000 1000 0101 394 kBoolean = 0x85, // 0000 0000 1000 0101
392 kNonPrimitive = 0x101, // 0000 0001 0000 0001 395 kNonPrimitive = 0x101, // 0000 0001 0000 0001
393 kJSObject = 0x301, // 0000 0011 0000 0001 396 kJSObject = 0x301, // 0000 0011 0000 0001
394 kJSArray = 0x701, // 0000 0111 1000 0001 397 kJSArray = 0x701, // 0000 0111 1000 0001
395 kUninitialized = 0x1fff // 0001 1111 1111 1111 398 kUninitialized = 0x1fff // 0001 1111 1111 1111
396 }; 399 };
397 400
401 // Make sure type fits in int16.
402 STATIC_ASSERT(kUninitialized < (1 << (2 * kBitsPerByte)));
403
398 explicit HType(Type t) : type_(t) { } 404 explicit HType(Type t) : type_(t) { }
399 405
400 Type type_; 406 int16_t type_;
401 }; 407 };
402 408
403 409
404 class HValue: public ZoneObject { 410 class HValue: public ZoneObject {
405 public: 411 public:
406 static const int kNoNumber = -1; 412 static const int kNoNumber = -1;
407 413
408 // There must be one corresponding kDepends flag for every kChanges flag and 414 // There must be one corresponding kDepends flag for every kChanges flag and
409 // the order of the kChanges flags must be exactly the same as of the kDepends 415 // the order of the kChanges flags must be exactly the same as of the kDepends
410 // flags. 416 // flags.
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 void InternalReplaceAtUse(HValue* use, HValue* other); 610 void InternalReplaceAtUse(HValue* use, HValue* other);
605 void RegisterUse(int index, HValue* new_value); 611 void RegisterUse(int index, HValue* new_value);
606 612
607 HBasicBlock* block_; 613 HBasicBlock* block_;
608 614
609 // The id of this instruction in the hydrogen graph, assigned when first 615 // The id of this instruction in the hydrogen graph, assigned when first
610 // added to the graph. Reflects creation order. 616 // added to the graph. Reflects creation order.
611 int id_; 617 int id_;
612 618
613 Representation representation_; 619 Representation representation_;
620 HType type_;
614 SmallPointerList<HValue> uses_; 621 SmallPointerList<HValue> uses_;
615 HType type_;
616 Range* range_; 622 Range* range_;
617 int flags_; 623 int flags_;
618 624
619 DISALLOW_COPY_AND_ASSIGN(HValue); 625 DISALLOW_COPY_AND_ASSIGN(HValue);
620 }; 626 };
621 627
622 628
623 class HInstruction: public HValue { 629 class HInstruction: public HValue {
624 public: 630 public:
625 HInstruction* next() const { return next_; } 631 HInstruction* next() const { return next_; }
(...skipping 3038 matching lines...) Expand 10 before | Expand all | Expand 10 after
3664 HValue* object() { return left(); } 3670 HValue* object() { return left(); }
3665 HValue* key() { return right(); } 3671 HValue* key() { return right(); }
3666 }; 3672 };
3667 3673
3668 #undef DECLARE_INSTRUCTION 3674 #undef DECLARE_INSTRUCTION
3669 #undef DECLARE_CONCRETE_INSTRUCTION 3675 #undef DECLARE_CONCRETE_INSTRUCTION
3670 3676
3671 } } // namespace v8::internal 3677 } } // namespace v8::internal
3672 3678
3673 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ 3679 #endif // V8_HYDROGEN_INSTRUCTIONS_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698