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

Side by Side Diff: src/compilation-dependencies.h

Issue 1095433002: 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 unified diff | Download patch
« no previous file with comments | « BUILD.gn ('k') | src/compilation-dependencies.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef V8_DEPENDENCIES_H_
6 #define V8_DEPENDENCIES_H_
7
8 namespace v8 {
9 namespace internal {
10
11 // Collects dependencies for this compilation, e.g. assumptions about
12 // stable maps, constant globals, etc.
13 class CompilationDependencies {
14 public:
15 CompilationDependencies(Isolate* isolate, Zone* zone)
16 : isolate_(isolate),
17 zone_(zone),
18 object_wrapper_(Handle<Foreign>::null()),
19 aborted_(false) {
20 std::fill_n(groups_, DependentCode::kGroupCount, nullptr);
21 }
22
23 void Insert(DependentCode::DependencyGroup group, Handle<HeapObject> handle);
24
25 void AssumeInitialMapCantChange(Handle<Map> map) {
26 Insert(DependentCode::kInitialMapChangedGroup, map);
27 }
28 void AssumeElementsCantBeAdded(Handle<Map> map) {
29 Insert(DependentCode::kElementsCantBeAddedGroup, map);
30 }
31 void AssumeFieldType(Handle<Map> map) {
32 Insert(DependentCode::kFieldTypeGroup, map);
33 }
34 void AssumePropertyCell(Handle<PropertyCell> cell) {
35 Insert(DependentCode::kPropertyCellChangedGroup, cell);
36 }
37 void AssumeTenuringDecision(Handle<AllocationSite> site) {
38 Insert(DependentCode::kAllocationSiteTenuringChangedGroup, site);
39 }
40 void AssumeTransitionStable(Handle<AllocationSite> site);
41
42 void Commit(Handle<Code> code);
43 void Rollback();
44 void Abort() { aborted_ = true; }
45 bool HasAborted() const { return aborted_; }
46
47 bool IsEmpty() const {
48 for (int i = 0; i < DependentCode::kGroupCount; i++) {
49 if (groups_[i]) return false;
50 }
51 return true;
52 }
53
54 private:
55 Isolate* isolate_;
56 Zone* zone_;
57 Handle<Foreign> object_wrapper_;
58 bool aborted_;
59 ZoneList<Handle<HeapObject> >* groups_[DependentCode::kGroupCount];
60
61 DependentCode* Get(Handle<Object> object);
62 void Set(Handle<Object> object, Handle<DependentCode> dep);
63 };
64 }
65 } // namespace v8::internal
66
67 #endif // V8_DEPENDENCIES_H_
OLDNEW
« 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