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

Unified Diff: src/compiler.h

Issue 16542003: Enable map dependency to in-flight compilation info. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: put transition maps and initial maps dependency into a separate CL Created 7 years, 6 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
Index: src/compiler.h
diff --git a/src/compiler.h b/src/compiler.h
index 8e6d295996d049f1c01dde6424c3ba3ae220d819..f53feb954a49c53016d0eece13f3425b117b1619 100644
--- a/src/compiler.h
+++ b/src/compiler.h
@@ -57,12 +57,8 @@ struct OffsetRange {
// is constructed based on the resources available at compile-time.
class CompilationInfo {
public:
- CompilationInfo(Handle<Script> script, Zone* zone);
- CompilationInfo(Handle<SharedFunctionInfo> shared_info, Zone* zone);
CompilationInfo(Handle<JSFunction> closure, Zone* zone);
- CompilationInfo(HydrogenCodeStub* stub, Isolate* isolate, Zone* zone);
-
- ~CompilationInfo();
+ virtual ~CompilationInfo();
Isolate* isolate() {
ASSERT(Isolate::Current() == isolate_);
@@ -243,6 +239,17 @@ class CompilationInfo {
deferred_handles_ = deferred_handles;
}
+ ZoneList<Handle<Map> >* dependent_maps(DependentCode::DependencyGroup group) {
+ if (dependent_maps_[group] == NULL) {
+ dependent_maps_[group] = new(zone_) ZoneList<Handle<Map> >(2, zone_);
+ }
+ return dependent_maps_[group];
+ }
+
+ void CommitDependentMaps(Handle<Code> code);
+
+ void RollbackDependentMaps();
+
void SaveHandles() {
SaveHandle(&closure_);
SaveHandle(&shared_info_);
@@ -276,6 +283,26 @@ class CompilationInfo {
return result;
}
+ Handle<Foreign> object_wrapper() {
+ if (object_wrapper_.is_null()) {
+ object_wrapper_ =
+ isolate()->factory()->NewForeign(reinterpret_cast<Address>(this));
+ }
+ return object_wrapper_;
+ }
+
+ void AbortDueToDependentMap() {
+ mode_ = DEPENDENT_MAP_ABORT;
+ }
+
+ bool HasAbortedDueToDependentMap() {
+ return mode_ == DEPENDENT_MAP_ABORT;
+ }
+
+ protected:
+ CompilationInfo(Handle<Script> script, Zone* zone);
+ CompilationInfo(Handle<SharedFunctionInfo> shared_info, Zone* zone);
+ CompilationInfo(HydrogenCodeStub* stub, Isolate* isolate, Zone* zone);
private:
Isolate* isolate_;
@@ -289,7 +316,8 @@ class CompilationInfo {
BASE,
OPTIMIZE,
NONOPT,
- STUB
+ STUB,
+ DEPENDENT_MAP_ABORT
};
void Initialize(Isolate* isolate, Mode mode, Zone* zone);
@@ -369,6 +397,8 @@ class CompilationInfo {
DeferredHandles* deferred_handles_;
+ ZoneList<Handle<Map> >* dependent_maps_[DependentCode::kGroupCount];
+
template<typename T>
void SaveHandle(Handle<T> *object) {
if (!object->is_null()) {
@@ -387,6 +417,8 @@ class CompilationInfo {
// during graph optimization.
int opt_count_;
+ Handle<Foreign> object_wrapper_;
+
DISALLOW_COPY_AND_ASSIGN(CompilationInfo);
};
@@ -407,11 +439,18 @@ class CompilationInfoWithZone: public CompilationInfo {
: CompilationInfo(closure, &zone_),
zone_(closure->GetIsolate()),
zone_scope_(&zone_, DELETE_ON_EXIT) {}
- explicit CompilationInfoWithZone(HydrogenCodeStub* stub, Isolate* isolate)
+ CompilationInfoWithZone(HydrogenCodeStub* stub, Isolate* isolate)
: CompilationInfo(stub, isolate, &zone_),
zone_(isolate),
zone_scope_(&zone_, DELETE_ON_EXIT) {}
+ // Virtual destructor because a CompilationInfoWithZone has to exit the
+ // zone scope and get rid of dependent maps even when the destructor is
+ // called when cast as a CompilationInfo.
+ virtual ~CompilationInfoWithZone() {
+ RollbackDependentMaps();
+ }
+
private:
Zone zone_;
ZoneScope zone_scope_;
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/compiler.cc » ('j') | src/compiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698