Reviewers: rossberg,

Message:
PTAL

Description:
Introduce legacy const slots in correct context.

[email protected]
BUG=chromium:410030
LOG=Y

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

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

Affected files (+47, -2 lines):
  M src/runtime/runtime-scopes.cc
  A test/mjsunit/regress/regress-410030.js


Index: src/runtime/runtime-scopes.cc
diff --git a/src/runtime/runtime-scopes.cc b/src/runtime/runtime-scopes.cc
index e03b85028fe1365a36c8b8f2b9d9db42ccff1b7c..7a2f5146e2268ade4458ea7978b4f4e1a8a7a74b 100644
--- a/src/runtime/runtime-scopes.cc
+++ b/src/runtime/runtime-scopes.cc
@@ -306,9 +306,11 @@ RUNTIME_FUNCTION(Runtime_InitializeLegacyConstLookupSlot) {

   // The declared const was configurable, and may have been deleted in the
   // meanwhile. If so, re-introduce the variable in the context extension.
-  DCHECK(context_arg->has_extension());
   if (attributes == ABSENT) {
-    holder = handle(context_arg->extension(), isolate);
+ Handle<Context> declaration_context(context_arg->declaration_context());
+    DCHECK(declaration_context->has_extension());
+    holder = handle(declaration_context->extension(), isolate);
+    CHECK(holder->IsJSObject());
   } else {
// For JSContextExtensionObjects, the initializer can be run multiple times // if in a for loop: for (var i = 0; i < 2; i++) { const x = i; }. Only the
Index: test/mjsunit/regress/regress-410030.js
diff --git a/test/mjsunit/regress/regress-410030.js b/test/mjsunit/regress/regress-410030.js
new file mode 100644
index 0000000000000000000000000000000000000000..efd4b1e75841ca8a0b8955b2f7bc0f037cf76d09
--- /dev/null
+++ b/test/mjsunit/regress/regress-410030.js
@@ -0,0 +1,43 @@
+// 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.
+
+try {
+  throw 0;
+} catch(e) {
+  assertSame(3, eval("delete x; const x=3; x"));
+}
+
+
+try {
+  throw 0;
+} catch(e) {
+  assertSame(3, (1,eval)("delete x1; const x1=3; x1"));
+}
+
+
+try {
+  throw 0;
+} catch(e) {
+  with({}) {
+    assertSame(3, eval("delete x2; const x2=3; x2"));
+  }
+}
+
+
+(function f() {
+  try {
+    throw 0;
+  } catch(e) {
+    assertSame(3, eval("delete x; const x=3; x"));
+  }
+}());
+
+
+(function f() {
+  try {
+    throw 0;
+  } catch(e) {
+    assertSame(3, (1,eval)("delete x4; const x4=3; x4"));
+  }
+}());


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