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

Side by Side Diff: src/types.cc

Issue 426233002: Land the Fan (disabled) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback, rebase and "git cl format" Created 6 years, 4 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/types.h ('k') | src/typing.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/types.h" 5 #include "src/types.h"
6 6
7 #include "src/string-stream.h" 7 #include "src/ostreams.h"
8 #include "src/types-inl.h" 8 #include "src/types-inl.h"
9 9
10 namespace v8 { 10 namespace v8 {
11 namespace internal { 11 namespace internal {
12 12
13 // ----------------------------------------------------------------------------- 13 // -----------------------------------------------------------------------------
14 // Glb and lub computation. 14 // Glb and lub computation.
15 15
16 // The largest bitset subsumed by this type. 16 // The largest bitset subsumed by this type.
17 template<class Config> 17 template<class Config>
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 } 116 }
117 return Lub(i::HeapObject::cast(value)->map()); 117 return Lub(i::HeapObject::cast(value)->map());
118 } 118 }
119 119
120 120
121 template<class Config> 121 template<class Config>
122 int TypeImpl<Config>::BitsetType::Lub(double value) { 122 int TypeImpl<Config>::BitsetType::Lub(double value) {
123 DisallowHeapAllocation no_allocation; 123 DisallowHeapAllocation no_allocation;
124 if (i::IsMinusZero(value)) return kMinusZero; 124 if (i::IsMinusZero(value)) return kMinusZero;
125 if (std::isnan(value)) return kNaN; 125 if (std::isnan(value)) return kNaN;
126 if (IsUint32Double(value)) return Lub(FastD2UI(value)); 126 if (IsUint32Double(value)) {
127 if (IsInt32Double(value)) return Lub(FastD2I(value)); 127 uint32_t u = FastD2UI(value);
128 if (u < 0x40000000u) return kUnsignedSmall;
129 if (u < 0x80000000u) {
130 return i::SmiValuesAre31Bits() ? kOtherUnsigned31 : kUnsignedSmall;
131 }
132 return kOtherUnsigned32;
133 }
134 if (IsInt32Double(value)) {
135 int32_t i = FastD2I(value);
136 ASSERT(i < 0);
137 if (i >= -0x40000000) return kOtherSignedSmall;
138 return i::SmiValuesAre31Bits() ? kOtherSigned32 : kOtherSignedSmall;
139 }
128 return kOtherNumber; 140 return kOtherNumber;
129 } 141 }
130 142
131 143
132 template<class Config>
133 int TypeImpl<Config>::BitsetType::Lub(int32_t value) {
134 if (value >= 0x40000000) {
135 return i::SmiValuesAre31Bits() ? kOtherUnsigned31 : kUnsignedSmall;
136 }
137 if (value >= 0) return kUnsignedSmall;
138 if (value >= -0x40000000) return kOtherSignedSmall;
139 return i::SmiValuesAre31Bits() ? kOtherSigned32 : kOtherSignedSmall;
140 }
141
142
143 template<class Config>
144 int TypeImpl<Config>::BitsetType::Lub(uint32_t value) {
145 DisallowHeapAllocation no_allocation;
146 if (value >= 0x80000000u) return kOtherUnsigned32;
147 if (value >= 0x40000000u) {
148 return i::SmiValuesAre31Bits() ? kOtherUnsigned31 : kUnsignedSmall;
149 }
150 return kUnsignedSmall;
151 }
152
153
154 template<class Config> 144 template<class Config>
155 int TypeImpl<Config>::BitsetType::Lub(i::Map* map) { 145 int TypeImpl<Config>::BitsetType::Lub(i::Map* map) {
156 DisallowHeapAllocation no_allocation; 146 DisallowHeapAllocation no_allocation;
157 switch (map->instance_type()) { 147 switch (map->instance_type()) {
158 case STRING_TYPE: 148 case STRING_TYPE:
159 case ASCII_STRING_TYPE: 149 case ASCII_STRING_TYPE:
160 case CONS_STRING_TYPE: 150 case CONS_STRING_TYPE:
161 case CONS_ASCII_STRING_TYPE: 151 case CONS_ASCII_STRING_TYPE:
162 case SLICED_STRING_TYPE: 152 case SLICED_STRING_TYPE:
163 case SLICED_ASCII_STRING_TYPE: 153 case SLICED_ASCII_STRING_TYPE:
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 // Also, it doesn't apply elsewhere. 8-( 221 // Also, it doesn't apply elsewhere. 8-(
232 // We ought to find a cleaner solution for compiling stubs parameterised 222 // We ought to find a cleaner solution for compiling stubs parameterised
233 // over type or class variables, esp ones with bounds... 223 // over type or class variables, esp ones with bounds...
234 return kDetectable; 224 return kDetectable;
235 case DECLARED_ACCESSOR_INFO_TYPE: 225 case DECLARED_ACCESSOR_INFO_TYPE:
236 case EXECUTABLE_ACCESSOR_INFO_TYPE: 226 case EXECUTABLE_ACCESSOR_INFO_TYPE:
237 case SHARED_FUNCTION_INFO_TYPE: 227 case SHARED_FUNCTION_INFO_TYPE:
238 case ACCESSOR_PAIR_TYPE: 228 case ACCESSOR_PAIR_TYPE:
239 case FIXED_ARRAY_TYPE: 229 case FIXED_ARRAY_TYPE:
240 case FOREIGN_TYPE: 230 case FOREIGN_TYPE:
231 case CODE_TYPE:
241 return kInternal & kTaggedPtr; 232 return kInternal & kTaggedPtr;
242 default: 233 default:
243 UNREACHABLE(); 234 UNREACHABLE();
244 return kNone; 235 return kNone;
245 } 236 }
246 } 237 }
247 238
248 239
249 // ----------------------------------------------------------------------------- 240 // -----------------------------------------------------------------------------
250 // Predicates. 241 // Predicates.
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 template class TypeImpl<HeapTypeConfig>::Iterator<i::Object>; 952 template class TypeImpl<HeapTypeConfig>::Iterator<i::Object>;
962 953
963 template TypeImpl<ZoneTypeConfig>::TypeHandle 954 template TypeImpl<ZoneTypeConfig>::TypeHandle
964 TypeImpl<ZoneTypeConfig>::Convert<HeapType>( 955 TypeImpl<ZoneTypeConfig>::Convert<HeapType>(
965 TypeImpl<HeapTypeConfig>::TypeHandle, TypeImpl<ZoneTypeConfig>::Region*); 956 TypeImpl<HeapTypeConfig>::TypeHandle, TypeImpl<ZoneTypeConfig>::Region*);
966 template TypeImpl<HeapTypeConfig>::TypeHandle 957 template TypeImpl<HeapTypeConfig>::TypeHandle
967 TypeImpl<HeapTypeConfig>::Convert<Type>( 958 TypeImpl<HeapTypeConfig>::Convert<Type>(
968 TypeImpl<ZoneTypeConfig>::TypeHandle, TypeImpl<HeapTypeConfig>::Region*); 959 TypeImpl<ZoneTypeConfig>::TypeHandle, TypeImpl<HeapTypeConfig>::Region*);
969 960
970 } } // namespace v8::internal 961 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/types.h ('k') | src/typing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698