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

Side by Side Diff: src/compiler/type-cache.h

Issue 2285213002: [turbofan] Assign appropriate types to some Date builtins. (Closed)
Patch Set: 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/js-builtin-reducer.cc ('k') | src/compiler/typer.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_COMPILER_TYPE_CACHE_H_ 5 #ifndef V8_COMPILER_TYPE_CACHE_H_
6 #define V8_COMPILER_TYPE_CACHE_H_ 6 #define V8_COMPILER_TYPE_CACHE_H_
7 7
8 #include "src/date.h"
8 #include "src/types.h" 9 #include "src/types.h"
9 10
10 namespace v8 { 11 namespace v8 {
11 namespace internal { 12 namespace internal {
12 namespace compiler { 13 namespace compiler {
13 14
14 class TypeCache final { 15 class TypeCache final {
15 private: 16 private:
16 // This has to be first for the initialization magic to work. 17 // This has to be first for the initialization magic to work.
17 base::AccountingAllocator allocator; 18 base::AccountingAllocator allocator;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 // The JSTyped::length property always contains a tagged number in the range 97 // The JSTyped::length property always contains a tagged number in the range
97 // [0, kMaxSmiValue]. 98 // [0, kMaxSmiValue].
98 Type* const kJSTypedArrayLengthType = 99 Type* const kJSTypedArrayLengthType =
99 CreateNative(Type::UnsignedSmall(), Type::TaggedSigned()); 100 CreateNative(Type::UnsignedSmall(), Type::TaggedSigned());
100 101
101 // The String::length property always contains a smi in the range 102 // The String::length property always contains a smi in the range
102 // [0, String::kMaxLength]. 103 // [0, String::kMaxLength].
103 Type* const kStringLengthType = 104 Type* const kStringLengthType =
104 CreateNative(CreateRange(0.0, String::kMaxLength), Type::TaggedSigned()); 105 CreateNative(CreateRange(0.0, String::kMaxLength), Type::TaggedSigned());
105 106
107 // The JSDate::value properties always contains a tagged number in the range
108 // [-kMaxTimeInMs, kMaxTimeInMs] or NaN.
109 Type* const kJSDateValueType = Type::Union(
110 CreateRange(-DateCache::kMaxTimeInMs, DateCache::kMaxTimeInMs),
111 Type::NaN(), zone());
112
106 #define TYPED_ARRAY(TypeName, type_name, TYPE_NAME, ctype, size) \ 113 #define TYPED_ARRAY(TypeName, type_name, TYPE_NAME, ctype, size) \
107 Type* const k##TypeName##Array = CreateArray(k##TypeName); 114 Type* const k##TypeName##Array = CreateArray(k##TypeName);
108 TYPED_ARRAYS(TYPED_ARRAY) 115 TYPED_ARRAYS(TYPED_ARRAY)
109 #undef TYPED_ARRAY 116 #undef TYPED_ARRAY
110 117
111 private: 118 private:
112 Type* CreateArray(Type* element) { return Type::Array(element, zone()); } 119 Type* CreateArray(Type* element) { return Type::Array(element, zone()); }
113 120
114 Type* CreateArrayFunction(Type* array) { 121 Type* CreateArrayFunction(Type* array) {
115 Type* arg1 = Type::Union(Type::Unsigned32(), Type::Object(), zone()); 122 Type* arg1 = Type::Union(Type::Unsigned32(), Type::Object(), zone());
(...skipping 17 matching lines...) Expand all
133 } 140 }
134 141
135 Zone* zone() { return &zone_; } 142 Zone* zone() { return &zone_; }
136 }; 143 };
137 144
138 } // namespace compiler 145 } // namespace compiler
139 } // namespace internal 146 } // namespace internal
140 } // namespace v8 147 } // namespace v8
141 148
142 #endif // V8_COMPILER_TYPE_CACHE_H_ 149 #endif // V8_COMPILER_TYPE_CACHE_H_
OLDNEW
« no previous file with comments | « src/compiler/js-builtin-reducer.cc ('k') | src/compiler/typer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698