Reviewers: bmeuer_chromium.org,

Message:
Hi Benedikt, here is the step back from type vector reuse, as we discussed.
Thanks for the look,
--Michael

Description:
Continued fix for 351257. Reusing the feedback vector is too complex at
the moment.

Attempting to re-use the type feedback vector stored in the
SharedFunctionInfo turns out to be difficult among the various cases.
It will be much easier to do this when deferred type feedback processing
is removed, as is in the works.

Created bug v8:3212 to track re-introducing the optimization of reusing
the type vector on recompile before optimization.

BUG=351257
LOG=N
[email protected]

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

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+26, -54 lines):
  M src/compiler.cc
  M test/cctest/test-compiler.cc
  A test/mjsunit/regress/regress-351257.js


Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index 97f8e6f41ad40360c6dbdfd54f457444b1f6dc9f..97ad58a615f87e40b9174f1d5704d781f06a096b 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -140,13 +140,6 @@ void CompilationInfo::Initialize(Isolate* isolate,
     SetStrictMode(shared_info_->strict_mode());
   }
   set_bailout_reason(kUnknown);
-
-  if (!shared_info().is_null() && shared_info()->is_compiled()) {
-    // We should initialize the CompilationInfo feedback vector from the
-    // passed in shared info, rather than creating a new one.
-    feedback_vector_ = Handle<FixedArray>(shared_info()->feedback_vector(),
-                                          isolate);
-  }
 }


@@ -257,19 +250,16 @@ void CompilationInfo::PrepareForCompilation(Scope* scope) {
   scope_ = scope;
   function()->ProcessFeedbackSlots(isolate_);
   int length = function()->slot_count();
-  if (feedback_vector_.is_null()) {
-    // Allocate the feedback vector too.
- feedback_vector_ = isolate()->factory()->NewFixedArray(length, TENURED);
-    // Ensure we can skip the write barrier
-    ASSERT_EQ(isolate()->heap()->uninitialized_symbol(),
-              *TypeFeedbackInfo::UninitializedSentinel(isolate()));
-    for (int i = 0; i < length; i++) {
-      feedback_vector_->set(i,
-          *TypeFeedbackInfo::UninitializedSentinel(isolate()),
-          SKIP_WRITE_BARRIER);
-    }
+  // Allocate the feedback vector too.
+  feedback_vector_ = isolate()->factory()->NewFixedArray(length, TENURED);
+  // Ensure we can skip the write barrier
+  ASSERT_EQ(isolate()->heap()->uninitialized_symbol(),
+            *TypeFeedbackInfo::UninitializedSentinel(isolate()));
+  for (int i = 0; i < length; i++) {
+    feedback_vector_->set(i,
+ *TypeFeedbackInfo::UninitializedSentinel(isolate()),
+                          SKIP_WRITE_BARRIER);
   }
-  ASSERT(feedback_vector_->length() == length);
 }


Index: test/cctest/test-compiler.cc
diff --git a/test/cctest/test-compiler.cc b/test/cctest/test-compiler.cc
index 079b286faad1a33fb84944ae2ac7f75667d49c14..00f29d446d1ceb7c805e9108ae7807ac879751d2 100644
--- a/test/cctest/test-compiler.cc
+++ b/test/cctest/test-compiler.cc
@@ -312,41 +312,6 @@ TEST(GetScriptLineNumber) {
 }


-TEST(FeedbackVectorPreservedAcrossRecompiles) {
-  if (i::FLAG_always_opt || !i::FLAG_crankshaft) return;
-  i::FLAG_allow_natives_syntax = true;
-  CcTest::InitializeVM();
-  if (!CcTest::i_isolate()->use_crankshaft()) return;
-  v8::HandleScope scope(CcTest::isolate());
-
-  // Make sure function f has a call that uses a type feedback slot.
-  CompileRun("function fun() {};"
-             "fun1 = fun;"
-             "function f(a) { a(); } f(fun1);");
-
-  Handle<JSFunction> f =
-      v8::Utils::OpenHandle(
-          *v8::Handle<v8::Function>::Cast(
-              CcTest::global()->Get(v8_str("f"))));
-
-  // We shouldn't have deoptimization support. We want to recompile and
-  // verify that our feedback vector preserves information.
-  CHECK(!f->shared()->has_deoptimization_support());
-  Handle<FixedArray> feedback_vector(f->shared()->feedback_vector());
-
-  // Verify that we gathered feedback.
-  CHECK_EQ(1, feedback_vector->length());
-  CHECK(feedback_vector->get(0)->IsJSFunction());
-
-  CompileRun("%OptimizeFunctionOnNextCall(f); f(fun1);");
-
-  // Verify that the feedback is still "gathered" despite a recompilation
-  // of the full code.
-  CHECK(f->shared()->has_deoptimization_support());
-  CHECK(f->shared()->feedback_vector()->get(0)->IsJSFunction());
-}
-
-
 TEST(FeedbackVectorRecreatedOnScopeChanges) {
   if (i::FLAG_always_opt || !i::FLAG_lazy) return;
   CcTest::InitializeVM();
Index: test/mjsunit/regress/regress-351257.js
diff --git a/test/mjsunit/regress/regress-351257.js b/test/mjsunit/regress/regress-351257.js
new file mode 100644
index 0000000000000000000000000000000000000000..40714fa7abbd7b8d6160d2f3216f6b25d416756d
--- /dev/null
+++ b/test/mjsunit/regress/regress-351257.js
@@ -0,0 +1,17 @@
+// 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: --stress-opt --always-opt
+
+function foo(x) { return x; }
+function container() {
+  x = 0;
+  eval('"use strict"; var x = 9;');
+  (function() {
+    "use strict";
+    foo(x);
+  })();
+}
+
+container();


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