Commit e1970c97 authored by Jakob Gruber's avatar Jakob Gruber Committed by Commit Bot

Don't set the context in Push...Context runtime functions

The Isolate::context field doesn't track the context while JS is
executing. It's updated at boundary sites when entering runtime
through CEntry or returning to runtime in Invoke(). These set_context
calls are unnecessary.

Bug: v8:8888
Change-Id: Ifb9818b47699d2b1b37ebf0c19c2caf59fd17427
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2247772
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68380}
parent 5785d98b
...@@ -612,40 +612,35 @@ RUNTIME_FUNCTION(Runtime_NewFunctionContext) { ...@@ -612,40 +612,35 @@ RUNTIME_FUNCTION(Runtime_NewFunctionContext) {
return *isolate->factory()->NewFunctionContext(outer, scope_info); return *isolate->factory()->NewFunctionContext(outer, scope_info);
} }
// TODO(jgruber): Rename these functions to 'New...Context'.
RUNTIME_FUNCTION(Runtime_PushWithContext) { RUNTIME_FUNCTION(Runtime_PushWithContext) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK_EQ(2, args.length()); DCHECK_EQ(2, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSReceiver, extension_object, 0); CONVERT_ARG_HANDLE_CHECKED(JSReceiver, extension_object, 0);
CONVERT_ARG_HANDLE_CHECKED(ScopeInfo, scope_info, 1); CONVERT_ARG_HANDLE_CHECKED(ScopeInfo, scope_info, 1);
Handle<Context> current(isolate->context(), isolate); Handle<Context> current(isolate->context(), isolate);
Handle<Context> context = return *isolate->factory()->NewWithContext(current, scope_info,
isolate->factory()->NewWithContext(current, scope_info, extension_object); extension_object);
isolate->set_context(*context);
return *context;
} }
// TODO(jgruber): Rename these functions to 'New...Context'.
RUNTIME_FUNCTION(Runtime_PushCatchContext) { RUNTIME_FUNCTION(Runtime_PushCatchContext) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK_EQ(2, args.length()); DCHECK_EQ(2, args.length());
CONVERT_ARG_HANDLE_CHECKED(Object, thrown_object, 0); CONVERT_ARG_HANDLE_CHECKED(Object, thrown_object, 0);
CONVERT_ARG_HANDLE_CHECKED(ScopeInfo, scope_info, 1); CONVERT_ARG_HANDLE_CHECKED(ScopeInfo, scope_info, 1);
Handle<Context> current(isolate->context(), isolate); Handle<Context> current(isolate->context(), isolate);
Handle<Context> context = return *isolate->factory()->NewCatchContext(current, scope_info,
isolate->factory()->NewCatchContext(current, scope_info, thrown_object); thrown_object);
isolate->set_context(*context);
return *context;
} }
// TODO(jgruber): Rename these functions to 'New...Context'.
RUNTIME_FUNCTION(Runtime_PushBlockContext) { RUNTIME_FUNCTION(Runtime_PushBlockContext) {
HandleScope scope(isolate); HandleScope scope(isolate);
DCHECK_EQ(1, args.length()); DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(ScopeInfo, scope_info, 0); CONVERT_ARG_HANDLE_CHECKED(ScopeInfo, scope_info, 0);
Handle<Context> current(isolate->context(), isolate); Handle<Context> current(isolate->context(), isolate);
Handle<Context> context = return *isolate->factory()->NewBlockContext(current, scope_info);
isolate->factory()->NewBlockContext(current, scope_info);
isolate->set_context(*context);
return *context;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment