OLD | NEW |
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/base/flags.h" | 5 #include "src/base/flags.h" |
6 #include "src/bootstrapper.h" | 6 #include "src/bootstrapper.h" |
7 #include "src/compiler/graph-reducer.h" | 7 #include "src/compiler/graph-reducer.h" |
8 #include "src/compiler/js-operator.h" | 8 #include "src/compiler/js-operator.h" |
9 #include "src/compiler/node.h" | 9 #include "src/compiler/node.h" |
10 #include "src/compiler/node-properties.h" | 10 #include "src/compiler/node-properties.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 V(Uint32) \ | 24 V(Uint32) \ |
25 V(Float32) \ | 25 V(Float32) \ |
26 V(Float64) | 26 V(Float64) |
27 | 27 |
28 enum LazyCachedType { | 28 enum LazyCachedType { |
29 kNumberFunc0, | 29 kNumberFunc0, |
30 kNumberFunc1, | 30 kNumberFunc1, |
31 kNumberFunc2, | 31 kNumberFunc2, |
32 kImulFunc, | 32 kImulFunc, |
33 kClz32Func, | 33 kClz32Func, |
| 34 kAtomicsLoadFunc, |
34 kArrayBufferFunc, | 35 kArrayBufferFunc, |
35 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ | 36 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ |
36 k##Type, k##Type##Array, k##Type##ArrayFunc, | 37 k##Type, k##Type##Array, k##Type##ArrayFunc, |
37 TYPED_ARRAYS(TYPED_ARRAY_CASE) | 38 TYPED_ARRAYS(TYPED_ARRAY_CASE) |
38 #undef TYPED_ARRAY_CASE | 39 #undef TYPED_ARRAY_CASE |
39 kNumLazyCachedTypes | 40 kNumLazyCachedTypes |
40 }; | 41 }; |
41 | 42 |
42 | 43 |
43 // Constructs and caches types lazily. | 44 // Constructs and caches types lazily. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 case kNumberFunc1: | 84 case kNumberFunc1: |
84 return Type::Function(Type::Number(), Type::Number(), zone()); | 85 return Type::Function(Type::Number(), Type::Number(), zone()); |
85 case kNumberFunc2: | 86 case kNumberFunc2: |
86 return Type::Function(Type::Number(), Type::Number(), Type::Number(), | 87 return Type::Function(Type::Number(), Type::Number(), Type::Number(), |
87 zone()); | 88 zone()); |
88 case kImulFunc: | 89 case kImulFunc: |
89 return Type::Function(Type::Signed32(), Type::Integral32(), | 90 return Type::Function(Type::Signed32(), Type::Integral32(), |
90 Type::Integral32(), zone()); | 91 Type::Integral32(), zone()); |
91 case kClz32Func: | 92 case kClz32Func: |
92 return Type::Function(CreateRange(0, 32), Type::Number(), zone()); | 93 return Type::Function(CreateRange(0, 32), Type::Number(), zone()); |
| 94 case kAtomicsLoadFunc: |
| 95 return Type::Function( |
| 96 Type::Union(Type::Number(), Type::Undefined(), zone()), |
| 97 Type::Object(zone()), Type::Unsigned32(), zone()); |
93 case kArrayBufferFunc: | 98 case kArrayBufferFunc: |
94 return Type::Function(Type::Object(zone()), Type::Unsigned32(), zone()); | 99 return Type::Function(Type::Object(zone()), Type::Unsigned32(), zone()); |
95 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ | 100 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \ |
96 case k##Type##Array: \ | 101 case k##Type##Array: \ |
97 return CreateArray(Get(k##Type)); \ | 102 return CreateArray(Get(k##Type)); \ |
98 case k##Type##ArrayFunc: \ | 103 case k##Type##ArrayFunc: \ |
99 return CreateArrayFunction(Get(k##Type##Array)); | 104 return CreateArrayFunction(Get(k##Type##Array)); |
100 TYPED_ARRAYS(TYPED_ARRAY_CASE) | 105 TYPED_ARRAYS(TYPED_ARRAY_CASE) |
101 #undef TYPED_ARRAY_CASE | 106 #undef TYPED_ARRAY_CASE |
102 case kNumLazyCachedTypes: | 107 case kNumLazyCachedTypes: |
(...skipping 1704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1807 UNREACHABLE(); | 1812 UNREACHABLE(); |
1808 return Bounds(); | 1813 return Bounds(); |
1809 } | 1814 } |
1810 | 1815 |
1811 | 1816 |
1812 Bounds Typer::Visitor::TypeLoadElement(Node* node) { | 1817 Bounds Typer::Visitor::TypeLoadElement(Node* node) { |
1813 return Bounds(ElementAccessOf(node->op()).type); | 1818 return Bounds(ElementAccessOf(node->op()).type); |
1814 } | 1819 } |
1815 | 1820 |
1816 | 1821 |
| 1822 Bounds Typer::Visitor::TypeLoadElementAtomic(Node* node) { |
| 1823 return Bounds(ElementAccessOf(node->op()).type); |
| 1824 } |
| 1825 |
| 1826 |
1817 Bounds Typer::Visitor::TypeStoreField(Node* node) { | 1827 Bounds Typer::Visitor::TypeStoreField(Node* node) { |
1818 UNREACHABLE(); | 1828 UNREACHABLE(); |
1819 return Bounds(); | 1829 return Bounds(); |
1820 } | 1830 } |
1821 | 1831 |
1822 | 1832 |
1823 Bounds Typer::Visitor::TypeStoreBuffer(Node* node) { | 1833 Bounds Typer::Visitor::TypeStoreBuffer(Node* node) { |
1824 UNREACHABLE(); | 1834 UNREACHABLE(); |
1825 return Bounds(); | 1835 return Bounds(); |
1826 } | 1836 } |
(...skipping 15 matching lines...) Expand all Loading... |
1842 } | 1852 } |
1843 | 1853 |
1844 | 1854 |
1845 // Machine operators. | 1855 // Machine operators. |
1846 | 1856 |
1847 Bounds Typer::Visitor::TypeLoad(Node* node) { | 1857 Bounds Typer::Visitor::TypeLoad(Node* node) { |
1848 return Bounds::Unbounded(zone()); | 1858 return Bounds::Unbounded(zone()); |
1849 } | 1859 } |
1850 | 1860 |
1851 | 1861 |
| 1862 Bounds Typer::Visitor::TypeLoadAtomic(Node* node) { |
| 1863 return Bounds::Unbounded(zone()); |
| 1864 } |
| 1865 |
| 1866 |
1852 Bounds Typer::Visitor::TypeStore(Node* node) { | 1867 Bounds Typer::Visitor::TypeStore(Node* node) { |
1853 UNREACHABLE(); | 1868 UNREACHABLE(); |
1854 return Bounds(); | 1869 return Bounds(); |
1855 } | 1870 } |
1856 | 1871 |
1857 | 1872 |
1858 Bounds Typer::Visitor::TypeWord32And(Node* node) { | 1873 Bounds Typer::Visitor::TypeWord32And(Node* node) { |
1859 return Bounds(Type::Integral32()); | 1874 return Bounds(Type::Integral32()); |
1860 } | 1875 } |
1861 | 1876 |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2325 // Binary math functions. | 2340 // Binary math functions. |
2326 case kMathAtan2: | 2341 case kMathAtan2: |
2327 case kMathPow: | 2342 case kMathPow: |
2328 case kMathMax: | 2343 case kMathMax: |
2329 case kMathMin: | 2344 case kMathMin: |
2330 return typer_->cache_->Get(kNumberFunc2); | 2345 return typer_->cache_->Get(kNumberFunc2); |
2331 case kMathImul: | 2346 case kMathImul: |
2332 return typer_->cache_->Get(kImulFunc); | 2347 return typer_->cache_->Get(kImulFunc); |
2333 case kMathClz32: | 2348 case kMathClz32: |
2334 return typer_->cache_->Get(kClz32Func); | 2349 return typer_->cache_->Get(kClz32Func); |
| 2350 case kAtomicsLoad: |
| 2351 return typer_->cache_->Get(kAtomicsLoadFunc); |
2335 default: | 2352 default: |
2336 break; | 2353 break; |
2337 } | 2354 } |
2338 } else if (JSFunction::cast(*value)->IsBuiltin() && !context().is_null()) { | 2355 } else if (JSFunction::cast(*value)->IsBuiltin() && !context().is_null()) { |
2339 Handle<Context> native = | 2356 Handle<Context> native = |
2340 handle(context().ToHandleChecked()->native_context(), isolate()); | 2357 handle(context().ToHandleChecked()->native_context(), isolate()); |
2341 if (*value == native->array_buffer_fun()) { | 2358 if (*value == native->array_buffer_fun()) { |
2342 return typer_->cache_->Get(kArrayBufferFunc); | 2359 return typer_->cache_->Get(kArrayBufferFunc); |
2343 } else if (*value == native->int8_array_fun()) { | 2360 } else if (*value == native->int8_array_fun()) { |
2344 return typer_->cache_->Get(kInt8ArrayFunc); | 2361 return typer_->cache_->Get(kInt8ArrayFunc); |
(...skipping 21 matching lines...) Expand all Loading... |
2366 TYPED_ARRAYS(TYPED_ARRAY_CASE) | 2383 TYPED_ARRAYS(TYPED_ARRAY_CASE) |
2367 #undef TYPED_ARRAY_CASE | 2384 #undef TYPED_ARRAY_CASE |
2368 } | 2385 } |
2369 } | 2386 } |
2370 return Type::Constant(value, zone()); | 2387 return Type::Constant(value, zone()); |
2371 } | 2388 } |
2372 | 2389 |
2373 } // namespace compiler | 2390 } // namespace compiler |
2374 } // namespace internal | 2391 } // namespace internal |
2375 } // namespace v8 | 2392 } // namespace v8 |
OLD | NEW |