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

Unified Diff: runtime/vm/precompiler.h

Issue 2314133003: AOT: Use a cid range check when possible to implement type tests. (Closed)
Patch Set: symbols 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/precompiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/precompiler.h
diff --git a/runtime/vm/precompiler.h b/runtime/vm/precompiler.h
index e5d4742e7d2f8f4ad0f9181363df0125e7294048..774dbd5d52c0274ed33a82b0eae4c342ec8ff787 100644
--- a/runtime/vm/precompiler.h
+++ b/runtime/vm/precompiler.h
@@ -22,6 +22,42 @@ class RawError;
class SequenceNode;
class String;
+
+class TypeRangeCache : public StackResource {
+ public:
+ TypeRangeCache(Thread* thread, intptr_t num_cids)
+ : StackResource(thread),
+ thread_(thread),
+ lower_limits_(thread->zone()->Alloc<intptr_t>(num_cids)),
+ upper_limits_(thread->zone()->Alloc<intptr_t>(num_cids)) {
+ for (intptr_t i = 0; i < num_cids; i++) {
+ lower_limits_[i] = kNotComputed;
+ upper_limits_[i] = kNotComputed;
+ }
+ // We don't re-enter the precompiler.
+ ASSERT(thread->type_range_cache() == NULL);
+ thread->set_type_range_cache(this);
+ }
+
+ ~TypeRangeCache() {
+ ASSERT(thread_->type_range_cache() == this);
+ thread_->set_type_range_cache(NULL);
+ }
+
+ bool InstanceOfHasClassRange(const AbstractType& type,
+ intptr_t* lower_limit,
+ intptr_t* upper_limit);
+
+ private:
+ static const intptr_t kNotComputed = -1;
+ static const intptr_t kNotContiguous = -2;
+
+ Thread* thread_;
+ intptr_t* lower_limits_;
+ intptr_t* upper_limits_;
+};
+
+
class SymbolKeyValueTrait {
public:
// Typedefs needed for the DirectChainedHashMap template.
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/precompiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698