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

Unified Diff: runtime/vm/precompiler.h

Issue 2579413002: Revert "Save and restore feedback from JIT." (Closed)
Patch Set: Created 4 years 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 f4af73527b25fbdc7bc0230c13b8f99ada7d8015..b7633635d227c412d3514fd4da9221698e49b8f8 100644
--- a/runtime/vm/precompiler.h
+++ b/runtime/vm/precompiler.h
@@ -21,15 +21,28 @@ class GrowableObjectArray;
class RawError;
class SequenceNode;
class String;
-class ParsedJSONObject;
-class ParsedJSONArray;
-class Precompiler;
-class FlowGraph;
-class TypeRangeCache : public ValueObject {
+
+class TypeRangeCache : public StackResource {
public:
- TypeRangeCache(Precompiler* precompiler, Thread* thread, intptr_t num_cids);
- ~TypeRangeCache();
+ 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,
@@ -39,7 +52,6 @@ class TypeRangeCache : public ValueObject {
static const intptr_t kNotComputed = -1;
static const intptr_t kNotContiguous = -2;
- Precompiler* precompiler_;
Thread* thread_;
intptr_t* lower_limits_;
intptr_t* upper_limits_;
@@ -316,79 +328,11 @@ struct FieldTypePair {
typedef DirectChainedHashMap<FieldTypePair> FieldTypeMap;
-struct IntptrPair {
- // Typedefs needed for the DirectChainedHashMap template.
- typedef intptr_t Key;
- typedef intptr_t Value;
- typedef IntptrPair Pair;
-
- static Key KeyOf(Pair kv) { return kv.key_; }
-
- static Value ValueOf(Pair kv) { return kv.value_; }
-
- static inline intptr_t Hashcode(Key key) { return key; }
-
- static inline bool IsKeyEqual(Pair pair, Key key) { return pair.key_ == key; }
-
- IntptrPair(intptr_t key, intptr_t value) : key_(key), value_(value) {}
-
- IntptrPair() : key_(kIllegalCid), value_(kIllegalCid) {}
-
- Key key_;
- Value value_;
-};
-
-typedef DirectChainedHashMap<IntptrPair> CidMap;
-
-
-struct FunctionFeedbackKey {
- FunctionFeedbackKey() : owner_cid_(kIllegalCid), token_(0), kind_(0) {}
- FunctionFeedbackKey(intptr_t owner_cid, intptr_t token, intptr_t kind)
- : owner_cid_(owner_cid), token_(token), kind_(kind) {}
-
- intptr_t owner_cid_;
- intptr_t token_;
- intptr_t kind_;
-};
-
-
-struct FunctionFeedbackPair {
- // Typedefs needed for the DirectChainedHashMap template.
- typedef FunctionFeedbackKey Key;
- typedef ParsedJSONObject* Value;
- typedef FunctionFeedbackPair Pair;
-
- static Key KeyOf(Pair kv) { return kv.key_; }
-
- static Value ValueOf(Pair kv) { return kv.value_; }
-
- static inline intptr_t Hashcode(Key key) {
- return key.token_ ^ key.owner_cid_ ^ key.kind_;
- }
-
- static inline bool IsKeyEqual(Pair pair, Key key) {
- return (pair.key_.owner_cid_ == key.owner_cid_) &&
- (pair.key_.token_ == key.token_) && (pair.key_.kind_ == key.kind_);
- }
-
- FunctionFeedbackPair(Key key, Value value) : key_(key), value_(value) {}
-
- FunctionFeedbackPair() : key_(), value_(NULL) {}
-
- Key key_;
- Value value_;
-};
-
-typedef DirectChainedHashMap<FunctionFeedbackPair> FunctionFeedbackMap;
-
-
class Precompiler : public ValueObject {
public:
static RawError* CompileAll(
Dart_QualifiedFunctionName embedder_entry_points[],
- bool reset_fields,
- uint8_t* jit_feedback,
- intptr_t jit_feedback_length);
+ bool reset_fields);
static RawError* CompileFunction(Precompiler* precompiler,
Thread* thread,
@@ -408,22 +352,10 @@ class Precompiler : public ValueObject {
}
FieldTypeMap* field_type_map() { return &field_type_map_; }
- TypeRangeCache* type_range_cache() { return type_range_cache_; }
- void set_type_range_cache(TypeRangeCache* value) {
- type_range_cache_ = value;
- }
-
- bool HasFeedback() const { return jit_feedback_ != NULL; }
- static void PopulateWithICData(const Function& func, FlowGraph* graph);
- void TryApplyFeedback(const Function& func, FlowGraph* graph);
- void TryApplyFeedback(ParsedJSONArray* js_icdatas, const ICData& ic);
private:
Precompiler(Thread* thread, bool reset_fields);
- void LoadFeedback(uint8_t* jit_feedback, intptr_t jit_feedback_length);
- ParsedJSONObject* LookupFeedback(const Function& function);
-
void DoCompileAll(Dart_QualifiedFunctionName embedder_entry_points[]);
void ClearAllCode();
void AddRoots(Dart_QualifiedFunctionName embedder_entry_points[]);
@@ -471,12 +403,21 @@ class Precompiler : public ValueObject {
void PrecompileStaticInitializers();
void PrecompileConstructors();
+ template <typename T>
+ class Visitor : public ValueObject {
+ public:
+ virtual ~Visitor() {}
+ virtual void Visit(const T& obj) = 0;
+ };
+ typedef Visitor<Function> FunctionVisitor;
+ typedef Visitor<Class> ClassVisitor;
+
+ void VisitFunctions(FunctionVisitor* visitor);
+ void VisitClasses(ClassVisitor* visitor);
+
void FinalizeAllClasses();
void SortClasses();
void RemapClassIds(intptr_t* old_to_new_cid);
- void VerifyJITFeedback();
- RawScript* LookupScript(const char* uri);
- intptr_t MapCid(intptr_t feedback_cid);
Thread* thread() const { return thread_; }
Zone* zone() const { return zone_; }
@@ -488,8 +429,6 @@ class Precompiler : public ValueObject {
const bool reset_fields_;
- ParsedJSONObject* jit_feedback_;
-
bool changed_;
intptr_t function_count_;
intptr_t class_count_;
@@ -512,9 +451,6 @@ class Precompiler : public ValueObject {
AbstractTypeSet types_to_retain_;
InstanceSet consts_to_retain_;
FieldTypeMap field_type_map_;
- TypeRangeCache* type_range_cache_;
- CidMap feedback_cid_map_;
- FunctionFeedbackMap function_feedback_map_;
Error& error_;
bool get_runtime_type_is_unique_;
« 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