Revision: 21308
Author:   [email protected]
Date:     Wed May 14 13:19:52 2014 UTC
Log:      Merged bleeding edge r20949 into 3.25 branch.

Mark the simulate before EnterInlined with BailoutId::None(), and set ReturnId on EnterInlined. When merging simulates into the simulate before enter-inlined, adopt the last AST id that gets merged into it.

BUG=v8:3282
LOG=N
[email protected]

Review URL: https://codereview.chromium.org/283923003
http://code.google.com/p/v8/source/detail?r=21308

Added:
 /branches/3.25/test/mjsunit/regress/regress-lazy-deopt-inlining.js
Modified:
 /branches/3.25/src/arm/lithium-arm.cc
 /branches/3.25/src/arm64/lithium-arm64.cc
 /branches/3.25/src/hydrogen-instructions.cc
 /branches/3.25/src/hydrogen-instructions.h
 /branches/3.25/src/hydrogen.cc
 /branches/3.25/src/ia32/lithium-ia32.cc
 /branches/3.25/src/mips/lithium-mips.cc
 /branches/3.25/src/version.cc
 /branches/3.25/src/x64/lithium-x64.cc

=======================================
--- /dev/null
+++ /branches/3.25/test/mjsunit/regress/regress-lazy-deopt-inlining.js Wed May 14 13:19:52 2014 UTC
@@ -0,0 +1,24 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+"use strict";
+function f1(d) {
+  return 1 + f2(f3(d));
+}
+
+function f2(v) { return v; }
+
+function f3(d) {
+  if (d) %DeoptimizeFunction(f1);
+  return 2;
+}
+
+%NeverOptimizeFunction(f3);
+
+f1(false);
+f1(false);
+%OptimizeFunctionOnNextCall(f1);
+assertEquals(3, f1(true));
=======================================
--- /branches/3.25/src/arm/lithium-arm.cc       Thu Mar 20 15:46:12 2014 UTC
+++ /branches/3.25/src/arm/lithium-arm.cc       Wed May 14 13:19:52 2014 UTC
@@ -2478,6 +2478,7 @@

 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) {
   HEnvironment* outer = current_block_->last_environment();
+  outer->set_ast_id(instr->ReturnId());
   HConstant* undefined = graph()->GetConstantUndefined();
   HEnvironment* inner = outer->CopyForInlining(instr->closure(),
                                                instr->arguments_count(),
=======================================
--- /branches/3.25/src/arm64/lithium-arm64.cc   Wed Mar 26 12:42:48 2014 UTC
+++ /branches/3.25/src/arm64/lithium-arm64.cc   Wed May 14 13:19:52 2014 UTC
@@ -1447,6 +1447,7 @@

 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) {
   HEnvironment* outer = current_block_->last_environment();
+  outer->set_ast_id(instr->ReturnId());
   HConstant* undefined = graph()->GetConstantUndefined();
   HEnvironment* inner = outer->CopyForInlining(instr->closure(),
                                                instr->arguments_count(),
=======================================
--- /branches/3.25/src/hydrogen-instructions.cc Wed Mar 26 01:04:35 2014 UTC
+++ /branches/3.25/src/hydrogen-instructions.cc Wed May 14 13:19:52 2014 UTC
@@ -2569,6 +2569,9 @@


 void HSimulate::MergeWith(ZoneList<HSimulate*>* list) {
+  if (!list->is_empty() && !HasAstId()) {
+    set_ast_id(list->last()->ast_id());
+  }
   while (!list->is_empty()) {
     HSimulate* from = list->RemoveLast();
     ZoneList<HValue*>* from_values = &from->values_;
@@ -4455,7 +4458,7 @@

 void HSimulate::Verify() {
   HInstruction::Verify();
-  ASSERT(HasAstId());
+  ASSERT(HasAstId() || next()->IsEnterInlined());
 }


=======================================
--- /branches/3.25/src/hydrogen-instructions.h  Thu Mar 27 01:04:43 2014 UTC
+++ /branches/3.25/src/hydrogen-instructions.h  Wed May 14 13:19:52 2014 UTC
@@ -2069,14 +2069,15 @@
  public:
   static HEnterInlined* New(Zone* zone,
                             HValue* context,
+                            BailoutId return_id,
                             Handle<JSFunction> closure,
                             int arguments_count,
                             FunctionLiteral* function,
                             InliningKind inlining_kind,
                             Variable* arguments_var,
                             HArgumentsObject* arguments_object) {
-    return new(zone) HEnterInlined(closure, arguments_count, function,
-                                   inlining_kind, arguments_var,
+    return new(zone) HEnterInlined(return_id, closure, arguments_count,
+                                   function, inlining_kind, arguments_var,
                                    arguments_object, zone);
   }

@@ -2091,6 +2092,7 @@
   void set_arguments_pushed() { arguments_pushed_ = true; }
   FunctionLiteral* function() const { return function_; }
   InliningKind inlining_kind() const { return inlining_kind_; }
+  BailoutId ReturnId() const { return return_id_; }

virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
     return Representation::None();
@@ -2102,14 +2104,16 @@
   DECLARE_CONCRETE_INSTRUCTION(EnterInlined)

  private:
-  HEnterInlined(Handle<JSFunction> closure,
+  HEnterInlined(BailoutId return_id,
+                Handle<JSFunction> closure,
                 int arguments_count,
                 FunctionLiteral* function,
                 InliningKind inlining_kind,
                 Variable* arguments_var,
                 HArgumentsObject* arguments_object,
                 Zone* zone)
-      : closure_(closure),
+      : return_id_(return_id),
+        closure_(closure),
         arguments_count_(arguments_count),
         arguments_pushed_(false),
         function_(function),
@@ -2119,6 +2123,7 @@
         return_targets_(2, zone) {
   }

+  BailoutId return_id_;
   Handle<JSFunction> closure_;
   int arguments_count_;
   bool arguments_pushed_;
=======================================
--- /branches/3.25/src/hydrogen.cc      Wed Apr 23 12:19:54 2014 UTC
+++ /branches/3.25/src/hydrogen.cc      Wed May 14 13:19:52 2014 UTC
@@ -7252,8 +7252,6 @@
   HConstant* context = Add<HConstant>(Handle<Context>(target->context()));
   inner_env->BindContext(context);

-  Add<HSimulate>(return_id);
-  current_block()->UpdateEnvironment(inner_env);
   HArgumentsObject* arguments_object = NULL;

   // If the function uses arguments object create and bind one, also copy
@@ -7268,9 +7266,18 @@
       arguments_object->AddArgument(arguments_env->Lookup(i), zone());
     }
   }
+
+ // Capture the state before invoking the inlined function for deopt in the + // inlined function. This simulate has no bailout-id since it's not directly + // reachable for deopt, and is only used to capture the state. If the simulate + // becomes reachable by merging, the ast id of the simulate merged into it is
+  // adopted.
+  Add<HSimulate>(BailoutId::None());
+
+  current_block()->UpdateEnvironment(inner_env);

   HEnterInlined* enter_inlined =
-      Add<HEnterInlined>(target, arguments_count, function,
+      Add<HEnterInlined>(return_id, target, arguments_count, function,
                          function_state()->inlining_kind(),
                          function->scope()->arguments(),
                          arguments_object);
=======================================
--- /branches/3.25/src/ia32/lithium-ia32.cc     Tue Mar 25 13:44:35 2014 UTC
+++ /branches/3.25/src/ia32/lithium-ia32.cc     Wed May 14 13:19:52 2014 UTC
@@ -2642,6 +2642,7 @@

 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) {
   HEnvironment* outer = current_block_->last_environment();
+  outer->set_ast_id(instr->ReturnId());
   HConstant* undefined = graph()->GetConstantUndefined();
   HEnvironment* inner = outer->CopyForInlining(instr->closure(),
                                                instr->arguments_count(),
=======================================
--- /branches/3.25/src/mips/lithium-mips.cc     Mon Mar 24 08:11:09 2014 UTC
+++ /branches/3.25/src/mips/lithium-mips.cc     Wed May 14 13:19:52 2014 UTC
@@ -2431,6 +2431,7 @@

 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) {
   HEnvironment* outer = current_block_->last_environment();
+  outer->set_ast_id(instr->ReturnId());
   HConstant* undefined = graph()->GetConstantUndefined();
   HEnvironment* inner = outer->CopyForInlining(instr->closure(),
                                                instr->arguments_count(),
=======================================
--- /branches/3.25/src/version.cc       Fri May  2 14:10:10 2014 UTC
+++ /branches/3.25/src/version.cc       Wed May 14 13:19:52 2014 UTC
@@ -35,7 +35,7 @@
 #define MAJOR_VERSION     3
 #define MINOR_VERSION     25
 #define BUILD_NUMBER      28
-#define PATCH_LEVEL       16
+#define PATCH_LEVEL       17
 // Use 1 for candidates and 0 otherwise.
 // (Boolean macro values are not supported by all preprocessors.)
 #define IS_CANDIDATE_VERSION 0
=======================================
--- /branches/3.25/src/x64/lithium-x64.cc       Fri Apr 11 07:27:30 2014 UTC
+++ /branches/3.25/src/x64/lithium-x64.cc       Wed May 14 13:19:52 2014 UTC
@@ -2525,6 +2525,7 @@

 LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) {
   HEnvironment* outer = current_block_->last_environment();
+  outer->set_ast_id(instr->ReturnId());
   HConstant* undefined = graph()->GetConstantUndefined();
   HEnvironment* inner = outer->CopyForInlining(instr->closure(),
                                                instr->arguments_count(),

--
--
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/d/optout.

Reply via email to