Reviewers: Jakob,

Description:
Correctly throw reference error in strict mode with ICs disabled.


[email protected]
BUG=v8:2119
TEST=regress/regress-2119.js


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

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

Affected files:
  M src/ic.cc
  A + test/mjsunit/regress/regress-2119.js


Index: src/ic.cc
diff --git a/src/ic.cc b/src/ic.cc
index 3d36ead01bb60febe42bec287bb3b4dcf165eb53..d37499bd1f72446f1d0cfb49e2838fc0199c712c 100644
--- a/src/ic.cc
+++ b/src/ic.cc
@@ -1385,12 +1385,13 @@ MaybeObject* StoreIC::Store(State state,
   }

   // Lookup the property locally in the receiver.
-  if (FLAG_use_ic && !receiver->IsJSGlobalProxy()) {
+  if (!receiver->IsJSGlobalProxy()) {
     LookupResult lookup(isolate());

     if (LookupForWrite(receiver, name, &lookup)) {
-      // Generate a stub for this store.
-      UpdateCaches(&lookup, state, strict_mode, receiver, name, value);
+      if (FLAG_use_ic) {  // Generate a stub for this store.
+        UpdateCaches(&lookup, state, strict_mode, receiver, name, value);
+      }
     } else {
       // Strict mode doesn't allow setting non-existent global property
       // or an assignment to a read only property.
Index: test/mjsunit/regress/regress-2119.js
diff --git a/test/mjsunit/regress/regress-113924.js b/test/mjsunit/regress/regress-2119.js
similarity index 93%
copy from test/mjsunit/regress/regress-113924.js
copy to test/mjsunit/regress/regress-2119.js
index 3ecdec48f219b9ea545702ebf3a396debe7a93f8..fd92e4457b672360696b7def939308dfff243f1e 100644
--- a/test/mjsunit/regress/regress-113924.js
+++ b/test/mjsunit/regress/regress-2119.js
@@ -25,7 +25,11 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-var count=12000;
-while(count--) {
-  eval("var a = new Object(10); a[2] += 7;");
+// Flags: --nouse-ic --use-strict
+
+function strict_function() {
+  undeclared = 1;
 }
+
+assertThrows(strict_function);
+


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to