Reviewers: Rodolph Perfetta (ARM), ulan,

Description:
A64: Move some deoptimization logic into a separate function

In two follow-up changes, I will add support for the
deoptimize-every-n-times flag, and run the now seperated code from all
DeoptimizeIf* variants

BUG=none
[email protected],[email protected]
LOG=n

Please review this at https://codereview.chromium.org/151523007/

SVN Base: https://v8.googlecode.com/svn/branches/experimental/a64

Affected files (+21, -5 lines):
  M src/a64/lithium-codegen-a64.h
  M 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 cf697bf771f0e607f83eea1f0947769f3108cdfb..3f1fccd02425e77e9eea7a656459aa6b9d8a1005 100644
--- a/src/a64/lithium-codegen-a64.cc
+++ b/src/a64/lithium-codegen-a64.cc
@@ -943,18 +943,19 @@ void LCodeGen::PopulateDeoptimizationLiteralsWithInlinedFunctions() {
 }


-void LCodeGen::Deoptimize(LEnvironment* environment,
-                          Deoptimizer::BailoutType bailout_type) {
+bool LCodeGen::DeoptimizeHeader(LEnvironment* environment) {
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;
   Address entry =
       Deoptimizer::GetDeoptimizationEntry(isolate(), id, bailout_type);

   if (entry == NULL) {
     Abort(kBailoutWasNotPrepared);
-    return;
+    return false;
   }

ASSERT(FLAG_deopt_every_n_times < 2); // Other values not supported on A64.
@@ -964,14 +965,28 @@ void LCodeGen::Deoptimize(LEnvironment* environment,
       info()->opt_count() == id) {
     ASSERT(frame_is_built_);
     __ Call(entry, RelocInfo::RUNTIME_ENTRY);
-    return;
+    return false;
   }

+  return true;
+}
+
+
+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();
+  Address entry =
+      Deoptimizer::GetDeoptimizationEntry(isolate(), id, bailout_type);
+
   if (info()->ShouldTrapOnDeopt()) {
     __ Debug("trap_on_deopt", __LINE__, BREAK);
   }

-
   ASSERT(info()->IsStub() || frame_is_built_);
// Go through jump table if we need to build frame, or restore caller doubles.
   if (frame_is_built_ && !info()->saves_caller_doubles()) {
Index: src/a64/lithium-codegen-a64.h
diff --git a/src/a64/lithium-codegen-a64.h b/src/a64/lithium-codegen-a64.h
index 4b1dff2869892622e635cd1c799338c49de87168..7dac0697c61cf8bfad7a13c98cf1f42fee11affb 100644
--- a/src/a64/lithium-codegen-a64.h
+++ b/src/a64/lithium-codegen-a64.h
@@ -218,6 +218,7 @@ class LCodeGen: public LCodeGenBase {
                                    Register temp,
                                    LOperand* index,
                                    String::Encoding encoding);
+  bool DeoptimizeHeader(LEnvironment* environment);
   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.

Reply via email to