Reviewers: Rodolph Perfetta (ARM), ulan,
Description:
A64: Hook up --deopt-every-n-times to all Deoptimize methods
BUG=none
[email protected],[email protected]
LOG=n
Please review this at https://codereview.chromium.org/157803008/
SVN Base: https://v8.googlecode.com/svn/branches/experimental/a64
Affected files (+27, -17 lines):
src/a64/lithium-codegen-a64.h
src/a64/lithium-codegen-a64.cc
Index: src/a64/lithium-codegen-a64.cc
diff --git a/src/a64/lithium-codegen-a64.cc b/src/a64/lithium-codegen-a64.cc
index
8f32806a3417adfe282d983a7a61fda6cd70ad86..71baee7fd0776ccd0bdc255369c7ec4f7aab4b8b
100644
--- a/src/a64/lithium-codegen-a64.cc
+++ b/src/a64/lithium-codegen-a64.cc
@@ -966,19 +966,22 @@ void
LCodeGen::PopulateDeoptimizationLiteralsWithInlinedFunctions() {
}
-bool LCodeGen::DeoptimizeHeader(LEnvironment* environment) {
+Deoptimizer::BailoutType LCodeGen::DeoptimizeHeader(
+ LEnvironment* environment,
+ Deoptimizer::BailoutType* override_bailout_type) {
RegisterEnvironmentForDeoptimization(environment,
Safepoint::kNoLazyDeopt);
ASSERT(environment->HasBeenRegistered());
ASSERT(info()->IsOptimizing() || info()->IsStub());
int id = environment->deoptimization_index();
- Deoptimizer::BailoutType bailout_type = info()->IsStub() ?
Deoptimizer::LAZY
- :
Deoptimizer::EAGER;
+ Deoptimizer::BailoutType bailout_type =
+ info()->IsStub() ? Deoptimizer::LAZY : Deoptimizer::EAGER;
+ if (override_bailout_type) bailout_type = *override_bailout_type;
Address entry =
Deoptimizer::GetDeoptimizationEntry(isolate(), id, bailout_type);
if (entry == NULL) {
Abort(kBailoutWasNotPrepared);
- return false;
+ return bailout_type;
}
if (FLAG_deopt_every_n_times != 0 && !info()->IsStub()) {
@@ -1002,14 +1005,12 @@ bool LCodeGen::DeoptimizeHeader(LEnvironment*
environment) {
__ Pop(x0, x1);
}
- return true;
+ return bailout_type;
}
void LCodeGen::Deoptimize(LEnvironment* environment,
Deoptimizer::BailoutType bailout_type) {
- if (!DeoptimizeHeader(environment)) return;
-
ASSERT(environment->HasBeenRegistered());
ASSERT(info()->IsOptimizing() || info()->IsStub());
int id = environment->deoptimization_index();
@@ -1042,32 +1043,34 @@ void LCodeGen::Deoptimize(LEnvironment* environment,
void LCodeGen::Deoptimize(LEnvironment* environment) {
- Deoptimizer::BailoutType bailout_type = info()->IsStub() ?
Deoptimizer::LAZY
- :
Deoptimizer::EAGER;
+ Deoptimizer::BailoutType bailout_type = DeoptimizeHeader(environment,
NULL);
Deoptimize(environment, bailout_type);
}
void LCodeGen::DeoptimizeIf(Condition cond, LEnvironment* environment) {
Label dont_deopt;
+ Deoptimizer::BailoutType bailout_type = DeoptimizeHeader(environment,
NULL);
__ B(InvertCondition(cond), &dont_deopt);
- Deoptimize(environment);
+ Deoptimize(environment, bailout_type);
__ Bind(&dont_deopt);
}
void LCodeGen::DeoptimizeIfZero(Register rt, LEnvironment* environment) {
Label dont_deopt;
+ Deoptimizer::BailoutType bailout_type = DeoptimizeHeader(environment,
NULL);
__ Cbnz(rt, &dont_deopt);
- Deoptimize(environment);
+ Deoptimize(environment, bailout_type);
__ Bind(&dont_deopt);
}
void LCodeGen::DeoptimizeIfNegative(Register rt, LEnvironment*
environment) {
Label dont_deopt;
+ Deoptimizer::BailoutType bailout_type = DeoptimizeHeader(environment,
NULL);
__ Tbz(rt, rt.Is64Bits() ? kXSignBit : kWSignBit, &dont_deopt);
- Deoptimize(environment);
+ Deoptimize(environment, bailout_type);
__ Bind(&dont_deopt);
}
@@ -1075,16 +1078,18 @@ void LCodeGen::DeoptimizeIfNegative(Register rt,
LEnvironment* environment) {
void LCodeGen::DeoptimizeIfSmi(Register rt,
LEnvironment* environment) {
Label dont_deopt;
+ Deoptimizer::BailoutType bailout_type = DeoptimizeHeader(environment,
NULL);
__ JumpIfNotSmi(rt, &dont_deopt);
- Deoptimize(environment);
+ Deoptimize(environment, bailout_type);
__ Bind(&dont_deopt);
}
void LCodeGen::DeoptimizeIfNotSmi(Register rt, LEnvironment* environment) {
Label dont_deopt;
+ Deoptimizer::BailoutType bailout_type = DeoptimizeHeader(environment,
NULL);
__ JumpIfSmi(rt, &dont_deopt);
- Deoptimize(environment);
+ Deoptimize(environment, bailout_type);
__ Bind(&dont_deopt);
}
@@ -1093,8 +1098,9 @@ void LCodeGen::DeoptimizeIfRoot(Register rt,
Heap::RootListIndex index,
LEnvironment* environment) {
Label dont_deopt;
+ Deoptimizer::BailoutType bailout_type = DeoptimizeHeader(environment,
NULL);
__ JumpIfNotRoot(rt, index, &dont_deopt);
- Deoptimize(environment);
+ Deoptimize(environment, bailout_type);
__ Bind(&dont_deopt);
}
@@ -1103,8 +1109,9 @@ void LCodeGen::DeoptimizeIfNotRoot(Register rt,
Heap::RootListIndex index,
LEnvironment* environment) {
Label dont_deopt;
+ Deoptimizer::BailoutType bailout_type = DeoptimizeHeader(environment,
NULL);
__ JumpIfRoot(rt, index, &dont_deopt);
- Deoptimize(environment);
+ Deoptimize(environment, bailout_type);
__ Bind(&dont_deopt);
}
@@ -2555,6 +2562,7 @@ void LCodeGen::DoDeoptimize(LDeoptimize* instr) {
}
Comment(";;; deoptimize: %s", instr->hydrogen()->reason());
+ DeoptimizeHeader(instr->environment(), &type);
Deoptimize(instr->environment(), type);
}
Index: src/a64/lithium-codegen-a64.h
diff --git a/src/a64/lithium-codegen-a64.h b/src/a64/lithium-codegen-a64.h
index
379d3b6b262c62f8a1a3ce1f2fff85989e51be7a..006165157f46740fd44428a3a4322eb64c56ad7b
100644
--- a/src/a64/lithium-codegen-a64.h
+++ b/src/a64/lithium-codegen-a64.h
@@ -218,7 +218,9 @@ class LCodeGen: public LCodeGenBase {
Register temp,
LOperand* index,
String::Encoding encoding);
- bool DeoptimizeHeader(LEnvironment* environment);
+ Deoptimizer::BailoutType DeoptimizeHeader(
+ LEnvironment* environment,
+ Deoptimizer::BailoutType* override_bailout_type);
void Deoptimize(LEnvironment* environment);
void Deoptimize(LEnvironment* environment,
Deoptimizer::BailoutType bailout_type);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.