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

Side by Side Diff: src/type-info.h

Issue 2802022: Type info: fix three bit representation of smi type. (Closed)
Patch Set: Created 10 years, 5 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 | test/cctest/SConscript » ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 ASSERT(type_ != kUninitializedType); 72 ASSERT(type_ != kUninitializedType);
73 int answer = type_ & 0xf; 73 int answer = type_ & 0xf;
74 answer = answer > 6 ? answer - 2 : answer; 74 answer = answer > 6 ? answer - 2 : answer;
75 ASSERT(answer >= 0); 75 ASSERT(answer >= 0);
76 ASSERT(answer <= 7); 76 ASSERT(answer <= 7);
77 return answer; 77 return answer;
78 } 78 }
79 79
80 // Decode compact representation. Very sensitive to enum values below! 80 // Decode compact representation. Very sensitive to enum values below!
81 static TypeInfo ExpandedRepresentation(int three_bit_representation) { 81 static TypeInfo ExpandedRepresentation(int three_bit_representation) {
82 Type t = static_cast<Type>(three_bit_representation >= 6 ? 82 Type t = static_cast<Type>(three_bit_representation > 4 ?
83 three_bit_representation + 2 : 83 three_bit_representation + 2 :
84 three_bit_representation); 84 three_bit_representation);
85 t = (t == kUnknownType) ? t : static_cast<Type>(t | kPrimitiveType); 85 t = (t == kUnknownType) ? t : static_cast<Type>(t | kPrimitiveType);
86 ASSERT(t == kUnknownType || 86 ASSERT(t == kUnknownType ||
87 t == kNumberType || 87 t == kNumberType ||
88 t == kInteger32Type || 88 t == kInteger32Type ||
89 t == kSmiType || 89 t == kSmiType ||
90 t == kDoubleType); 90 t == kDoubleType);
91 return TypeInfo(t); 91 return TypeInfo(t);
92 } 92 }
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 } 235 }
236 236
237 237
238 TypeInfo TypeInfo::Uninitialized() { 238 TypeInfo TypeInfo::Uninitialized() {
239 return TypeInfo(kUninitializedType); 239 return TypeInfo(kUninitializedType);
240 } 240 }
241 241
242 } } // namespace v8::internal 242 } } // namespace v8::internal
243 243
244 #endif // V8_TYPE_INFO_H_ 244 #endif // V8_TYPE_INFO_H_
OLDNEW
« no previous file with comments | « no previous file | test/cctest/SConscript » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698