Commit c8aea7a1 authored by rossberg@chromium.org's avatar rossberg@chromium.org

Put new global var semantics behind a flag until WebKit tests are cleaned up.

R=mstarzinger@chromium.org
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com/10163003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11402 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 29f04635
...@@ -132,6 +132,8 @@ public: ...@@ -132,6 +132,8 @@ public:
// Flags for language modes and experimental language features. // Flags for language modes and experimental language features.
DEFINE_bool(use_strict, false, "enforce strict mode") DEFINE_bool(use_strict, false, "enforce strict mode")
DEFINE_bool(es52_globals, false,
"activate new semantics for global var declarations")
DEFINE_bool(harmony_typeof, false, "enable harmony semantics for typeof") DEFINE_bool(harmony_typeof, false, "enable harmony semantics for typeof")
DEFINE_bool(harmony_scoping, false, "enable harmony block scoping") DEFINE_bool(harmony_scoping, false, "enable harmony block scoping")
......
...@@ -1300,7 +1300,10 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DeclareGlobals) { ...@@ -1300,7 +1300,10 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DeclareGlobals) {
// value of the variable if the property is already there. // value of the variable if the property is already there.
// Do the lookup locally only, see ES5 errata. // Do the lookup locally only, see ES5 errata.
LookupResult lookup(isolate); LookupResult lookup(isolate);
if (FLAG_es52_globals)
global->LocalLookup(*name, &lookup); global->LocalLookup(*name, &lookup);
else
global->Lookup(*name, &lookup);
if (lookup.IsProperty()) { if (lookup.IsProperty()) {
// We found an existing property. Unless it was an interceptor // We found an existing property. Unless it was an interceptor
// that claims the property is absent, skip this declaration. // that claims the property is absent, skip this declaration.
......
...@@ -12483,6 +12483,7 @@ THREADED_TEST(GetCallingContext) { ...@@ -12483,6 +12483,7 @@ THREADED_TEST(GetCallingContext) {
// Check that a variable declaration with no explicit initialization // Check that a variable declaration with no explicit initialization
// value does shadow an existing property in the prototype chain. // value does shadow an existing property in the prototype chain.
THREADED_TEST(InitGlobalVarInProtoChain) { THREADED_TEST(InitGlobalVarInProtoChain) {
i::FLAG_es52_globals = true;
v8::HandleScope scope; v8::HandleScope scope;
LocalContext context; LocalContext context;
// Introduce a variable in the prototype chain. // Introduce a variable in the prototype chain.
......
...@@ -521,6 +521,7 @@ class ExistsInPrototypeContext: public DeclarationContext { ...@@ -521,6 +521,7 @@ class ExistsInPrototypeContext: public DeclarationContext {
TEST(ExistsInPrototype) { TEST(ExistsInPrototype) {
i::FLAG_es52_globals = true;
HandleScope scope; HandleScope scope;
// Sanity check to make sure that the holder of the interceptor // Sanity check to make sure that the holder of the interceptor
...@@ -583,6 +584,7 @@ class AbsentInPrototypeContext: public DeclarationContext { ...@@ -583,6 +584,7 @@ class AbsentInPrototypeContext: public DeclarationContext {
TEST(AbsentInPrototype) { TEST(AbsentInPrototype) {
i::FLAG_es52_globals = true;
HandleScope scope; HandleScope scope;
{ AbsentInPrototypeContext context; { AbsentInPrototypeContext context;
......
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
// This exercises the code in runtime.cc in // This exercises the code in runtime.cc in
// DeclareGlobal...Locally(). // DeclareGlobal...Locally().
// Flags: --es52_globals
this.__proto__.foo = 42; this.__proto__.foo = 42;
this.__proto__.bar = 87; this.__proto__.bar = 87;
......
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
// Test runtime declaration of properties with var which are intercepted // Test runtime declaration of properties with var which are intercepted
// by JS accessors. // by JS accessors.
// Flags: --es52_globals
this.__defineSetter__("x", function() { hasBeenInvoked = true; }); this.__defineSetter__("x", function() { hasBeenInvoked = true; });
this.__defineSetter__("y", function() { throw 'exception'; }); this.__defineSetter__("y", function() { throw 'exception'; });
......
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
// Test that a function declaration cannot overwrite a read-only property. // Test that a function declaration cannot overwrite a read-only property.
// Flags: --es52_globals
function foobl() {} function foobl() {}
assertTrue(typeof this.foobl == "function"); assertTrue(typeof this.foobl == "function");
assertTrue(Object.getOwnPropertyDescriptor(this, "foobl").writable); assertTrue(Object.getOwnPropertyDescriptor(this, "foobl").writable);
......
...@@ -25,6 +25,8 @@ ...@@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --es52_globals
var setter_value = 0; var setter_value = 0;
this.__defineSetter__("a", function(v) { setter_value = v; }); this.__defineSetter__("a", function(v) { setter_value = v; });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment