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

Side by Side Diff: src/types.cc

Issue 795993002: Introduce unsigned representation types (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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 | « 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 <iomanip> 5 #include <iomanip>
6 6
7 #include "src/types.h" 7 #include "src/types.h"
8 8
9 #include "src/ostreams.h" 9 #include "src/ostreams.h"
10 #include "src/types-inl.h" 10 #include "src/types-inl.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 146 }
147 return bitset; 147 return bitset;
148 } 148 }
149 if (type->IsClass()) { 149 if (type->IsClass()) {
150 // Little hack to avoid the need for a region for handlification here... 150 // Little hack to avoid the need for a region for handlification here...
151 return Config::is_class(type) ? Lub(*Config::as_class(type)) : 151 return Config::is_class(type) ? Lub(*Config::as_class(type)) :
152 type->AsClass()->Bound(NULL)->AsBitset(); 152 type->AsClass()->Bound(NULL)->AsBitset();
153 } 153 }
154 if (type->IsConstant()) return type->AsConstant()->Bound()->AsBitset(); 154 if (type->IsConstant()) return type->AsConstant()->Bound()->AsBitset();
155 if (type->IsRange()) return type->AsRange()->BitsetLub(); 155 if (type->IsRange()) return type->AsRange()->BitsetLub();
156 if (type->IsContext()) return kInternal & kTaggedPtr; 156 if (type->IsContext()) return kInternal & kTaggedPointer;
157 if (type->IsArray()) return kArray; 157 if (type->IsArray()) return kArray;
158 if (type->IsFunction()) return kFunction; 158 if (type->IsFunction()) return kOtherObject; // TODO(rossberg): kFunction
159 UNREACHABLE(); 159 UNREACHABLE();
160 return kNone; 160 return kNone;
161 } 161 }
162 162
163 163
164 template<class Config> 164 template<class Config>
165 typename TypeImpl<Config>::bitset 165 typename TypeImpl<Config>::bitset
166 TypeImpl<Config>::BitsetType::Lub(i::Map* map) { 166 TypeImpl<Config>::BitsetType::Lub(i::Map* map) {
167 DisallowHeapAllocation no_allocation; 167 DisallowHeapAllocation no_allocation;
168 switch (map->instance_type()) { 168 switch (map->instance_type()) {
(...skipping 24 matching lines...) Expand all
193 case ODDBALL_TYPE: { 193 case ODDBALL_TYPE: {
194 Heap* heap = map->GetHeap(); 194 Heap* heap = map->GetHeap();
195 if (map == heap->undefined_map()) return kUndefined; 195 if (map == heap->undefined_map()) return kUndefined;
196 if (map == heap->null_map()) return kNull; 196 if (map == heap->null_map()) return kNull;
197 if (map == heap->boolean_map()) return kBoolean; 197 if (map == heap->boolean_map()) return kBoolean;
198 DCHECK(map == heap->the_hole_map() || 198 DCHECK(map == heap->the_hole_map() ||
199 map == heap->uninitialized_map() || 199 map == heap->uninitialized_map() ||
200 map == heap->no_interceptor_result_sentinel_map() || 200 map == heap->no_interceptor_result_sentinel_map() ||
201 map == heap->termination_exception_map() || 201 map == heap->termination_exception_map() ||
202 map == heap->arguments_marker_map()); 202 map == heap->arguments_marker_map());
203 return kInternal & kTaggedPtr; 203 return kInternal & kTaggedPointer;
204 } 204 }
205 case HEAP_NUMBER_TYPE: 205 case HEAP_NUMBER_TYPE:
206 return kNumber & kTaggedPtr; 206 return kNumber & kTaggedPointer;
207 case JS_VALUE_TYPE: 207 case JS_VALUE_TYPE:
208 case JS_DATE_TYPE: 208 case JS_DATE_TYPE:
209 case JS_OBJECT_TYPE: 209 case JS_OBJECT_TYPE:
210 case JS_CONTEXT_EXTENSION_OBJECT_TYPE: 210 case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
211 case JS_GENERATOR_OBJECT_TYPE: 211 case JS_GENERATOR_OBJECT_TYPE:
212 case JS_MODULE_TYPE: 212 case JS_MODULE_TYPE:
213 case JS_GLOBAL_OBJECT_TYPE: 213 case JS_GLOBAL_OBJECT_TYPE:
214 case JS_BUILTINS_OBJECT_TYPE: 214 case JS_BUILTINS_OBJECT_TYPE:
215 case JS_GLOBAL_PROXY_TYPE: 215 case JS_GLOBAL_PROXY_TYPE:
216 case JS_ARRAY_BUFFER_TYPE: 216 case JS_ARRAY_BUFFER_TYPE:
217 case JS_TYPED_ARRAY_TYPE: 217 case JS_TYPED_ARRAY_TYPE:
218 case JS_DATA_VIEW_TYPE: 218 case JS_DATA_VIEW_TYPE:
219 case JS_SET_TYPE: 219 case JS_SET_TYPE:
220 case JS_MAP_TYPE: 220 case JS_MAP_TYPE:
221 case JS_SET_ITERATOR_TYPE: 221 case JS_SET_ITERATOR_TYPE:
222 case JS_MAP_ITERATOR_TYPE: 222 case JS_MAP_ITERATOR_TYPE:
223 case JS_WEAK_MAP_TYPE: 223 case JS_WEAK_MAP_TYPE:
224 case JS_WEAK_SET_TYPE: 224 case JS_WEAK_SET_TYPE:
225 if (map->is_undetectable()) return kUndetectable; 225 if (map->is_undetectable()) return kUndetectable;
226 return kOtherObject; 226 return kOtherObject;
227 case JS_ARRAY_TYPE: 227 case JS_ARRAY_TYPE:
228 return kArray; 228 return kArray;
229 case JS_FUNCTION_TYPE: 229 case JS_FUNCTION_TYPE:
230 return kFunction; 230 return kOtherObject; // TODO(rossberg): there should be a Function type.
231 case JS_REGEXP_TYPE: 231 case JS_REGEXP_TYPE:
232 return kRegExp; 232 return kOtherObject; // TODO(rossberg): there should be a RegExp type.
233 case JS_PROXY_TYPE: 233 case JS_PROXY_TYPE:
234 case JS_FUNCTION_PROXY_TYPE: 234 case JS_FUNCTION_PROXY_TYPE:
235 return kProxy; 235 return kProxy;
236 case MAP_TYPE: 236 case MAP_TYPE:
237 // When compiling stub templates, the meta map is used as a place holder 237 // When compiling stub templates, the meta map is used as a place holder
238 // for the actual map with which the template is later instantiated. 238 // for the actual map with which the template is later instantiated.
239 // We treat it as a kind of type variable whose upper bound is Any. 239 // We treat it as a kind of type variable whose upper bound is Any.
240 // TODO(rossberg): for caching of CompareNilIC stubs to work correctly, 240 // TODO(rossberg): for caching of CompareNilIC stubs to work correctly,
241 // we must exclude Undetectable here. This makes no sense, really, 241 // we must exclude Undetectable here. This makes no sense, really,
242 // because it means that the template isn't actually parametric. 242 // because it means that the template isn't actually parametric.
243 // Also, it doesn't apply elsewhere. 8-( 243 // Also, it doesn't apply elsewhere. 8-(
244 // We ought to find a cleaner solution for compiling stubs parameterised 244 // We ought to find a cleaner solution for compiling stubs parameterised
245 // over type or class variables, esp ones with bounds... 245 // over type or class variables, esp ones with bounds...
246 return kDetectable; 246 return kDetectable;
247 case DECLARED_ACCESSOR_INFO_TYPE: 247 case DECLARED_ACCESSOR_INFO_TYPE:
248 case EXECUTABLE_ACCESSOR_INFO_TYPE: 248 case EXECUTABLE_ACCESSOR_INFO_TYPE:
249 case SHARED_FUNCTION_INFO_TYPE: 249 case SHARED_FUNCTION_INFO_TYPE:
250 case ACCESSOR_PAIR_TYPE: 250 case ACCESSOR_PAIR_TYPE:
251 case FIXED_ARRAY_TYPE: 251 case FIXED_ARRAY_TYPE:
252 case BYTE_ARRAY_TYPE: 252 case BYTE_ARRAY_TYPE:
253 case FOREIGN_TYPE: 253 case FOREIGN_TYPE:
254 case CODE_TYPE: 254 case CODE_TYPE:
255 return kInternal & kTaggedPtr; 255 return kInternal & kTaggedPointer;
256 default: 256 default:
257 UNREACHABLE(); 257 UNREACHABLE();
258 return kNone; 258 return kNone;
259 } 259 }
260 } 260 }
261 261
262 262
263 template<class Config> 263 template<class Config>
264 typename TypeImpl<Config>::bitset 264 typename TypeImpl<Config>::bitset
265 TypeImpl<Config>::BitsetType::Lub(i::Object* value) { 265 TypeImpl<Config>::BitsetType::Lub(i::Object* value) {
266 DisallowHeapAllocation no_allocation; 266 DisallowHeapAllocation no_allocation;
267 if (value->IsNumber()) { 267 if (value->IsNumber()) {
268 return Lub(value->Number()) & (value->IsSmi() ? kTaggedInt : kTaggedPtr); 268 return Lub(value->Number()) &
269 (value->IsSmi() ? kTaggedSigned : kTaggedPointer);
269 } 270 }
270 return Lub(i::HeapObject::cast(value)->map()); 271 return Lub(i::HeapObject::cast(value)->map());
271 } 272 }
272 273
273 274
274 template<class Config> 275 template<class Config>
275 typename TypeImpl<Config>::bitset 276 typename TypeImpl<Config>::bitset
276 TypeImpl<Config>::BitsetType::Lub(double value) { 277 TypeImpl<Config>::BitsetType::Lub(double value) {
277 DisallowHeapAllocation no_allocation; 278 DisallowHeapAllocation no_allocation;
278 if (i::IsMinusZero(value)) return kMinusZero; 279 if (i::IsMinusZero(value)) return kMinusZero;
(...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
1092 template class TypeImpl<HeapTypeConfig>::Iterator<i::Object>; 1093 template class TypeImpl<HeapTypeConfig>::Iterator<i::Object>;
1093 1094
1094 template TypeImpl<ZoneTypeConfig>::TypeHandle 1095 template TypeImpl<ZoneTypeConfig>::TypeHandle
1095 TypeImpl<ZoneTypeConfig>::Convert<HeapType>( 1096 TypeImpl<ZoneTypeConfig>::Convert<HeapType>(
1096 TypeImpl<HeapTypeConfig>::TypeHandle, TypeImpl<ZoneTypeConfig>::Region*); 1097 TypeImpl<HeapTypeConfig>::TypeHandle, TypeImpl<ZoneTypeConfig>::Region*);
1097 template TypeImpl<HeapTypeConfig>::TypeHandle 1098 template TypeImpl<HeapTypeConfig>::TypeHandle
1098 TypeImpl<HeapTypeConfig>::Convert<Type>( 1099 TypeImpl<HeapTypeConfig>::Convert<Type>(
1099 TypeImpl<ZoneTypeConfig>::TypeHandle, TypeImpl<HeapTypeConfig>::Region*); 1100 TypeImpl<ZoneTypeConfig>::TypeHandle, TypeImpl<HeapTypeConfig>::Region*);
1100 1101
1101 } } // namespace v8::internal 1102 } } // 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