OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_PRECOMPILER_H_ | 5 #ifndef VM_PRECOMPILER_H_ |
6 #define VM_PRECOMPILER_H_ | 6 #define VM_PRECOMPILER_H_ |
7 | 7 |
8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
9 #include "vm/hash_map.h" | 9 #include "vm/hash_map.h" |
10 #include "vm/hash_table.h" | 10 #include "vm/hash_table.h" |
11 #include "vm/object.h" | 11 #include "vm/object.h" |
12 | 12 |
13 namespace dart { | 13 namespace dart { |
14 | 14 |
15 // Forward declarations. | 15 // Forward declarations. |
16 class Class; | 16 class Class; |
17 class Error; | 17 class Error; |
18 class Field; | 18 class Field; |
19 class Function; | 19 class Function; |
20 class GrowableObjectArray; | 20 class GrowableObjectArray; |
21 class RawError; | 21 class RawError; |
22 class SequenceNode; | 22 class SequenceNode; |
23 class String; | 23 class String; |
24 | 24 |
| 25 |
| 26 class TypeRangeCache : public StackResource { |
| 27 public: |
| 28 TypeRangeCache(Thread* thread, intptr_t num_cids) |
| 29 : StackResource(thread), |
| 30 thread_(thread), |
| 31 lower_limits_(thread->zone()->Alloc<intptr_t>(num_cids)), |
| 32 upper_limits_(thread->zone()->Alloc<intptr_t>(num_cids)) { |
| 33 for (intptr_t i = 0; i < num_cids; i++) { |
| 34 lower_limits_[i] = kNotComputed; |
| 35 upper_limits_[i] = kNotComputed; |
| 36 } |
| 37 // We don't re-enter the precompiler. |
| 38 ASSERT(thread->type_range_cache() == NULL); |
| 39 thread->set_type_range_cache(this); |
| 40 } |
| 41 |
| 42 ~TypeRangeCache() { |
| 43 ASSERT(thread_->type_range_cache() == this); |
| 44 thread_->set_type_range_cache(NULL); |
| 45 } |
| 46 |
| 47 bool InstanceOfHasClassRange(const AbstractType& type, |
| 48 intptr_t* lower_limit, |
| 49 intptr_t* upper_limit); |
| 50 |
| 51 private: |
| 52 static const intptr_t kNotComputed = -1; |
| 53 static const intptr_t kNotContiguous = -2; |
| 54 |
| 55 Thread* thread_; |
| 56 intptr_t* lower_limits_; |
| 57 intptr_t* upper_limits_; |
| 58 }; |
| 59 |
| 60 |
25 class SymbolKeyValueTrait { | 61 class SymbolKeyValueTrait { |
26 public: | 62 public: |
27 // Typedefs needed for the DirectChainedHashMap template. | 63 // Typedefs needed for the DirectChainedHashMap template. |
28 typedef const String* Key; | 64 typedef const String* Key; |
29 typedef const String* Value; | 65 typedef const String* Value; |
30 typedef const String* Pair; | 66 typedef const String* Pair; |
31 | 67 |
32 static Key KeyOf(Pair kv) { return kv; } | 68 static Key KeyOf(Pair kv) { return kv; } |
33 | 69 |
34 static Value ValueOf(Pair kv) { return kv; } | 70 static Value ValueOf(Pair kv) { return kv; } |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 return function.raw(); | 470 return function.raw(); |
435 } | 471 } |
436 }; | 472 }; |
437 | 473 |
438 typedef UnorderedHashSet<FunctionsTraits> UniqueFunctionsSet; | 474 typedef UnorderedHashSet<FunctionsTraits> UniqueFunctionsSet; |
439 | 475 |
440 | 476 |
441 } // namespace dart | 477 } // namespace dart |
442 | 478 |
443 #endif // VM_PRECOMPILER_H_ | 479 #endif // VM_PRECOMPILER_H_ |
OLD | NEW |