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

Side by Side Diff: Source/bindings/core/v8/ScriptController.cpp

Issue 432273004: Implement Blink-side changes to enable V8 code caching. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix very silly bug that causes an unitialized field and a CHECK fail at startup. Created 6 years, 4 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 | Source/bindings/core/v8/V8CacheOptions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2009 Apple Inc. All rights reserved. 3 * Copyright (C) 2009 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 167
168 v8::Local<v8::Value> ScriptController::executeScriptAndReturnValue(v8::Handle<v8 ::Context> context, const ScriptSourceCode& source, AccessControlStatus corsStat us) 168 v8::Local<v8::Value> ScriptController::executeScriptAndReturnValue(v8::Handle<v8 ::Context> context, const ScriptSourceCode& source, AccessControlStatus corsStat us)
169 { 169 {
170 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "EvaluateScript ", "data", InspectorEvaluateScriptEvent::data(m_frame, source.url().string(), so urce.startLine())); 170 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "EvaluateScript ", "data", InspectorEvaluateScriptEvent::data(m_frame, source.url().string(), so urce.startLine()));
171 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), " CallStack", "stack", InspectorCallStackEvent::currentCallStack()); 171 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), " CallStack", "stack", InspectorCallStackEvent::currentCallStack());
172 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli ne migrates to tracing. 172 // FIXME(361045): remove InspectorInstrumentation calls once DevTools Timeli ne migrates to tracing.
173 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willEvalua teScript(m_frame, source.url().string(), source.startLine()); 173 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willEvalua teScript(m_frame, source.url().string(), source.startLine());
174 174
175 v8::Local<v8::Value> result; 175 v8::Local<v8::Value> result;
176 { 176 {
177 V8CacheOptions v8CacheOptions(V8CacheOptionsOff);
178 if (m_frame->settings())
179 v8CacheOptions = m_frame->settings()->v8CacheOptions();
180
177 // Isolate exceptions that occur when compiling and executing 181 // Isolate exceptions that occur when compiling and executing
178 // the code. These exceptions should not interfere with 182 // the code. These exceptions should not interfere with
179 // javascript code we might evaluate from C++ when returning 183 // javascript code we might evaluate from C++ when returning
180 // from here. 184 // from here.
181 v8::TryCatch tryCatch; 185 v8::TryCatch tryCatch;
182 tryCatch.SetVerbose(true); 186 tryCatch.SetVerbose(true);
183 187
184 v8::Handle<v8::Script> script = V8ScriptRunner::compileScript(source, m_ isolate, corsStatus); 188 v8::Handle<v8::Script> script = V8ScriptRunner::compileScript(source, m_ isolate, corsStatus, v8CacheOptions);
185 189
186 // Keep LocalFrame (and therefore ScriptController) alive. 190 // Keep LocalFrame (and therefore ScriptController) alive.
187 RefPtr<LocalFrame> protect(m_frame); 191 RefPtr<LocalFrame> protect(m_frame);
188 result = V8ScriptRunner::runCompiledScript(script, m_frame->document(), m_isolate); 192 result = V8ScriptRunner::runCompiledScript(script, m_frame->document(), m_isolate);
189 ASSERT(!tryCatch.HasCaught() || result.IsEmpty()); 193 ASSERT(!tryCatch.HasCaught() || result.IsEmpty());
190 } 194 }
191 195
192 InspectorInstrumentation::didEvaluateScript(cookie); 196 InspectorInstrumentation::didEvaluateScript(cookie);
193 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update Counters", "data", InspectorUpdateCountersEvent::data()); 197 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update Counters", "data", InspectorUpdateCountersEvent::data());
194 198
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 resultArray->Set(i, evaluationResult); 632 resultArray->Set(i, evaluationResult);
629 } 633 }
630 634
631 if (results) { 635 if (results) {
632 for (size_t i = 0; i < resultArray->Length(); ++i) 636 for (size_t i = 0; i < resultArray->Length(); ++i)
633 results->append(handleScope.Escape(resultArray->Get(i))); 637 results->append(handleScope.Escape(resultArray->Get(i)));
634 } 638 }
635 } 639 }
636 640
637 } // namespace blink 641 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/core/v8/V8CacheOptions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698