Bug 1076091 - Don't bake in the initial undefined values of global names, r=jandem.
authorBrian Hackett <bhackett1024@gmail.com>
Wed, 08 Oct 2014 06:19:22 -0700
changeset 224784 bed3f6586a118cd405ef9672a27167056d7fd8f3
parent 224783 8c00d59b1c0091495e1e5471693156adaccc39eb
child 224785 d80d80865715e81e38e3189af0c23faba1993068
push id7107
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 17:43:31 +0000
treeherdermozilla-aurora@b4b34e0acc75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjandem
bugs1076091
milestone35.0a1
Bug 1076091 - Don't bake in the initial undefined values of global names, r=jandem.
js/src/jit-test/tests/ion/bug1076091.js
js/src/jit/IonBuilder.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/ion/bug1076091.js
@@ -0,0 +1,11 @@
+
+Object.defineProperty(this, "x", {
+    get: function() {
+        return this.y
+    }
+})
+x
+x
+y = Int16Array
+var y
+assertEq(x, Int16Array)
--- a/js/src/jit/IonBuilder.cpp
+++ b/js/src/jit/IonBuilder.cpp
@@ -9020,31 +9020,33 @@ IonBuilder::storeSlot(MDefinition *obj, 
 bool
 IonBuilder::jsop_getprop(PropertyName *name)
 {
     bool emitted = false;
 
     MDefinition *obj = current->pop();
     types::TemporaryTypeSet *types = bytecodeTypes(pc);
 
-    // Try to optimize to a specific constant.
-    if (!getPropTryInferredConstant(&emitted, obj, name, types) || emitted)
-        return emitted;
-
     // Try to optimize arguments.length.
     if (!getPropTryArgumentsLength(&emitted, obj) || emitted)
         return emitted;
 
     // Try to optimize arguments.callee.
     if (!getPropTryArgumentsCallee(&emitted, obj, name) || emitted)
         return emitted;
 
     BarrierKind barrier = PropertyReadNeedsTypeBarrier(analysisContext, constraints(),
                                                        obj, name, types);
 
+    // Try to optimize to a specific constant.
+    if (barrier == BarrierKind::NoBarrier) {
+        if (!getPropTryInferredConstant(&emitted, obj, name, types) || emitted)
+            return emitted;
+    }
+
     // Always use a call if we are performing analysis and
     // not actually emitting code, to simplify later analysis. Also skip deeper
     // analysis if there are no known types for this operation, as it will
     // always invalidate when executing.
     if (info().executionModeIsAnalysis() || types->empty()) {
         MCallGetProperty *call = MCallGetProperty::New(alloc(), obj, name, *pc == JSOP_CALLPROP);
         current->add(call);