Reviewers: ulan,

Description:
Fix parallel recompilation wrt initial object/array map dependency.

[email protected]
BUG=

Please review this at https://chromiumcodereview.appspot.com/16641002/

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

Affected files:
  M src/arm/lithium-codegen-arm.cc
  M src/hydrogen.h
  M src/ia32/lithium-codegen-ia32.cc
  M src/mips/lithium-codegen-mips.cc
  M src/x64/lithium-codegen-x64.cc
  A + test/mjsunit/parallel-initial-prototype-change.js


Index: src/arm/lithium-codegen-arm.cc
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc
index d1d4fe053461b5bcce44db6d49b28046145de0ca..d42ae7294d0bcc18ab34cccc117f75d6fcdef85d 100644
--- a/src/arm/lithium-codegen-arm.cc
+++ b/src/arm/lithium-codegen-arm.cc
@@ -93,12 +93,6 @@ void LCodeGen::FinishCode(Handle<Code> code) {
     transition_maps_.at(i)->AddDependentCode(
         DependentCode::kTransitionGroup, code);
   }
-  if (graph()->depends_on_empty_array_proto_elements()) {
-    isolate()->initial_object_prototype()->map()->AddDependentCode(
-        DependentCode::kElementsCantBeAddedGroup, code);
-    isolate()->initial_array_prototype()->map()->AddDependentCode(
-        DependentCode::kElementsCantBeAddedGroup, code);
-  }
 }


Index: src/hydrogen.h
diff --git a/src/hydrogen.h b/src/hydrogen.h
index 00cd9be36aebe3097daae4635bd86abe9579b7cb..eb6473aca6fb3a7efa7ecc554498a10fb8f9de5d 100644
--- a/src/hydrogen.h
+++ b/src/hydrogen.h
@@ -402,13 +402,15 @@ class HGraph: public ZoneObject {
   }

   void MarkDependsOnEmptyArrayProtoElements() {
+    // Add map dependency if not already added.
+    if (depends_on_empty_array_proto_elements_) return;
+ isolate()->initial_object_prototype()->map()->AddDependentCompilationInfo(
+        DependentCode::kElementsCantBeAddedGroup, info());
+ isolate()->initial_array_prototype()->map()->AddDependentCompilationInfo(
+        DependentCode::kElementsCantBeAddedGroup, info());
     depends_on_empty_array_proto_elements_ = true;
   }

-  bool depends_on_empty_array_proto_elements() {
-    return depends_on_empty_array_proto_elements_;
-  }
-
   void RecordUint32Instruction(HInstruction* instr) {
     if (uint32_instructions_ == NULL) {
uint32_instructions_ = new(zone()) ZoneList<HInstruction*>(4, zone());
Index: src/ia32/lithium-codegen-ia32.cc
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc index 5d1f46d065634bc7381850bddca5bf9c0362a740..14657b9606aa876bee2096c9c37ee49ba311faa4 100644
--- a/src/ia32/lithium-codegen-ia32.cc
+++ b/src/ia32/lithium-codegen-ia32.cc
@@ -115,12 +115,6 @@ void LCodeGen::FinishCode(Handle<Code> code) {
     transition_maps_.at(i)->AddDependentCode(
         DependentCode::kTransitionGroup, code);
   }
-  if (graph()->depends_on_empty_array_proto_elements()) {
-    isolate()->initial_object_prototype()->map()->AddDependentCode(
-        DependentCode::kElementsCantBeAddedGroup, code);
-    isolate()->initial_array_prototype()->map()->AddDependentCode(
-        DependentCode::kElementsCantBeAddedGroup, code);
-  }
 }


Index: src/mips/lithium-codegen-mips.cc
diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc index fa97ee420158b82a18dcf3c320a57d3125c2d62a..cafccecde3944b8b75c6a0eb978060787bb85e5d 100644
--- a/src/mips/lithium-codegen-mips.cc
+++ b/src/mips/lithium-codegen-mips.cc
@@ -93,12 +93,6 @@ void LCodeGen::FinishCode(Handle<Code> code) {
     transition_maps_.at(i)->AddDependentCode(
         DependentCode::kTransitionGroup, code);
   }
-  if (graph()->depends_on_empty_array_proto_elements()) {
-    isolate()->initial_object_prototype()->map()->AddDependentCode(
-        DependentCode::kElementsCantBeAddedGroup, code);
-    isolate()->initial_array_prototype()->map()->AddDependentCode(
-        DependentCode::kElementsCantBeAddedGroup, code);
-  }
 }


Index: src/x64/lithium-codegen-x64.cc
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc
index 2d6e4cba33c6ebf86ea0877451657cc7325fcdd5..b07655de7e723ed1f75e337465dec42d39a8a86c 100644
--- a/src/x64/lithium-codegen-x64.cc
+++ b/src/x64/lithium-codegen-x64.cc
@@ -98,12 +98,6 @@ void LCodeGen::FinishCode(Handle<Code> code) {
     transition_maps_.at(i)->AddDependentCode(
         DependentCode::kTransitionGroup, code);
   }
-  if (graph()->depends_on_empty_array_proto_elements()) {
-    isolate()->initial_object_prototype()->map()->AddDependentCode(
-        DependentCode::kElementsCantBeAddedGroup, code);
-    isolate()->initial_array_prototype()->map()->AddDependentCode(
-        DependentCode::kElementsCantBeAddedGroup, code);
-  }
 }


Index: test/mjsunit/parallel-initial-prototype-change.js
diff --git a/test/mjsunit/elide-double-hole-check-6.js b/test/mjsunit/parallel-initial-prototype-change.js
similarity index 77%
copy from test/mjsunit/elide-double-hole-check-6.js
copy to test/mjsunit/parallel-initial-prototype-change.js
index 01a8096f85c2381d400d436198daa59fe7ca9ce0..5544bebc1d49256f50b00a42d71a06f740ed7aaa 100644
--- a/test/mjsunit/elide-double-hole-check-6.js
+++ b/test/mjsunit/parallel-initial-prototype-change.js
@@ -26,14 +26,25 @@
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

 // Flags: --allow-natives-syntax
+// Flags: --parallel-recompilation --parallel-recompilation-delay=50
+
+function assertUnoptimized(fun) {
+  assertTrue(%GetOptimizationStatus(fun) != 1);
+}

 function f1(a, i) {
   return a[i] + 0.5;
 }
+
 var arr = [0.0,,2.5];
 assertEquals(0.5, f1(arr, 0));
 assertEquals(0.5, f1(arr, 0));
-%OptimizeFunctionOnNextCall(f1);
+
+// Optimized code of f1 depends on initial object and array maps.
+%OptimizeFunctionOnNextCall(f1, "parallel");
 assertEquals(0.5, f1(arr, 0));
-Array.prototype.__proto__[1] = 1.5;
+assertUnoptimized(f1);      // Not yet optimized.
+Object.prototype[1] = 1.5;  // Invalidate current initial object map.
 assertEquals(2, f1(arr, 1));
+%CompleteOptimization(f1);  // Conclude optimization with...
+assertUnoptimized(f1);      // ... bailing out due to map dependency.


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