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

Unified Diff: src/compilation-dependencies.h

Issue 1099473004: Reland "Refactor compilation dependency handling." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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 | « BUILD.gn ('k') | src/compilation-dependencies.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compilation-dependencies.h
diff --git a/src/compilation-dependencies.h b/src/compilation-dependencies.h
new file mode 100644
index 0000000000000000000000000000000000000000..ddd0be83bdaa15e0f1caf292859df17cc9696257
--- /dev/null
+++ b/src/compilation-dependencies.h
@@ -0,0 +1,67 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8_DEPENDENCIES_H_
+#define V8_DEPENDENCIES_H_
+
+namespace v8 {
+namespace internal {
+
+// Collects dependencies for this compilation, e.g. assumptions about
+// stable maps, constant globals, etc.
+class CompilationDependencies {
+ public:
+ CompilationDependencies(Isolate* isolate, Zone* zone)
+ : isolate_(isolate),
+ zone_(zone),
+ object_wrapper_(Handle<Foreign>::null()),
+ aborted_(false) {
+ std::fill_n(groups_, DependentCode::kGroupCount, nullptr);
+ }
+
+ void Insert(DependentCode::DependencyGroup group, Handle<HeapObject> handle);
+
+ void AssumeInitialMapCantChange(Handle<Map> map) {
+ Insert(DependentCode::kInitialMapChangedGroup, map);
+ }
+ void AssumeElementsCantBeAdded(Handle<Map> map) {
+ Insert(DependentCode::kElementsCantBeAddedGroup, map);
+ }
+ void AssumeFieldType(Handle<Map> map) {
+ Insert(DependentCode::kFieldTypeGroup, map);
+ }
+ void AssumePropertyCell(Handle<PropertyCell> cell) {
+ Insert(DependentCode::kPropertyCellChangedGroup, cell);
+ }
+ void AssumeTenuringDecision(Handle<AllocationSite> site) {
+ Insert(DependentCode::kAllocationSiteTenuringChangedGroup, site);
+ }
+ void AssumeTransitionStable(Handle<AllocationSite> site);
+
+ void Commit(Handle<Code> code);
+ void Rollback();
+ void Abort() { aborted_ = true; }
+ bool HasAborted() const { return aborted_; }
+
+ bool IsEmpty() const {
+ for (int i = 0; i < DependentCode::kGroupCount; i++) {
+ if (groups_[i]) return false;
+ }
+ return true;
+ }
+
+ private:
+ Isolate* isolate_;
+ Zone* zone_;
+ Handle<Foreign> object_wrapper_;
+ bool aborted_;
+ ZoneList<Handle<HeapObject> >* groups_[DependentCode::kGroupCount];
+
+ DependentCode* Get(Handle<Object> object);
+ void Set(Handle<Object> object, Handle<DependentCode> dep);
+};
+}
+} // namespace v8::internal
+
+#endif // V8_DEPENDENCIES_H_
« no previous file with comments | « BUILD.gn ('k') | src/compilation-dependencies.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698