diff --git a/src/runtime/runtime-object.cc b/src/runtime/runtime-object.cc index f8c2916e8a..18078fc78f 100644 --- a/src/runtime/runtime-object.cc +++ b/src/runtime/runtime-object.cc @@ -1368,16 +1368,6 @@ RUNTIME_FUNCTION(Runtime_GlobalProxy) { } -RUNTIME_FUNCTION(Runtime_IsAttachedGlobal) { - SealHandleScope shs(isolate); - DCHECK(args.length() == 1); - CONVERT_ARG_CHECKED(Object, global, 0); - if (!global->IsJSGlobalObject()) return isolate->heap()->false_value(); - return isolate->heap()->ToBoolean( - !JSGlobalObject::cast(global)->IsDetached()); -} - - RUNTIME_FUNCTION(Runtime_LookupAccessor) { HandleScope scope(isolate); DCHECK(args.length() == 3); diff --git a/src/runtime/runtime.h b/src/runtime/runtime.h index 65fc6fd72f..4d2b3d8183 100644 --- a/src/runtime/runtime.h +++ b/src/runtime/runtime.h @@ -254,7 +254,6 @@ namespace internal { \ /* Eval */ \ F(GlobalProxy, 1, 1) \ - F(IsAttachedGlobal, 1, 1) \ \ F(AddNamedProperty, 4, 1) \ F(AddPropertyForTemplate, 4, 1) \ diff --git a/src/v8natives.js b/src/v8natives.js index 7fb317db7e..bad0154b0b 100644 --- a/src/v8natives.js +++ b/src/v8natives.js @@ -163,16 +163,6 @@ function GlobalParseFloat(string) { function GlobalEval(x) { if (!IS_STRING(x)) return x; - // For consistency with JSC we require the global object passed to - // eval to be the global object from which 'eval' originated. This - // is not mandated by the spec. - // We only throw if the global has been detached, since we need the - // receiver as this-value for the call. - if (!%IsAttachedGlobal(global)) { - throw new $EvalError('The "this" value passed to eval must ' + - 'be the global object from which eval originated'); - } - var global_proxy = %GlobalProxy(global); var f = %CompileString(x, false, 0); diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc index 7984c9d35b..cb3b856b05 100644 --- a/test/cctest/test-api.cc +++ b/test/cctest/test-api.cc @@ -11549,8 +11549,7 @@ THREADED_TEST(CrossEval) { // Test that calling eval in a context which has been detached from -// its global throws an exception. This behavior is consistent with -// other JavaScript implementations. +// its global proxy works. THREADED_TEST(EvalInDetachedGlobal) { v8::Isolate* isolate = CcTest::isolate(); v8::HandleScope scope(isolate); @@ -11578,8 +11577,7 @@ THREADED_TEST(EvalInDetachedGlobal) { context0->DetachGlobal(); v8::TryCatch catcher; x_value = CompileRun("fun('x')"); - CHECK(x_value.IsEmpty()); - CHECK(catcher.HasCaught()); + CHECK_EQ(42, x_value->Int32Value()); context1->Exit(); }