Index: src/runtime/runtime-scopes.cc |
diff --git a/src/runtime/runtime-scopes.cc b/src/runtime/runtime-scopes.cc |
index 377799fe047dbc6539463e032028eb4fb561db97..5d7c2cd232f976f5b2322578c0bc5d876193a569 100644 |
--- a/src/runtime/runtime-scopes.cc |
+++ b/src/runtime/runtime-scopes.cc |
@@ -670,8 +670,9 @@ RUNTIME_FUNCTION(Runtime_NewScriptContext) { |
// Script contexts have a canonical empty function as their closure, not the |
// anonymous closure containing the global code. See |
// FullCodeGenerator::PushFunctionArgumentForContextAllocation. |
- Handle<JSFunction> closure( |
- function->shared()->IsBuiltin() ? *function : native_context->closure()); |
+ Handle<JSFunction> closure(function->shared()->IsUserJavaScript() |
+ ? native_context->closure() |
+ : *function); |
Handle<Context> result = |
isolate->factory()->NewScriptContext(closure, scope_info); |