Revision: 6453
Author: [email protected]
Date: Tue Jan 25 02:35:57 2011
Log: 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
http://code.google.com/p/v8/source/detail?r=6453
Modified:
/branches/bleeding_edge/src/arm/lithium-arm.cc
/branches/bleeding_edge/src/arm/lithium-arm.h
/branches/bleeding_edge/src/arm/lithium-codegen-arm.cc
/branches/bleeding_edge/src/ia32/lithium-ia32.cc
/branches/bleeding_edge/src/x64/lithium-codegen-x64.cc
/branches/bleeding_edge/src/x64/lithium-x64.cc
/branches/bleeding_edge/src/x64/lithium-x64.h
=======================================
--- /branches/bleeding_edge/src/arm/lithium-arm.cc Mon Jan 24 04:28:38 2011
+++ /branches/bleeding_edge/src/arm/lithium-arm.cc Tue Jan 25 02:35:57 2011
@@ -651,22 +651,6 @@
instr->set_environment(CreateEnvironment(hydrogen_env));
return 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,
@@ -678,8 +662,8 @@
if (hinstr->HasSideEffects()) {
ASSERT(hinstr->next()->IsSimulate());
HSimulate* sim = HSimulate::cast(hinstr->next());
- instr = SetInstructionPendingDeoptimizationEnvironment(
- instr, sim->ast_id());
+ ASSERT(pending_deoptimization_ast_id_ == AstNode::kNoNumber);
+ pending_deoptimization_ast_id_ = sim->ast_id();
}
// If instruction does not have side-effects lazy deoptimization
@@ -1826,12 +1810,11 @@
// If there is an instruction pending deoptimization environment create a
// lazy bailout instruction to capture the environment.
- if (pending_deoptimization_ast_id_ == instr->ast_id()) {
- LInstruction* result = new LLazyBailout;
- result = AssignEnvironment(result);
- instructions_pending_deoptimization_environment_->
- set_deoptimization_environment(result->environment());
- ClearInstructionPendingDeoptimizationEnvironment();
+ if (pending_deoptimization_ast_id_ != AstNode::kNoNumber) {
+ ASSERT(pending_deoptimization_ast_id_ == instr->ast_id());
+ LInstruction* lazy_bailout = new LLazyBailout;
+ LInstruction* result = AssignEnvironment(lazy_bailout);
+ pending_deoptimization_ast_id_ = AstNode::kNoNumber;
return result;
}
=======================================
--- /branches/bleeding_edge/src/arm/lithium-arm.h Mon Jan 24 04:28:38 2011
+++ /branches/bleeding_edge/src/arm/lithium-arm.h Tue Jan 25 02:35:57 2011
@@ -319,22 +319,11 @@
void set_hydrogen_value(HValue* value) { hydrogen_value_ = 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:
SetOncePointer<LEnvironment> environment_;
SetOncePointer<LPointerMap> pointer_map_;
HValue* hydrogen_value_;
- SetOncePointer<LEnvironment> deoptimization_environment_;
};
@@ -1963,10 +1952,6 @@
CanDeoptimize can_deoptimize = CANNOT_DEOPTIMIZE_EAGERLY);
LInstruction* MarkAsSaveDoubles(LInstruction* instr);
- LInstruction* SetInstructionPendingDeoptimizationEnvironment(
- LInstruction* instr, int ast_id);
- void ClearInstructionPendingDeoptimizationEnvironment();
-
LEnvironment* CreateEnvironment(HEnvironment* hydrogen_env);
void VisitInstruction(HInstruction* current);
=======================================
--- /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Mon Jan 24
04:28:38 2011
+++ /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Tue Jan 25
02:35:57 2011
@@ -601,16 +601,20 @@
// Create the environment to bailout to. If the call has side effects
// execution has to continue after the call otherwise execution can
continue
// from a previous bailout point repeating the call.
- LEnvironment* deoptimization_environment;
- if (instr->HasDeoptimizationEnvironment()) {
- deoptimization_environment = instr->deoptimization_environment();
+ LEnvironment* lazy_deoptimization_environment;
+ ASSERT(!instr->IsControl());
+ 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 {
- deoptimization_environment = instr->environment();
+ lazy_deoptimization_environment = instr->environment();
}
- RegisterEnvironmentForDeoptimization(deoptimization_environment);
+ RegisterEnvironmentForDeoptimization(lazy_deoptimization_environment);
RecordSafepoint(instr->pointer_map(),
- deoptimization_environment->deoptimization_index());
+ lazy_deoptimization_environment->deoptimization_index());
}
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-ia32.cc Mon Jan 24 05:29:39
2011
+++ /branches/bleeding_edge/src/ia32/lithium-ia32.cc Tue Jan 25 02:35:57
2011
@@ -1858,7 +1858,8 @@
// If there is an instruction pending deoptimization environment create a
// 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;
LInstruction* result = AssignEnvironment(lazy_bailout);
pending_deoptimization_ast_id_ = AstNode::kNoNumber;
=======================================
--- /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Tue Jan 25
02:10:36 2011
+++ /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Tue Jan 25
02:35:57 2011
@@ -374,16 +374,20 @@
// Create the environment to bailout to. If the call has side effects
// execution has to continue after the call otherwise execution can
continue
// from a previous bailout point repeating the call.
- LEnvironment* deoptimization_environment;
- if (instr->HasDeoptimizationEnvironment()) {
- deoptimization_environment = instr->deoptimization_environment();
+ LEnvironment* lazy_deoptimization_environment;
+ ASSERT(!instr->IsControl());
+ 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 {
- deoptimization_environment = instr->environment();
+ lazy_deoptimization_environment = instr->environment();
}
- RegisterEnvironmentForDeoptimization(deoptimization_environment);
+ RegisterEnvironmentForDeoptimization(lazy_deoptimization_environment);
RecordSafepoint(instr->pointer_map(),
- deoptimization_environment->deoptimization_index());
+ lazy_deoptimization_environment->deoptimization_index());
}
=======================================
--- /branches/bleeding_edge/src/x64/lithium-x64.cc Mon Jan 24 01:43:14 2011
+++ /branches/bleeding_edge/src/x64/lithium-x64.cc Tue Jan 25 02:35:57 2011
@@ -649,22 +649,6 @@
instr->set_environment(CreateEnvironment(hydrogen_env));
return 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,
@@ -676,8 +660,8 @@
if (hinstr->HasSideEffects()) {
ASSERT(hinstr->next()->IsSimulate());
HSimulate* sim = HSimulate::cast(hinstr->next());
- instr = SetInstructionPendingDeoptimizationEnvironment(
- instr, sim->ast_id());
+ ASSERT(pending_deoptimization_ast_id_ == AstNode::kNoNumber);
+ pending_deoptimization_ast_id_ = sim->ast_id();
}
// If instruction does not have side-effects lazy deoptimization
@@ -1569,12 +1553,11 @@
// If there is an instruction pending deoptimization environment create a
// 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;
LInstruction* result = AssignEnvironment(lazy_bailout);
- instructions_pending_deoptimization_environment_->
- set_deoptimization_environment(result->environment());
- ClearInstructionPendingDeoptimizationEnvironment();
+ pending_deoptimization_ast_id_ = AstNode::kNoNumber;
return result;
}
=======================================
--- /branches/bleeding_edge/src/x64/lithium-x64.h Mon Jan 24 01:43:14 2011
+++ /branches/bleeding_edge/src/x64/lithium-x64.h Tue Jan 25 02:35:57 2011
@@ -316,22 +316,11 @@
void set_hydrogen_value(HValue* value) { hydrogen_value_ = 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:
SetOncePointer<LEnvironment> environment_;
SetOncePointer<LPointerMap> pointer_map_;
HValue* hydrogen_value_;
- SetOncePointer<LEnvironment> deoptimization_environment_;
};
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev