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

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

Issue 14629005: Adding fast path for generalizing maps. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 7 years, 7 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/objects.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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 static Representation None() { return Representation(kNone); } 93 static Representation None() { return Representation(kNone); }
94 static Representation Tagged() { return Representation(kTagged); } 94 static Representation Tagged() { return Representation(kTagged); }
95 static Representation Smi() { return Representation(kSmi); } 95 static Representation Smi() { return Representation(kSmi); }
96 static Representation Integer32() { return Representation(kInteger32); } 96 static Representation Integer32() { return Representation(kInteger32); }
97 static Representation Double() { return Representation(kDouble); } 97 static Representation Double() { return Representation(kDouble); }
98 static Representation External() { return Representation(kExternal); } 98 static Representation External() { return Representation(kExternal); }
99 99
100 static Representation FromKind(Kind kind) { return Representation(kind); } 100 static Representation FromKind(Kind kind) { return Representation(kind); }
101 101
102 bool Equals(const Representation& other) { 102 bool Equals(const Representation& other) const {
103 return kind_ == other.kind_; 103 return kind_ == other.kind_;
104 } 104 }
105 105
106 bool is_more_general_than(const Representation& other) { 106 bool is_more_general_than(const Representation& other) const {
107 ASSERT(kind_ != kExternal); 107 ASSERT(kind_ != kExternal);
108 ASSERT(other.kind_ != kExternal); 108 ASSERT(other.kind_ != kExternal);
109 return kind_ > other.kind_; 109 return kind_ > other.kind_;
110 } 110 }
111 111
112 bool fits_into(const Representation& other) const {
113 return other.is_more_general_than(*this) || other.Equals(*this);
114 }
115
112 Representation generalize(Representation other) { 116 Representation generalize(Representation other) {
113 if (is_more_general_than(other)) { 117 if (is_more_general_than(other)) {
114 return *this; 118 return *this;
115 } else { 119 } else {
116 return other; 120 return other;
117 } 121 }
118 } 122 }
119 123
120 Kind kind() const { return static_cast<Kind>(kind_); } 124 Kind kind() const { return static_cast<Kind>(kind_); }
121 bool IsNone() const { return kind_ == kNone; } 125 bool IsNone() const { return kind_ == kNone; }
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 value_ = RepresentationField::update( 241 value_ = RepresentationField::update(
238 value, EncodeRepresentation(representation)); 242 value, EncodeRepresentation(representation));
239 } 243 }
240 244
241 uint32_t value_; 245 uint32_t value_;
242 }; 246 };
243 247
244 } } // namespace v8::internal 248 } } // namespace v8::internal
245 249
246 #endif // V8_PROPERTY_DETAILS_H_ 250 #endif // V8_PROPERTY_DETAILS_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698