Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(370)

Side by Side Diff: src/api.cc

Issue 2407183002: [modules] Don't unnecessarily keep function alive after evaluation. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/factory.cc » ('j') | src/objects.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 1912 matching lines...) Expand 10 before | Expand all | Expand 10 after
1923 MaybeLocal<Value> Module::Evaluate(Local<Context> context) { 1923 MaybeLocal<Value> Module::Evaluate(Local<Context> context) {
1924 PREPARE_FOR_EXECUTION_WITH_CONTEXT_IN_RUNTIME_CALL_STATS_SCOPE( 1924 PREPARE_FOR_EXECUTION_WITH_CONTEXT_IN_RUNTIME_CALL_STATS_SCOPE(
1925 "v8", "V8.Execute", context, Module, Evaluate, MaybeLocal<Value>(), 1925 "v8", "V8.Execute", context, Module, Evaluate, MaybeLocal<Value>(),
1926 InternalEscapableScope, true); 1926 InternalEscapableScope, true);
1927 i::HistogramTimerScope execute_timer(isolate->counters()->execute(), true); 1927 i::HistogramTimerScope execute_timer(isolate->counters()->execute(), true);
1928 i::AggregatingHistogramTimerScope timer(isolate->counters()->compile_lazy()); 1928 i::AggregatingHistogramTimerScope timer(isolate->counters()->compile_lazy());
1929 i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate); 1929 i::TimerEventScope<i::TimerEventExecute> timer_scope(isolate);
1930 1930
1931 i::Handle<i::Module> self = Utils::OpenHandle(this); 1931 i::Handle<i::Module> self = Utils::OpenHandle(this);
1932 // It's an API error to call Evaluate before Instantiate. 1932 // It's an API error to call Evaluate before Instantiate.
1933 CHECK(self->code()->IsJSFunction()); 1933 CHECK(self->instantiated());
1934 1934
1935 Local<Value> result; 1935 Local<Value> result;
1936 has_pending_exception = !ToLocal(i::Module::Evaluate(self), &result); 1936 has_pending_exception = !ToLocal(i::Module::Evaluate(self), &result);
1937 RETURN_ON_FAILED_EXECUTION(Value); 1937 RETURN_ON_FAILED_EXECUTION(Value);
1938 RETURN_ESCAPED(result); 1938 RETURN_ESCAPED(result);
1939 } 1939 }
1940 1940
1941 MaybeLocal<UnboundScript> ScriptCompiler::CompileUnboundInternal( 1941 MaybeLocal<UnboundScript> ScriptCompiler::CompileUnboundInternal(
1942 Isolate* v8_isolate, Source* source, CompileOptions options, 1942 Isolate* v8_isolate, Source* source, CompileOptions options,
1943 bool is_module) { 1943 bool is_module) {
(...skipping 7473 matching lines...) Expand 10 before | Expand all | Expand 10 after
9417 Address callback_address = 9417 Address callback_address =
9418 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 9418 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
9419 VMState<EXTERNAL> state(isolate); 9419 VMState<EXTERNAL> state(isolate);
9420 ExternalCallbackScope call_scope(isolate, callback_address); 9420 ExternalCallbackScope call_scope(isolate, callback_address);
9421 callback(info); 9421 callback(info);
9422 } 9422 }
9423 9423
9424 9424
9425 } // namespace internal 9425 } // namespace internal
9426 } // namespace v8 9426 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/factory.cc » ('j') | src/objects.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698