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,
|
||||
Zone* zone,
|
||||
Zone* phase_zone)
|
||||
Zone* zone)
|
||||
: flags_(LanguageModeField::encode(CLASSIC_MODE)),
|
||||
script_(script),
|
||||
osr_ast_id_(BailoutId::None()) {
|
||||
Initialize(script->GetIsolate(), BASE, zone, phase_zone);
|
||||
Initialize(script->GetIsolate(), BASE, zone);
|
||||
}
|
||||
|
||||
|
||||
CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info,
|
||||
Zone* zone,
|
||||
Zone* phase_zone)
|
||||
Zone* zone)
|
||||
: flags_(LanguageModeField::encode(CLASSIC_MODE) | IsLazy::encode(true)),
|
||||
shared_info_(shared_info),
|
||||
script_(Handle<Script>(Script::cast(shared_info->script()))),
|
||||
osr_ast_id_(BailoutId::None()) {
|
||||
Initialize(script_->GetIsolate(), BASE, zone, phase_zone);
|
||||
Initialize(script_->GetIsolate(), BASE, zone);
|
||||
}
|
||||
|
||||
|
||||
CompilationInfo::CompilationInfo(Handle<JSFunction> closure,
|
||||
Zone* zone,
|
||||
Zone* phase_zone)
|
||||
Zone* zone)
|
||||
: flags_(LanguageModeField::encode(CLASSIC_MODE) | IsLazy::encode(true)),
|
||||
closure_(closure),
|
||||
shared_info_(Handle<SharedFunctionInfo>(closure->shared())),
|
||||
script_(Handle<Script>(Script::cast(shared_info_->script()))),
|
||||
context_(closure->context()),
|
||||
osr_ast_id_(BailoutId::None()) {
|
||||
Initialize(script_->GetIsolate(), BASE, zone, phase_zone);
|
||||
Initialize(script_->GetIsolate(), BASE, zone);
|
||||
}
|
||||
|
||||
|
||||
CompilationInfo::CompilationInfo(HydrogenCodeStub* stub,
|
||||
Isolate* isolate,
|
||||
Zone* zone,
|
||||
Zone* phase_zone)
|
||||
Zone* zone)
|
||||
: flags_(LanguageModeField::encode(CLASSIC_MODE) |
|
||||
IsLazy::encode(true)),
|
||||
osr_ast_id_(BailoutId::None()) {
|
||||
Initialize(isolate, STUB, zone, phase_zone);
|
||||
Initialize(isolate, STUB, zone);
|
||||
code_stub_ = stub;
|
||||
}
|
||||
|
||||
|
||||
void CompilationInfo::Initialize(Isolate* isolate,
|
||||
Mode mode,
|
||||
Zone* zone,
|
||||
Zone* phase_zone) {
|
||||
Zone* zone) {
|
||||
isolate_ = isolate;
|
||||
function_ = NULL;
|
||||
scope_ = NULL;
|
||||
@ -110,7 +105,6 @@ void CompilationInfo::Initialize(Isolate* isolate,
|
||||
extension_ = NULL;
|
||||
pre_parse_data_ = NULL;
|
||||
zone_ = zone;
|
||||
phase_zone_ = phase_zone;
|
||||
deferred_handles_ = NULL;
|
||||
code_stub_ = NULL;
|
||||
prologue_offset_ = kPrologueOffsetNotSet;
|
||||
@ -1228,12 +1222,10 @@ void Compiler::RecordFunctionCompilation(Logger::LogEventsAndTags tag,
|
||||
}
|
||||
|
||||
|
||||
CompilationPhase::CompilationPhase(const char* name,
|
||||
Isolate* isolate,
|
||||
Zone* zone)
|
||||
: name_(name), isolate_(isolate), zone_(zone) {
|
||||
CompilationPhase::CompilationPhase(const char* name, CompilationInfo* info)
|
||||
: name_(name), info_(info), zone_(info->isolate()) {
|
||||
if (FLAG_hydrogen_stats) {
|
||||
start_allocation_size_ = zone->allocation_size();
|
||||
info_zone_start_allocation_size_ = info->zone()->allocation_size();
|
||||
start_ticks_ = OS::Ticks();
|
||||
}
|
||||
}
|
||||
@ -1241,9 +1233,10 @@ CompilationPhase::CompilationPhase(const char* name,
|
||||
|
||||
CompilationPhase::~CompilationPhase() {
|
||||
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_;
|
||||
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.
|
||||
class CompilationInfo {
|
||||
public:
|
||||
CompilationInfo(Handle<JSFunction> closure, Zone* zone, Zone* phase_zone);
|
||||
CompilationInfo(Handle<JSFunction> closure, Zone* zone);
|
||||
virtual ~CompilationInfo();
|
||||
|
||||
Isolate* isolate() {
|
||||
@ -65,7 +65,6 @@ class CompilationInfo {
|
||||
return isolate_;
|
||||
}
|
||||
Zone* zone() { return zone_; }
|
||||
Zone* phase_zone() { return phase_zone_; }
|
||||
bool is_lazy() const { return IsLazy::decode(flags_); }
|
||||
bool is_eval() const { return IsEval::decode(flags_); }
|
||||
bool is_global() const { return IsGlobal::decode(flags_); }
|
||||
@ -303,15 +302,12 @@ class CompilationInfo {
|
||||
|
||||
protected:
|
||||
CompilationInfo(Handle<Script> script,
|
||||
Zone* zone,
|
||||
Zone* phase_zone);
|
||||
Zone* zone);
|
||||
CompilationInfo(Handle<SharedFunctionInfo> shared_info,
|
||||
Zone* zone,
|
||||
Zone* phase_zone);
|
||||
Zone* zone);
|
||||
CompilationInfo(HydrogenCodeStub* stub,
|
||||
Isolate* isolate,
|
||||
Zone* zone,
|
||||
Zone* phase_zone);
|
||||
Zone* zone);
|
||||
|
||||
private:
|
||||
Isolate* isolate_;
|
||||
@ -329,7 +325,7 @@ class CompilationInfo {
|
||||
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) {
|
||||
ASSERT(V8::UseCrankshaft());
|
||||
@ -403,9 +399,6 @@ class CompilationInfo {
|
||||
// The zone from which the compilation pipeline working on this
|
||||
// CompilationInfo allocates.
|
||||
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_;
|
||||
|
||||
@ -440,21 +433,17 @@ class CompilationInfo {
|
||||
class CompilationInfoWithZone: public CompilationInfo {
|
||||
public:
|
||||
explicit CompilationInfoWithZone(Handle<Script> script)
|
||||
: CompilationInfo(script, &zone_, &phase_zone_),
|
||||
zone_(script->GetIsolate()),
|
||||
phase_zone_(script->GetIsolate()) {}
|
||||
: CompilationInfo(script, &zone_),
|
||||
zone_(script->GetIsolate()) {}
|
||||
explicit CompilationInfoWithZone(Handle<SharedFunctionInfo> shared_info)
|
||||
: CompilationInfo(shared_info, &zone_, &phase_zone_),
|
||||
zone_(shared_info->GetIsolate()),
|
||||
phase_zone_(shared_info->GetIsolate()) {}
|
||||
: CompilationInfo(shared_info, &zone_),
|
||||
zone_(shared_info->GetIsolate()) {}
|
||||
explicit CompilationInfoWithZone(Handle<JSFunction> closure)
|
||||
: CompilationInfo(closure, &zone_, &phase_zone_),
|
||||
zone_(closure->GetIsolate()),
|
||||
phase_zone_(closure->GetIsolate()) {}
|
||||
: CompilationInfo(closure, &zone_),
|
||||
zone_(closure->GetIsolate()) {}
|
||||
CompilationInfoWithZone(HydrogenCodeStub* stub, Isolate* isolate)
|
||||
: CompilationInfo(stub, isolate, &zone_, &phase_zone_),
|
||||
zone_(isolate),
|
||||
phase_zone_(isolate) {}
|
||||
: CompilationInfo(stub, isolate, &zone_),
|
||||
zone_(isolate) {}
|
||||
|
||||
// Virtual destructor because a CompilationInfoWithZone has to exit the
|
||||
// zone scope and get rid of dependent maps even when the destructor is
|
||||
@ -465,7 +454,6 @@ class CompilationInfoWithZone: public CompilationInfo {
|
||||
|
||||
private:
|
||||
Zone zone_;
|
||||
Zone phase_zone_;
|
||||
};
|
||||
|
||||
|
||||
@ -631,21 +619,21 @@ class Compiler : public AllStatic {
|
||||
|
||||
class CompilationPhase BASE_EMBEDDED {
|
||||
public:
|
||||
CompilationPhase(const char* name, Isolate* isolate, Zone* zone);
|
||||
CompilationPhase(const char* name, CompilationInfo* info);
|
||||
~CompilationPhase();
|
||||
|
||||
protected:
|
||||
bool ShouldProduceTraceOutput() const;
|
||||
|
||||
const char* name() const { return name_; }
|
||||
Isolate* isolate() const { return isolate_; }
|
||||
Zone* zone() const { return zone_; }
|
||||
Isolate* isolate() const { return info_->isolate(); }
|
||||
Zone* zone() { return &zone_; }
|
||||
|
||||
private:
|
||||
const char* name_;
|
||||
Isolate* isolate_;
|
||||
Zone* zone_;
|
||||
unsigned start_allocation_size_;
|
||||
CompilationInfo* info_;
|
||||
Zone zone_;
|
||||
unsigned info_zone_start_allocation_size_;
|
||||
int64_t start_ticks_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CompilationPhase);
|
||||
|
@ -963,7 +963,7 @@ void HGraphBuilder::LoopBuilder::EndBody() {
|
||||
HGraph* HGraphBuilder::CreateGraph() {
|
||||
graph_ = new(zone()) HGraph(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());
|
||||
if (!BuildGraph()) return NULL;
|
||||
graph()->FinalizeUniqueValueIds();
|
||||
@ -2384,7 +2384,7 @@ class PostorderProcessor : public ZoneObject {
|
||||
|
||||
|
||||
void HGraph::OrderBlocks() {
|
||||
CompilationPhase phase("H_Block ordering", isolate(), zone());
|
||||
CompilationPhase phase("H_Block ordering", info());
|
||||
BitVector visited(blocks_.length(), zone());
|
||||
|
||||
ZoneList<HBasicBlock*> reverse_result(8, zone());
|
||||
@ -7932,7 +7932,7 @@ bool HOptimizedGraphBuilder::TryInline(CallKind call_kind,
|
||||
}
|
||||
|
||||
// Parse and allocate variables.
|
||||
CompilationInfo target_info(target, zone(), current_info()->phase_zone());
|
||||
CompilationInfo target_info(target, zone());
|
||||
Handle<SharedFunctionInfo> target_shared(target->shared());
|
||||
if (!Parser::Parse(&target_info) || !Scope::Analyze(&target_info)) {
|
||||
if (target_info.isolate()->has_pending_exception()) {
|
||||
|
@ -1958,7 +1958,7 @@ class HStatistics: public Malloced {
|
||||
class HPhase : public CompilationPhase {
|
||||
public:
|
||||
HPhase(const char* name, HGraph* graph)
|
||||
: CompilationPhase(name, graph->isolate(), graph->zone()),
|
||||
: CompilationPhase(name, graph->info()),
|
||||
graph_(graph) { }
|
||||
~HPhase();
|
||||
|
||||
|
@ -648,7 +648,7 @@ class LAllocator BASE_EMBEDDED {
|
||||
class LAllocatorPhase : public CompilationPhase {
|
||||
public:
|
||||
LAllocatorPhase(const char* name, LAllocator* allocator)
|
||||
: CompilationPhase(name, allocator->isolate(), allocator->zone()),
|
||||
: CompilationPhase(name, allocator->graph()->info()),
|
||||
allocator_(allocator) { }
|
||||
~LAllocatorPhase();
|
||||
|
||||
|
@ -762,7 +762,7 @@ enum NumberUntagDMode {
|
||||
class LPhase : public CompilationPhase {
|
||||
public:
|
||||
LPhase(const char* name, LChunk* chunk)
|
||||
: CompilationPhase(name, chunk->isolate(), chunk->zone()),
|
||||
: CompilationPhase(name, chunk->info()),
|
||||
chunk_(chunk) { }
|
||||
~LPhase();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user