Index: src/runtime/runtime-scopes.cc |
diff --git a/src/runtime/runtime-scopes.cc b/src/runtime/runtime-scopes.cc |
index f634cc119d80bc1f3bf739985d310a72225d67b9..3708e421451034542991114ecc293783597634f7 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,6 +313,8 @@ Object* DeclareEvalHelper(Isolate* isolate, Handle<String> name, |
} |
DCHECK(object->IsJSContextExtensionObject() || object->IsJSGlobalObject()); |
} else { |
+ // Sloppy eval will never have an extension object, as vars are hoisted out, |
+ // and lets are known statically. |
DCHECK(context->IsFunctionContext()); |
object = |
isolate->factory()->NewJSObject(isolate->context_extension_function()); |
@@ -702,19 +704,19 @@ RUNTIME_FUNCTION(Runtime_NewScriptContext) { |
return *result; |
} |
- |
RUNTIME_FUNCTION(Runtime_NewFunctionContext) { |
HandleScope scope(isolate); |
- DCHECK(args.length() == 1); |
+ DCHECK(args.length() == 2); |
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); |
+ CONVERT_SMI_ARG_CHECKED(scope_type, 1); |
DCHECK(function->context() == isolate->context()); |
int length = function->shared()->scope_info()->ContextLength(); |
- return *isolate->factory()->NewFunctionContext(length, function); |
+ return *isolate->factory()->NewFunctionContext( |
+ length, function, static_cast<ScopeType>(scope_type)); |
} |
- |
RUNTIME_FUNCTION(Runtime_PushWithContext) { |
HandleScope scope(isolate); |
DCHECK_EQ(3, args.length()); |