Port to ARM and x64: Record the lazy deoptimization environmnent only at LLazyBailout-instructions.
This is a port of the change http://codereview.chromium.org/6348016/ to ARM and x64 platform. Review URL: http://codereview.chromium.org/6350011 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@6453 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
136db7b861
commit
2444e3f247
@ -653,22 +653,6 @@ LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LInstruction* LChunkBuilder::SetInstructionPendingDeoptimizationEnvironment(
|
|
||||||
LInstruction* instr, int ast_id) {
|
|
||||||
ASSERT(instructions_pending_deoptimization_environment_ == NULL);
|
|
||||||
ASSERT(pending_deoptimization_ast_id_ == AstNode::kNoNumber);
|
|
||||||
instructions_pending_deoptimization_environment_ = instr;
|
|
||||||
pending_deoptimization_ast_id_ = ast_id;
|
|
||||||
return instr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LChunkBuilder::ClearInstructionPendingDeoptimizationEnvironment() {
|
|
||||||
instructions_pending_deoptimization_environment_ = NULL;
|
|
||||||
pending_deoptimization_ast_id_ = AstNode::kNoNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr,
|
LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr,
|
||||||
HInstruction* hinstr,
|
HInstruction* hinstr,
|
||||||
CanDeoptimize can_deoptimize) {
|
CanDeoptimize can_deoptimize) {
|
||||||
@ -678,8 +662,8 @@ LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr,
|
|||||||
if (hinstr->HasSideEffects()) {
|
if (hinstr->HasSideEffects()) {
|
||||||
ASSERT(hinstr->next()->IsSimulate());
|
ASSERT(hinstr->next()->IsSimulate());
|
||||||
HSimulate* sim = HSimulate::cast(hinstr->next());
|
HSimulate* sim = HSimulate::cast(hinstr->next());
|
||||||
instr = SetInstructionPendingDeoptimizationEnvironment(
|
ASSERT(pending_deoptimization_ast_id_ == AstNode::kNoNumber);
|
||||||
instr, sim->ast_id());
|
pending_deoptimization_ast_id_ = sim->ast_id();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If instruction does not have side-effects lazy deoptimization
|
// If instruction does not have side-effects lazy deoptimization
|
||||||
@ -1826,12 +1810,11 @@ LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) {
|
|||||||
|
|
||||||
// If there is an instruction pending deoptimization environment create a
|
// If there is an instruction pending deoptimization environment create a
|
||||||
// lazy bailout instruction to capture the environment.
|
// lazy bailout instruction to capture the environment.
|
||||||
if (pending_deoptimization_ast_id_ == instr->ast_id()) {
|
if (pending_deoptimization_ast_id_ != AstNode::kNoNumber) {
|
||||||
LInstruction* result = new LLazyBailout;
|
ASSERT(pending_deoptimization_ast_id_ == instr->ast_id());
|
||||||
result = AssignEnvironment(result);
|
LInstruction* lazy_bailout = new LLazyBailout;
|
||||||
instructions_pending_deoptimization_environment_->
|
LInstruction* result = AssignEnvironment(lazy_bailout);
|
||||||
set_deoptimization_environment(result->environment());
|
pending_deoptimization_ast_id_ = AstNode::kNoNumber;
|
||||||
ClearInstructionPendingDeoptimizationEnvironment();
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,21 +320,10 @@ class LInstruction: public ZoneObject {
|
|||||||
void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; }
|
void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; }
|
||||||
HValue* hydrogen_value() const { return hydrogen_value_; }
|
HValue* hydrogen_value() const { return hydrogen_value_; }
|
||||||
|
|
||||||
void set_deoptimization_environment(LEnvironment* env) {
|
|
||||||
deoptimization_environment_.set(env);
|
|
||||||
}
|
|
||||||
LEnvironment* deoptimization_environment() const {
|
|
||||||
return deoptimization_environment_.get();
|
|
||||||
}
|
|
||||||
bool HasDeoptimizationEnvironment() const {
|
|
||||||
return deoptimization_environment_.is_set();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SetOncePointer<LEnvironment> environment_;
|
SetOncePointer<LEnvironment> environment_;
|
||||||
SetOncePointer<LPointerMap> pointer_map_;
|
SetOncePointer<LPointerMap> pointer_map_;
|
||||||
HValue* hydrogen_value_;
|
HValue* hydrogen_value_;
|
||||||
SetOncePointer<LEnvironment> deoptimization_environment_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -1963,10 +1952,6 @@ class LChunkBuilder BASE_EMBEDDED {
|
|||||||
CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
|
CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
|
||||||
LInstruction* MarkAsSaveDoubles(LInstruction* instr);
|
LInstruction* MarkAsSaveDoubles(LInstruction* instr);
|
||||||
|
|
||||||
LInstruction* SetInstructionPendingDeoptimizationEnvironment(
|
|
||||||
LInstruction* instr, int ast_id);
|
|
||||||
void ClearInstructionPendingDeoptimizationEnvironment();
|
|
||||||
|
|
||||||
LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env);
|
LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env);
|
||||||
|
|
||||||
void VisitInstruction(HInstruction* current);
|
void VisitInstruction(HInstruction* current);
|
||||||
|
@ -601,16 +601,20 @@ void LCodeGen::RegisterLazyDeoptimization(LInstruction* instr) {
|
|||||||
// Create the environment to bailout to. If the call has side effects
|
// Create the environment to bailout to. If the call has side effects
|
||||||
// execution has to continue after the call otherwise execution can continue
|
// execution has to continue after the call otherwise execution can continue
|
||||||
// from a previous bailout point repeating the call.
|
// from a previous bailout point repeating the call.
|
||||||
LEnvironment* deoptimization_environment;
|
LEnvironment* lazy_deoptimization_environment;
|
||||||
if (instr->HasDeoptimizationEnvironment()) {
|
ASSERT(!instr->IsControl());
|
||||||
deoptimization_environment = instr->deoptimization_environment();
|
ASSERT(instructions_->at(current_instruction_ + 1)->IsGap());
|
||||||
|
LInstruction* next_instr = instructions_->at(current_instruction_ + 2);
|
||||||
|
if (next_instr->IsLazyBailout()) {
|
||||||
|
ASSERT(next_instr->HasEnvironment());
|
||||||
|
lazy_deoptimization_environment = next_instr->environment();
|
||||||
} else {
|
} else {
|
||||||
deoptimization_environment = instr->environment();
|
lazy_deoptimization_environment = instr->environment();
|
||||||
}
|
}
|
||||||
|
|
||||||
RegisterEnvironmentForDeoptimization(deoptimization_environment);
|
RegisterEnvironmentForDeoptimization(lazy_deoptimization_environment);
|
||||||
RecordSafepoint(instr->pointer_map(),
|
RecordSafepoint(instr->pointer_map(),
|
||||||
deoptimization_environment->deoptimization_index());
|
lazy_deoptimization_environment->deoptimization_index());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1858,7 +1858,8 @@ LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) {
|
|||||||
|
|
||||||
// If there is an instruction pending deoptimization environment create a
|
// If there is an instruction pending deoptimization environment create a
|
||||||
// lazy bailout instruction to capture the environment.
|
// lazy bailout instruction to capture the environment.
|
||||||
if (pending_deoptimization_ast_id_ == instr->ast_id()) {
|
if (pending_deoptimization_ast_id_ != AstNode::kNoNumber) {
|
||||||
|
ASSERT(pending_deoptimization_ast_id_ == instr->ast_id());
|
||||||
LLazyBailout* lazy_bailout = new LLazyBailout;
|
LLazyBailout* lazy_bailout = new LLazyBailout;
|
||||||
LInstruction* result = AssignEnvironment(lazy_bailout);
|
LInstruction* result = AssignEnvironment(lazy_bailout);
|
||||||
pending_deoptimization_ast_id_ = AstNode::kNoNumber;
|
pending_deoptimization_ast_id_ = AstNode::kNoNumber;
|
||||||
|
@ -374,16 +374,20 @@ void LCodeGen::RegisterLazyDeoptimization(LInstruction* instr) {
|
|||||||
// Create the environment to bailout to. If the call has side effects
|
// Create the environment to bailout to. If the call has side effects
|
||||||
// execution has to continue after the call otherwise execution can continue
|
// execution has to continue after the call otherwise execution can continue
|
||||||
// from a previous bailout point repeating the call.
|
// from a previous bailout point repeating the call.
|
||||||
LEnvironment* deoptimization_environment;
|
LEnvironment* lazy_deoptimization_environment;
|
||||||
if (instr->HasDeoptimizationEnvironment()) {
|
ASSERT(!instr->IsControl());
|
||||||
deoptimization_environment = instr->deoptimization_environment();
|
ASSERT(instructions_->at(current_instruction_ + 1)->IsGap());
|
||||||
|
LInstruction* next_instr = instructions_->at(current_instruction_ + 2);
|
||||||
|
if (next_instr->IsLazyBailout()) {
|
||||||
|
ASSERT(next_instr->HasEnvironment());
|
||||||
|
lazy_deoptimization_environment = next_instr->environment();
|
||||||
} else {
|
} else {
|
||||||
deoptimization_environment = instr->environment();
|
lazy_deoptimization_environment = instr->environment();
|
||||||
}
|
}
|
||||||
|
|
||||||
RegisterEnvironmentForDeoptimization(deoptimization_environment);
|
RegisterEnvironmentForDeoptimization(lazy_deoptimization_environment);
|
||||||
RecordSafepoint(instr->pointer_map(),
|
RecordSafepoint(instr->pointer_map(),
|
||||||
deoptimization_environment->deoptimization_index());
|
lazy_deoptimization_environment->deoptimization_index());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -651,22 +651,6 @@ LInstruction* LChunkBuilder::AssignEnvironment(LInstruction* instr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LInstruction* LChunkBuilder::SetInstructionPendingDeoptimizationEnvironment(
|
|
||||||
LInstruction* instr, int ast_id) {
|
|
||||||
ASSERT(instructions_pending_deoptimization_environment_ == NULL);
|
|
||||||
ASSERT(pending_deoptimization_ast_id_ == AstNode::kNoNumber);
|
|
||||||
instructions_pending_deoptimization_environment_ = instr;
|
|
||||||
pending_deoptimization_ast_id_ = ast_id;
|
|
||||||
return instr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void LChunkBuilder::ClearInstructionPendingDeoptimizationEnvironment() {
|
|
||||||
instructions_pending_deoptimization_environment_ = NULL;
|
|
||||||
pending_deoptimization_ast_id_ = AstNode::kNoNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr,
|
LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr,
|
||||||
HInstruction* hinstr,
|
HInstruction* hinstr,
|
||||||
CanDeoptimize can_deoptimize) {
|
CanDeoptimize can_deoptimize) {
|
||||||
@ -676,8 +660,8 @@ LInstruction* LChunkBuilder::MarkAsCall(LInstruction* instr,
|
|||||||
if (hinstr->HasSideEffects()) {
|
if (hinstr->HasSideEffects()) {
|
||||||
ASSERT(hinstr->next()->IsSimulate());
|
ASSERT(hinstr->next()->IsSimulate());
|
||||||
HSimulate* sim = HSimulate::cast(hinstr->next());
|
HSimulate* sim = HSimulate::cast(hinstr->next());
|
||||||
instr = SetInstructionPendingDeoptimizationEnvironment(
|
ASSERT(pending_deoptimization_ast_id_ == AstNode::kNoNumber);
|
||||||
instr, sim->ast_id());
|
pending_deoptimization_ast_id_ = sim->ast_id();
|
||||||
}
|
}
|
||||||
|
|
||||||
// If instruction does not have side-effects lazy deoptimization
|
// If instruction does not have side-effects lazy deoptimization
|
||||||
@ -1569,12 +1553,11 @@ LInstruction* LChunkBuilder::DoSimulate(HSimulate* instr) {
|
|||||||
|
|
||||||
// If there is an instruction pending deoptimization environment create a
|
// If there is an instruction pending deoptimization environment create a
|
||||||
// lazy bailout instruction to capture the environment.
|
// lazy bailout instruction to capture the environment.
|
||||||
if (pending_deoptimization_ast_id_ == instr->ast_id()) {
|
if (pending_deoptimization_ast_id_ != AstNode::kNoNumber) {
|
||||||
|
ASSERT(pending_deoptimization_ast_id_ == instr->ast_id());
|
||||||
LLazyBailout* lazy_bailout = new LLazyBailout;
|
LLazyBailout* lazy_bailout = new LLazyBailout;
|
||||||
LInstruction* result = AssignEnvironment(lazy_bailout);
|
LInstruction* result = AssignEnvironment(lazy_bailout);
|
||||||
instructions_pending_deoptimization_environment_->
|
pending_deoptimization_ast_id_ = AstNode::kNoNumber;
|
||||||
set_deoptimization_environment(result->environment());
|
|
||||||
ClearInstructionPendingDeoptimizationEnvironment();
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,21 +317,10 @@ class LInstruction: public ZoneObject {
|
|||||||
void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; }
|
void set_hydrogen_value(HValue* value) { hydrogen_value_ = value; }
|
||||||
HValue* hydrogen_value() const { return hydrogen_value_; }
|
HValue* hydrogen_value() const { return hydrogen_value_; }
|
||||||
|
|
||||||
void set_deoptimization_environment(LEnvironment* env) {
|
|
||||||
deoptimization_environment_.set(env);
|
|
||||||
}
|
|
||||||
LEnvironment* deoptimization_environment() const {
|
|
||||||
return deoptimization_environment_.get();
|
|
||||||
}
|
|
||||||
bool HasDeoptimizationEnvironment() const {
|
|
||||||
return deoptimization_environment_.is_set();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SetOncePointer<LEnvironment> environment_;
|
SetOncePointer<LEnvironment> environment_;
|
||||||
SetOncePointer<LPointerMap> pointer_map_;
|
SetOncePointer<LPointerMap> pointer_map_;
|
||||||
HValue* hydrogen_value_;
|
HValue* hydrogen_value_;
|
||||||
SetOncePointer<LEnvironment> deoptimization_environment_;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user