Index: src/builtins.cc |
diff --git a/src/builtins.cc b/src/builtins.cc |
index 919126363031ca70554a9b141e7b4ff5793ebb0f..c04a77227cb372690dc8cea2617e3f0bd0eba726 100644 |
--- a/src/builtins.cc |
+++ b/src/builtins.cc |
@@ -1173,6 +1173,14 @@ MUST_USE_RESULT static MaybeObject* HandleApiCallHelper( |
fun_data = *desc; |
} |
+ SharedFunctionInfo* shared = function->shared(); |
+ if (shared->is_classic_mode() && !shared->native()) { |
+ Object* recv = args[0]; |
+ if (recv->IsUndefined() || recv->IsNull()) { |
+ args[0] = function->context()->global_object()->global_receiver(); |
+ } |
+ } |
+ |
Object* raw_holder = TypeCheck(heap, args.length(), &args[0], fun_data); |
if (raw_holder->IsNull()) { |