Move phase_zone from CompilationInfo to CompilationPhase.
Each CompilationPhase has its own zone, used for phase local allocations. The zone of CompilationInfo should only be used for non phase local allocations. R=danno@chromium.org BUG= Review URL: https://codereview.chromium.org/18022002 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15352 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
63812f9dc3
commit
073b1d1dfb
@ -54,55 +54,50 @@ namespace internal {
|
|||||||
|
|
||||||
|
|
||||||
CompilationInfo::CompilationInfo(Handle<Script> script,
|
CompilationInfo::CompilationInfo(Handle<Script> script,
|
||||||
Zone* zone,
|
Zone* zone)
|
||||||
Zone* phase_zone)
|
|
||||||
: flags_(LanguageModeField::encode(CLASSIC_MODE)),
|
: flags_(LanguageModeField::encode(CLASSIC_MODE)),
|
||||||
script_(script),
|
script_(script),
|
||||||
osr_ast_id_(BailoutId::None()) {
|
osr_ast_id_(BailoutId::None()) {
|
||||||
Initialize(script->GetIsolate(), BASE, zone, phase_zone);
|
Initialize(script->GetIsolate(), BASE, zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info,
|
CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info,
|
||||||
Zone* zone,
|
Zone* zone)
|
||||||
Zone* phase_zone)
|
|
||||||
: flags_(LanguageModeField::encode(CLASSIC_MODE) | IsLazy::encode(true)),
|
: flags_(LanguageModeField::encode(CLASSIC_MODE) | IsLazy::encode(true)),
|
||||||
shared_info_(shared_info),
|
shared_info_(shared_info),
|
||||||
script_(Handle<Script>(Script::cast(shared_info->script()))),
|
script_(Handle<Script>(Script::cast(shared_info->script()))),
|
||||||
osr_ast_id_(BailoutId::None()) {
|
osr_ast_id_(BailoutId::None()) {
|
||||||
Initialize(script_->GetIsolate(), BASE, zone, phase_zone);
|
Initialize(script_->GetIsolate(), BASE, zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CompilationInfo::CompilationInfo(Handle<JSFunction> closure,
|
CompilationInfo::CompilationInfo(Handle<JSFunction> closure,
|
||||||
Zone* zone,
|
Zone* zone)
|
||||||
Zone* phase_zone)
|
|
||||||
: flags_(LanguageModeField::encode(CLASSIC_MODE) | IsLazy::encode(true)),
|
: flags_(LanguageModeField::encode(CLASSIC_MODE) | IsLazy::encode(true)),
|
||||||
closure_(closure),
|
closure_(closure),
|
||||||
shared_info_(Handle<SharedFunctionInfo>(closure->shared())),
|
shared_info_(Handle<SharedFunctionInfo>(closure->shared())),
|
||||||
script_(Handle<Script>(Script::cast(shared_info_->script()))),
|
script_(Handle<Script>(Script::cast(shared_info_->script()))),
|
||||||
context_(closure->context()),
|
context_(closure->context()),
|
||||||
osr_ast_id_(BailoutId::None()) {
|
osr_ast_id_(BailoutId::None()) {
|
||||||
Initialize(script_->GetIsolate(), BASE, zone, phase_zone);
|
Initialize(script_->GetIsolate(), BASE, zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CompilationInfo::CompilationInfo(HydrogenCodeStub* stub,
|
CompilationInfo::CompilationInfo(HydrogenCodeStub* stub,
|
||||||
Isolate* isolate,
|
Isolate* isolate,
|
||||||
Zone* zone,
|
Zone* zone)
|
||||||
Zone* phase_zone)
|
|
||||||
: flags_(LanguageModeField::encode(CLASSIC_MODE) |
|
: flags_(LanguageModeField::encode(CLASSIC_MODE) |
|
||||||
IsLazy::encode(true)),
|
IsLazy::encode(true)),
|
||||||
osr_ast_id_(BailoutId::None()) {
|
osr_ast_id_(BailoutId::None()) {
|
||||||
Initialize(isolate, STUB, zone, phase_zone);
|
Initialize(isolate, STUB, zone);
|
||||||
code_stub_ = stub;
|
code_stub_ = stub;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CompilationInfo::Initialize(Isolate* isolate,
|
void CompilationInfo::Initialize(Isolate* isolate,
|
||||||
Mode mode,
|
Mode mode,
|
||||||
Zone* zone,
|
Zone* zone) {
|
||||||
Zone* phase_zone) {
|
|
||||||
isolate_ = isolate;
|
isolate_ = isolate;
|
||||||
function_ = NULL;
|
function_ = NULL;
|
||||||
scope_ = NULL;
|
scope_ = NULL;
|
||||||
@ -110,7 +105,6 @@ void CompilationInfo::Initialize(Isolate* isolate,
|
|||||||
extension_ = NULL;
|
extension_ = NULL;
|
||||||
pre_parse_data_ = NULL;
|
pre_parse_data_ = NULL;
|
||||||
zone_ = zone;
|
zone_ = zone;
|
||||||
phase_zone_ = phase_zone;
|
|
||||||
deferred_handles_ = NULL;
|
deferred_handles_ = NULL;
|
||||||
code_stub_ = NULL;
|
code_stub_ = NULL;
|
||||||
prologue_offset_ = kPrologueOffsetNotSet;
|
prologue_offset_ = kPrologueOffsetNotSet;
|
||||||
@ -1228,12 +1222,10 @@ void Compiler::RecordFunctionCompilation(Logger::LogEventsAndTags tag,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
CompilationPhase::CompilationPhase(const char* name,
|
CompilationPhase::CompilationPhase(const char* name, CompilationInfo* info)
|
||||||
Isolate* isolate,
|
: name_(name), info_(info), zone_(info->isolate()) {
|
||||||
Zone* zone)
|
|
||||||
: name_(name), isolate_(isolate), zone_(zone) {
|
|
||||||
if (FLAG_hydrogen_stats) {
|
if (FLAG_hydrogen_stats) {
|
||||||
start_allocation_size_ = zone->allocation_size();
|
info_zone_start_allocation_size_ = info->zone()->allocation_size();
|
||||||
start_ticks_ = OS::Ticks();
|
start_ticks_ = OS::Ticks();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1241,9 +1233,10 @@ CompilationPhase::CompilationPhase(const char* name,
|
|||||||
|
|
||||||
CompilationPhase::~CompilationPhase() {
|
CompilationPhase::~CompilationPhase() {
|
||||||
if (FLAG_hydrogen_stats) {
|
if (FLAG_hydrogen_stats) {
|
||||||
unsigned size = zone()->allocation_size() - start_allocation_size_;
|
unsigned size = zone()->allocation_size();
|
||||||
|
size += info_->zone()->allocation_size() - info_zone_start_allocation_size_;
|
||||||
int64_t ticks = OS::Ticks() - start_ticks_;
|
int64_t ticks = OS::Ticks() - start_ticks_;
|
||||||
isolate_->GetHStatistics()->SaveTiming(name_, ticks, size);
|
isolate()->GetHStatistics()->SaveTiming(name_, ticks, size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ struct OffsetRange {
|
|||||||
// is constructed based on the resources available at compile-time.
|
// is constructed based on the resources available at compile-time.
|
||||||
class CompilationInfo {
|
class CompilationInfo {
|
||||||
public:
|
public:
|
||||||
CompilationInfo(Handle<JSFunction> closure, Zone* zone, Zone* phase_zone);
|
CompilationInfo(Handle<JSFunction> closure, Zone* zone);
|
||||||
virtual ~CompilationInfo();
|
virtual ~CompilationInfo();
|
||||||
|
|
||||||
Isolate* isolate() {
|
Isolate* isolate() {
|
||||||
@ -65,7 +65,6 @@ class CompilationInfo {
|
|||||||
return isolate_;
|
return isolate_;
|
||||||
}
|
}
|
||||||
Zone* zone() { return zone_; }
|
Zone* zone() { return zone_; }
|
||||||
Zone* phase_zone() { return phase_zone_; }
|
|
||||||
bool is_lazy() const { return IsLazy::decode(flags_); }
|
bool is_lazy() const { return IsLazy::decode(flags_); }
|
||||||
bool is_eval() const { return IsEval::decode(flags_); }
|
bool is_eval() const { return IsEval::decode(flags_); }
|
||||||
bool is_global() const { return IsGlobal::decode(flags_); }
|
bool is_global() const { return IsGlobal::decode(flags_); }
|
||||||
@ -303,15 +302,12 @@ class CompilationInfo {
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
CompilationInfo(Handle<Script> script,
|
CompilationInfo(Handle<Script> script,
|
||||||
Zone* zone,
|
Zone* zone);
|
||||||
Zone* phase_zone);
|
|
||||||
CompilationInfo(Handle<SharedFunctionInfo> shared_info,
|
CompilationInfo(Handle<SharedFunctionInfo> shared_info,
|
||||||
Zone* zone,
|
Zone* zone);
|
||||||
Zone* phase_zone);
|
|
||||||
CompilationInfo(HydrogenCodeStub* stub,
|
CompilationInfo(HydrogenCodeStub* stub,
|
||||||
Isolate* isolate,
|
Isolate* isolate,
|
||||||
Zone* zone,
|
Zone* zone);
|
||||||
Zone* phase_zone);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Isolate* isolate_;
|
Isolate* isolate_;
|
||||||
@ -329,7 +325,7 @@ class CompilationInfo {
|
|||||||
DEPENDENCY_CHANGE_ABORT
|
DEPENDENCY_CHANGE_ABORT
|
||||||
};
|
};
|
||||||
|
|
||||||
void Initialize(Isolate* isolate, Mode mode, Zone* zone, Zone* phase_zone);
|
void Initialize(Isolate* isolate, Mode mode, Zone* zone);
|
||||||
|
|
||||||
void SetMode(Mode mode) {
|
void SetMode(Mode mode) {
|
||||||
ASSERT(V8::UseCrankshaft());
|
ASSERT(V8::UseCrankshaft());
|
||||||
@ -403,9 +399,6 @@ class CompilationInfo {
|
|||||||
// The zone from which the compilation pipeline working on this
|
// The zone from which the compilation pipeline working on this
|
||||||
// CompilationInfo allocates.
|
// CompilationInfo allocates.
|
||||||
Zone* zone_;
|
Zone* zone_;
|
||||||
// The phase zone where allocations local to a specific phase are
|
|
||||||
// performed; be aware that this zone is cleared after each phase
|
|
||||||
Zone* phase_zone_;
|
|
||||||
|
|
||||||
DeferredHandles* deferred_handles_;
|
DeferredHandles* deferred_handles_;
|
||||||
|
|
||||||
@ -440,21 +433,17 @@ class CompilationInfo {
|
|||||||
class CompilationInfoWithZone: public CompilationInfo {
|
class CompilationInfoWithZone: public CompilationInfo {
|
||||||
public:
|
public:
|
||||||
explicit CompilationInfoWithZone(Handle<Script> script)
|
explicit CompilationInfoWithZone(Handle<Script> script)
|
||||||
: CompilationInfo(script, &zone_, &phase_zone_),
|
: CompilationInfo(script, &zone_),
|
||||||
zone_(script->GetIsolate()),
|
zone_(script->GetIsolate()) {}
|
||||||
phase_zone_(script->GetIsolate()) {}
|
|
||||||
explicit CompilationInfoWithZone(Handle<SharedFunctionInfo> shared_info)
|
explicit CompilationInfoWithZone(Handle<SharedFunctionInfo> shared_info)
|
||||||
: CompilationInfo(shared_info, &zone_, &phase_zone_),
|
: CompilationInfo(shared_info, &zone_),
|
||||||
zone_(shared_info->GetIsolate()),
|
zone_(shared_info->GetIsolate()) {}
|
||||||
phase_zone_(shared_info->GetIsolate()) {}
|
|
||||||
explicit CompilationInfoWithZone(Handle<JSFunction> closure)
|
explicit CompilationInfoWithZone(Handle<JSFunction> closure)
|
||||||
: CompilationInfo(closure, &zone_, &phase_zone_),
|
: CompilationInfo(closure, &zone_),
|
||||||
zone_(closure->GetIsolate()),
|
zone_(closure->GetIsolate()) {}
|
||||||
phase_zone_(closure->GetIsolate()) {}
|
|
||||||
CompilationInfoWithZone(HydrogenCodeStub* stub, Isolate* isolate)
|
CompilationInfoWithZone(HydrogenCodeStub* stub, Isolate* isolate)
|
||||||
: CompilationInfo(stub, isolate, &zone_, &phase_zone_),
|
: CompilationInfo(stub, isolate, &zone_),
|
||||||
zone_(isolate),
|
zone_(isolate) {}
|
||||||
phase_zone_(isolate) {}
|
|
||||||
|
|
||||||
// Virtual destructor because a CompilationInfoWithZone has to exit the
|
// Virtual destructor because a CompilationInfoWithZone has to exit the
|
||||||
// zone scope and get rid of dependent maps even when the destructor is
|
// zone scope and get rid of dependent maps even when the destructor is
|
||||||
@ -465,7 +454,6 @@ class CompilationInfoWithZone: public CompilationInfo {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Zone zone_;
|
Zone zone_;
|
||||||
Zone phase_zone_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -631,21 +619,21 @@ class Compiler : public AllStatic {
|
|||||||
|
|
||||||
class CompilationPhase BASE_EMBEDDED {
|
class CompilationPhase BASE_EMBEDDED {
|
||||||
public:
|
public:
|
||||||
CompilationPhase(const char* name, Isolate* isolate, Zone* zone);
|
CompilationPhase(const char* name, CompilationInfo* info);
|
||||||
~CompilationPhase();
|
~CompilationPhase();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool ShouldProduceTraceOutput() const;
|
bool ShouldProduceTraceOutput() const;
|
||||||
|
|
||||||
const char* name() const { return name_; }
|
const char* name() const { return name_; }
|
||||||
Isolate* isolate() const { return isolate_; }
|
Isolate* isolate() const { return info_->isolate(); }
|
||||||
Zone* zone() const { return zone_; }
|
Zone* zone() { return &zone_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const char* name_;
|
const char* name_;
|
||||||
Isolate* isolate_;
|
CompilationInfo* info_;
|
||||||
Zone* zone_;
|
Zone zone_;
|
||||||
unsigned start_allocation_size_;
|
unsigned info_zone_start_allocation_size_;
|
||||||
int64_t start_ticks_;
|
int64_t start_ticks_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(CompilationPhase);
|
DISALLOW_COPY_AND_ASSIGN(CompilationPhase);
|
||||||
|
@ -963,7 +963,7 @@ void HGraphBuilder::LoopBuilder::EndBody() {
|
|||||||
HGraph* HGraphBuilder::CreateGraph() {
|
HGraph* HGraphBuilder::CreateGraph() {
|
||||||
graph_ = new(zone()) HGraph(info_);
|
graph_ = new(zone()) HGraph(info_);
|
||||||
if (FLAG_hydrogen_stats) isolate()->GetHStatistics()->Initialize(info_);
|
if (FLAG_hydrogen_stats) isolate()->GetHStatistics()->Initialize(info_);
|
||||||
CompilationPhase phase("H_Block building", isolate(), zone());
|
CompilationPhase phase("H_Block building", info_);
|
||||||
set_current_block(graph()->entry_block());
|
set_current_block(graph()->entry_block());
|
||||||
if (!BuildGraph()) return NULL;
|
if (!BuildGraph()) return NULL;
|
||||||
graph()->FinalizeUniqueValueIds();
|
graph()->FinalizeUniqueValueIds();
|
||||||
@ -2384,7 +2384,7 @@ class PostorderProcessor : public ZoneObject {
|
|||||||
|
|
||||||
|
|
||||||
void HGraph::OrderBlocks() {
|
void HGraph::OrderBlocks() {
|
||||||
CompilationPhase phase("H_Block ordering", isolate(), zone());
|
CompilationPhase phase("H_Block ordering", info());
|
||||||
BitVector visited(blocks_.length(), zone());
|
BitVector visited(blocks_.length(), zone());
|
||||||
|
|
||||||
ZoneList<HBasicBlock*> reverse_result(8, zone());
|
ZoneList<HBasicBlock*> reverse_result(8, zone());
|
||||||
@ -7932,7 +7932,7 @@ bool HOptimizedGraphBuilder::TryInline(CallKind call_kind,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Parse and allocate variables.
|
// Parse and allocate variables.
|
||||||
CompilationInfo target_info(target, zone(), current_info()->phase_zone());
|
CompilationInfo target_info(target, zone());
|
||||||
Handle<SharedFunctionInfo> target_shared(target->shared());
|
Handle<SharedFunctionInfo> target_shared(target->shared());
|
||||||
if (!Parser::Parse(&target_info) || !Scope::Analyze(&target_info)) {
|
if (!Parser::Parse(&target_info) || !Scope::Analyze(&target_info)) {
|
||||||
if (target_info.isolate()->has_pending_exception()) {
|
if (target_info.isolate()->has_pending_exception()) {
|
||||||
|
@ -1958,7 +1958,7 @@ class HStatistics: public Malloced {
|
|||||||
class HPhase : public CompilationPhase {
|
class HPhase : public CompilationPhase {
|
||||||
public:
|
public:
|
||||||
HPhase(const char* name, HGraph* graph)
|
HPhase(const char* name, HGraph* graph)
|
||||||
: CompilationPhase(name, graph->isolate(), graph->zone()),
|
: CompilationPhase(name, graph->info()),
|
||||||
graph_(graph) { }
|
graph_(graph) { }
|
||||||
~HPhase();
|
~HPhase();
|
||||||
|
|
||||||
|
@ -648,7 +648,7 @@ class LAllocator BASE_EMBEDDED {
|
|||||||
class LAllocatorPhase : public CompilationPhase {
|
class LAllocatorPhase : public CompilationPhase {
|
||||||
public:
|
public:
|
||||||
LAllocatorPhase(const char* name, LAllocator* allocator)
|
LAllocatorPhase(const char* name, LAllocator* allocator)
|
||||||
: CompilationPhase(name, allocator->isolate(), allocator->zone()),
|
: CompilationPhase(name, allocator->graph()->info()),
|
||||||
allocator_(allocator) { }
|
allocator_(allocator) { }
|
||||||
~LAllocatorPhase();
|
~LAllocatorPhase();
|
||||||
|
|
||||||
|
@ -762,7 +762,7 @@ enum NumberUntagDMode {
|
|||||||
class LPhase : public CompilationPhase {
|
class LPhase : public CompilationPhase {
|
||||||
public:
|
public:
|
||||||
LPhase(const char* name, LChunk* chunk)
|
LPhase(const char* name, LChunk* chunk)
|
||||||
: CompilationPhase(name, chunk->isolate(), chunk->zone()),
|
: CompilationPhase(name, chunk->info()),
|
||||||
chunk_(chunk) { }
|
chunk_(chunk) { }
|
||||||
~LPhase();
|
~LPhase();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user