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

Side by Side Diff: src/compiler/types.h

Issue 2309823002: [turbofan] put src/types.[h/cc] into src/compiler/types.[h/cc] (Closed)
Patch Set: Updates/comments. Created 4 years, 3 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 | « src/compiler/type-cache.h ('k') | src/compiler/types.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 #ifndef V8_TYPES_H_ 5 #ifndef V8_COMPILER_TYPES_H_
6 #define V8_TYPES_H_ 6 #define V8_COMPILER_TYPES_H_
7 7
8 #include "src/conversions.h" 8 #include "src/conversions.h"
9 #include "src/handles.h" 9 #include "src/handles.h"
10 #include "src/objects.h" 10 #include "src/objects.h"
11 #include "src/ostreams.h" 11 #include "src/ostreams.h"
12 12
13 namespace v8 { 13 namespace v8 {
14 namespace internal { 14 namespace internal {
15 namespace compiler {
15 16
16 // SUMMARY 17 // SUMMARY
17 // 18 //
18 // A simple type system for compiler-internal use. It is based entirely on 19 // A simple type system for compiler-internal use. It is based entirely on
19 // union types, and all subtyping hence amounts to set inclusion. Besides the 20 // union types, and all subtyping hence amounts to set inclusion. Besides the
20 // obvious primitive types and some predefined unions, the type language also 21 // obvious primitive types and some predefined unions, the type language also
21 // can express class types (a.k.a. specific maps) and singleton types (i.e., 22 // can express class types (a.k.a. specific maps) and singleton types (i.e.,
22 // concrete constants). 23 // concrete constants).
23 // 24 //
24 // Types consist of two dimensions: semantic (value range) and representation. 25 // Types consist of two dimensions: semantic (value range) and representation.
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 * -2^31 -2^30 0 2^30 2^31 2^32 236 * -2^31 -2^30 0 2^30 2^31 2^32
236 * 237 *
237 * E.g., OtherUnsigned32 (OU32) covers all integers from 2^31 to 2^32-1. 238 * E.g., OtherUnsigned32 (OU32) covers all integers from 2^31 to 2^32-1.
238 * 239 *
239 * Some of the atomic numerical bitsets are internal only (see 240 * Some of the atomic numerical bitsets are internal only (see
240 * INTERNAL_BITSET_TYPE_LIST). To a types user, they should only occur in 241 * INTERNAL_BITSET_TYPE_LIST). To a types user, they should only occur in
241 * union with certain other bitsets. For instance, OtherNumber should only 242 * union with certain other bitsets. For instance, OtherNumber should only
242 * occur as part of PlainNumber. 243 * occur as part of PlainNumber.
243 */ 244 */
244 245
245 #define PROPER_BITSET_TYPE_LIST(V) \ 246 #define PROPER_BITSET_TYPE_LIST(V) \
246 REPRESENTATION_BITSET_TYPE_LIST(V) \ 247 REPRESENTATION_BITSET_TYPE_LIST(V) \
247 SEMANTIC_BITSET_TYPE_LIST(V) 248 SEMANTIC_BITSET_TYPE_LIST(V)
248 249
249 #define BITSET_TYPE_LIST(V) \ 250 #define BITSET_TYPE_LIST(V) \
250 MASK_BITSET_TYPE_LIST(V) \ 251 MASK_BITSET_TYPE_LIST(V) \
251 REPRESENTATION_BITSET_TYPE_LIST(V) \ 252 REPRESENTATION_BITSET_TYPE_LIST(V) \
252 INTERNAL_BITSET_TYPE_LIST(V) \ 253 INTERNAL_BITSET_TYPE_LIST(V) \
253 SEMANTIC_BITSET_TYPE_LIST(V) 254 SEMANTIC_BITSET_TYPE_LIST(V)
254 255
255 class Type; 256 class Type;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 static inline const Boundary* Boundaries(); 330 static inline const Boundary* Boundaries();
330 static inline size_t BoundariesSize(); 331 static inline size_t BoundariesSize();
331 }; 332 };
332 333
333 // ----------------------------------------------------------------------------- 334 // -----------------------------------------------------------------------------
334 // Superclass for non-bitset types (internal). 335 // Superclass for non-bitset types (internal).
335 class TypeBase { 336 class TypeBase {
336 protected: 337 protected:
337 friend class Type; 338 friend class Type;
338 339
339 enum Kind { 340 enum Kind { kConstant, kTuple, kUnion, kRange };
340 kConstant,
341 kTuple,
342 kUnion,
343 kRange
344 };
345 341
346 Kind kind() const { return kind_; } 342 Kind kind() const { return kind_; }
347 explicit TypeBase(Kind kind) : kind_(kind) {} 343 explicit TypeBase(Kind kind) : kind_(kind) {}
348 344
349 static bool IsKind(Type* type, Kind kind) { 345 static bool IsKind(Type* type, Kind kind) {
350 if (BitsetType::IsBitset(type)) return false; 346 if (BitsetType::IsBitset(type)) return false;
351 TypeBase* base = reinterpret_cast<TypeBase*>(type); 347 TypeBase* base = reinterpret_cast<TypeBase*>(type);
352 return base->kind() == kind; 348 return base->kind() == kind;
353 } 349 }
354 350
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 Type* upper = Type::Intersect(b.upper, t, zone); 765 Type* upper = Type::Intersect(b.upper, t, zone);
770 // Lower bounds are considered approximate, correct as necessary. 766 // Lower bounds are considered approximate, correct as necessary.
771 if (!lower->Is(upper)) lower = upper; 767 if (!lower->Is(upper)) lower = upper;
772 return Bounds(lower, upper); 768 return Bounds(lower, upper);
773 } 769 }
774 770
775 bool Narrows(Bounds that) { 771 bool Narrows(Bounds that) {
776 return that.lower->Is(this->lower) && this->upper->Is(that.upper); 772 return that.lower->Is(this->lower) && this->upper->Is(that.upper);
777 } 773 }
778 }; 774 };
775 } // namespace compiler
779 } // namespace internal 776 } // namespace internal
780 } // namespace v8 777 } // namespace v8
781 778
782 #endif // V8_TYPES_H_ 779 #endif // V8_COMPILER_TYPES_H_
OLDNEW
« no previous file with comments | « src/compiler/type-cache.h ('k') | src/compiler/types.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698