Reviewers: Benedikt Meurer,

Description:
Mark function info as compiled after EnsureDeoptimizationSupport.

Note that prior to having canonical shared function infos, this has
been a source of duplicate shared function infos.

[email protected]
BUG=chromium:504787
LOG=N

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

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+12, -4 lines):
  M src/compiler.h
  M src/compiler.cc
  A + test/mjsunit/regress/regress-crbug-504787.js


Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index 9092fb5a65edb8b8389971700643d890806a1eb7..c62d8d6c411498cc415d23263fa651e27696ff59 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -376,6 +376,7 @@ OptimizedCompileJob::Status OptimizedCompileJob::CreateGraph() {
   }

   DCHECK(info()->shared_info()->has_deoptimization_support());
+  DCHECK(!info()->is_first_compile());

   // Check the enabling conditions for TurboFan.
   bool dont_crankshaft = info()->shared_info()->dont_crankshaft();
@@ -956,6 +957,8 @@ bool Compiler::EnsureDeoptimizationSupport(CompilationInfo* info) {
     shared->EnableDeoptimizationSupport(*unoptimized.code());
     shared->set_feedback_vector(*unoptimized.feedback_vector());

+    info->MarkAsCompiled();
+
     // The scope info might not have been set if a lazily compiled
     // function is inlined before being called for the first time.
     if (shared->scope_info() == ScopeInfo::Empty(info->isolate())) {
Index: src/compiler.h
diff --git a/src/compiler.h b/src/compiler.h
index f87a3399401cd067dba1ca72e1537bc0d753138b..e1e4be3965c9e2c872dd04f1347b9eb28a6df592 100644
--- a/src/compiler.h
+++ b/src/compiler.h
@@ -249,6 +249,8 @@ class CompilationInfo {

   void MarkAsFirstCompile() { SetFlag(kFirstCompile); }

+  void MarkAsCompiled() { SetFlag(kFirstCompile, false); }
+
   bool is_first_compile() const { return GetFlag(kFirstCompile); }

   bool IsCodePreAgingActive() const {
Index: test/mjsunit/regress/regress-crbug-504787.js
diff --git a/test/mjsunit/compiler/regress-451012.js b/test/mjsunit/regress/regress-crbug-504787.js
similarity index 66%
copy from test/mjsunit/compiler/regress-451012.js
copy to test/mjsunit/regress/regress-crbug-504787.js
index bffc8bc5bdfac32bb561a24153d00157b26ac3a5..66274bc6b9e314917b098349437c20cc1318888c 100644
--- a/test/mjsunit/compiler/regress-451012.js
+++ b/test/mjsunit/regress/regress-crbug-504787.js
@@ -2,11 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.

-"use strict";
+// Flags: --noturbo-osr
+
 function f() {
-  for (let v; v; ) {
-    let x;
+  "use asm";
+  function g() {
+    function f() {};
   }
+  return g;
 }

-f();
+f()();


--
--
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