| Index: src/runtime/runtime-scopes.cc
|
| diff --git a/src/runtime/runtime-scopes.cc b/src/runtime/runtime-scopes.cc
|
| index 0c037db307a60ca994da643e9a2554b462654ced..e6de242b227f8afc3ac4e8ed282b980ff7535c2a 100644
|
| --- a/src/runtime/runtime-scopes.cc
|
| +++ b/src/runtime/runtime-scopes.cc
|
| @@ -232,7 +232,7 @@ Object* DeclareEvalHelper(Isolate* isolate, Handle<String> name,
|
| Handle<Context> context(context_arg->declaration_context(), isolate);
|
|
|
| DCHECK(context->IsFunctionContext() || context->IsNativeContext() ||
|
| - context->IsScriptContext() ||
|
| + context->IsScriptContext() || context->IsEvalContext() ||
|
| (context->IsBlockContext() && context->has_extension()));
|
|
|
| bool is_function = value->IsJSFunction();
|
| @@ -313,7 +313,7 @@ Object* DeclareEvalHelper(Isolate* isolate, Handle<String> name,
|
| }
|
| DCHECK(object->IsJSContextExtensionObject() || object->IsJSGlobalObject());
|
| } else {
|
| - DCHECK(context->IsFunctionContext());
|
| + DCHECK(context->IsFunctionContext() || context->IsEvalContext());
|
| object =
|
| isolate->factory()->NewJSObject(isolate->context_extension_function());
|
| context->set_extension(*object);
|
| @@ -696,6 +696,16 @@ RUNTIME_FUNCTION(Runtime_NewFunctionContext) {
|
| return *isolate->factory()->NewFunctionContext(length, function);
|
| }
|
|
|
| +RUNTIME_FUNCTION(Runtime_NewEvalContext) {
|
| + HandleScope scope(isolate);
|
| + DCHECK(args.length() == 1);
|
| +
|
| + CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
|
| +
|
| + DCHECK(function->context() == isolate->context());
|
| + int length = function->shared()->scope_info()->ContextLength();
|
| + return *isolate->factory()->NewEvalContext(length, function);
|
| +}
|
|
|
| RUNTIME_FUNCTION(Runtime_PushWithContext) {
|
| HandleScope scope(isolate);
|
|
|