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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp

Issue 2179943002: Remove isInternalFlag from V8ScriptRunner interface in blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | « third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.h ('k') | no next file » | 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 353
354 v8::MaybeLocal<v8::Script> V8ScriptRunner::compileScript(const CompressibleStrin g& code, const String& fileName, const String& sourceMapUrl, const TextPosition& textPosition, v8::Isolate* isolate, CachedMetadataHandler* cacheMetadataHandler , AccessControlStatus accessControlStatus, V8CacheOptions v8CacheOptions) 354 v8::MaybeLocal<v8::Script> V8ScriptRunner::compileScript(const CompressibleStrin g& code, const String& fileName, const String& sourceMapUrl, const TextPosition& textPosition, v8::Isolate* isolate, CachedMetadataHandler* cacheMetadataHandler , AccessControlStatus accessControlStatus, V8CacheOptions v8CacheOptions)
355 { 355 {
356 if (code.length() >= v8::String::kMaxLength) { 356 if (code.length() >= v8::String::kMaxLength) {
357 V8ThrowException::throwGeneralError(isolate, "Source file too large."); 357 V8ThrowException::throwGeneralError(isolate, "Source file too large.");
358 return v8::Local<v8::Script>(); 358 return v8::Local<v8::Script>();
359 } 359 }
360 return compileScript(v8String(isolate, code), fileName, sourceMapUrl, textPo sition, isolate, nullptr, nullptr, cacheMetadataHandler, accessControlStatus, v8 CacheOptions); 360 return compileScript(v8String(isolate, code), fileName, sourceMapUrl, textPo sition, isolate, nullptr, nullptr, cacheMetadataHandler, accessControlStatus, v8 CacheOptions);
361 } 361 }
362 362
363 v8::MaybeLocal<v8::Script> V8ScriptRunner::compileScript(v8::Local<v8::String> c ode, const String& fileName, const String& sourceMapUrl, const TextPosition& scr iptStartPosition, v8::Isolate* isolate, ScriptResource* resource, ScriptStreamer * streamer, CachedMetadataHandler* cacheHandler, AccessControlStatus accessContr olStatus, V8CacheOptions cacheOptions, bool isInternalScript) 363 v8::MaybeLocal<v8::Script> V8ScriptRunner::compileScript(v8::Local<v8::String> c ode, const String& fileName, const String& sourceMapUrl, const TextPosition& scr iptStartPosition, v8::Isolate* isolate, ScriptResource* resource, ScriptStreamer * streamer, CachedMetadataHandler* cacheHandler, AccessControlStatus accessContr olStatus, V8CacheOptions cacheOptions)
364 { 364 {
365 TRACE_EVENT2("v8,devtools.timeline", "v8.compile", "fileName", fileName.utf8 (), "data", InspectorCompileScriptEvent::data(fileName, scriptStartPosition)); 365 TRACE_EVENT2("v8,devtools.timeline", "v8.compile", "fileName", fileName.utf8 (), "data", InspectorCompileScriptEvent::data(fileName, scriptStartPosition));
366 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Compile"); 366 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Compile");
367 367
368 ASSERT(!streamer || resource); 368 ASSERT(!streamer || resource);
369 ASSERT(!resource || resource->cacheHandler() == cacheHandler); 369 ASSERT(!resource || resource->cacheHandler() == cacheHandler);
370 370
371 // NOTE: For compatibility with WebCore, ScriptSourceCode's line starts at 371 // NOTE: For compatibility with WebCore, ScriptSourceCode's line starts at
372 // 1, whereas v8 starts at 0. 372 // 1, whereas v8 starts at 0.
373 v8::ScriptOrigin origin( 373 v8::ScriptOrigin origin(
374 v8String(isolate, fileName), 374 v8String(isolate, fileName),
375 v8::Integer::New(isolate, scriptStartPosition.m_line.zeroBasedInt()), 375 v8::Integer::New(isolate, scriptStartPosition.m_line.zeroBasedInt()),
376 v8::Integer::New(isolate, scriptStartPosition.m_column.zeroBasedInt()), 376 v8::Integer::New(isolate, scriptStartPosition.m_column.zeroBasedInt()),
377 v8Boolean(accessControlStatus == SharableCrossOrigin, isolate), 377 v8Boolean(accessControlStatus == SharableCrossOrigin, isolate),
378 v8::Local<v8::Integer>(), 378 v8::Local<v8::Integer>(),
379 v8Boolean(isInternalScript, isolate), 379 v8Boolean(false, isolate),
380 v8String(isolate, sourceMapUrl), 380 v8String(isolate, sourceMapUrl),
381 v8Boolean(accessControlStatus == OpaqueResource, isolate)); 381 v8Boolean(accessControlStatus == OpaqueResource, isolate));
382 382
383 V8CompileHistogram::Cacheability cacheabilityIfNoHandler = V8CompileHistogra m::Cacheability::Noncacheable; 383 V8CompileHistogram::Cacheability cacheabilityIfNoHandler = V8CompileHistogra m::Cacheability::Noncacheable;
384 if (!cacheHandler && (scriptStartPosition.m_line.zeroBasedInt() == 0) && (sc riptStartPosition.m_column.zeroBasedInt() == 0)) 384 if (!cacheHandler && (scriptStartPosition.m_line.zeroBasedInt() == 0) && (sc riptStartPosition.m_column.zeroBasedInt() == 0))
385 cacheabilityIfNoHandler = V8CompileHistogram::Cacheability::InlineScript ; 385 cacheabilityIfNoHandler = V8CompileHistogram::Cacheability::InlineScript ;
386 386
387 std::unique_ptr<CompileFn> compileFn = streamer 387 std::unique_ptr<CompileFn> compileFn = streamer
388 ? selectCompileFunction(cacheOptions, resource, streamer) 388 ? selectCompileFunction(cacheOptions, resource, streamer)
389 : selectCompileFunction(cacheOptions, cacheHandler, code, cacheabilityIf NoHandler); 389 : selectCompileFunction(cacheOptions, cacheHandler, code, cacheabilityIf NoHandler);
(...skipping 26 matching lines...) Expand all
416 ThreadDebugger::didExecuteScript(isolate); 416 ThreadDebugger::didExecuteScript(isolate);
417 } 417 }
418 418
419 crashIfIsolateIsDead(isolate); 419 crashIfIsolateIsDead(isolate);
420 return result; 420 return result;
421 } 421 }
422 422
423 v8::MaybeLocal<v8::Value> V8ScriptRunner::compileAndRunInternalScript(v8::Local< v8::String> source, v8::Isolate* isolate, const String& fileName, const TextPosi tion& scriptStartPosition) 423 v8::MaybeLocal<v8::Value> V8ScriptRunner::compileAndRunInternalScript(v8::Local< v8::String> source, v8::Isolate* isolate, const String& fileName, const TextPosi tion& scriptStartPosition)
424 { 424 {
425 v8::Local<v8::Script> script; 425 v8::Local<v8::Script> script;
426 if (!V8ScriptRunner::compileScript(source, fileName, String(), scriptStartPo sition, isolate, nullptr, nullptr, nullptr, SharableCrossOrigin, V8CacheOptionsD efault, true).ToLocal(&script)) 426 if (!V8ScriptRunner::compileScript(source, fileName, String(), scriptStartPo sition, isolate, nullptr, nullptr, nullptr, SharableCrossOrigin, V8CacheOptionsD efault).ToLocal(&script))
427 return v8::MaybeLocal<v8::Value>(); 427 return v8::MaybeLocal<v8::Value>();
428 428
429 TRACE_EVENT0("v8", "v8.run"); 429 TRACE_EVENT0("v8", "v8.run");
430 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); 430 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution");
431 v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunM icrotasks); 431 v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunM icrotasks);
432 v8::MaybeLocal<v8::Value> result = script->Run(isolate->GetCurrentContext()) ; 432 v8::MaybeLocal<v8::Value> result = script->Run(isolate->GetCurrentContext()) ;
433 crashIfIsolateIsDead(isolate); 433 crashIfIsolateIsDead(isolate);
434 return result; 434 return result;
435 } 435 }
436 436
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 // Store a timestamp to the cache as hint. 576 // Store a timestamp to the cache as hint.
577 void V8ScriptRunner::setCacheTimeStamp(CachedMetadataHandler* cacheHandler) 577 void V8ScriptRunner::setCacheTimeStamp(CachedMetadataHandler* cacheHandler)
578 { 578 {
579 double now = WTF::currentTime(); 579 double now = WTF::currentTime();
580 unsigned tag = cacheTag(CacheTagTimeStamp, cacheHandler); 580 unsigned tag = cacheTag(CacheTagTimeStamp, cacheHandler);
581 cacheHandler->clearCachedMetadata(CachedMetadataHandler::CacheLocally); 581 cacheHandler->clearCachedMetadata(CachedMetadataHandler::CacheLocally);
582 cacheHandler->setCachedMetadata(tag, reinterpret_cast<char*>(&now), sizeof(n ow), CachedMetadataHandler::SendToPlatform); 582 cacheHandler->setCachedMetadata(tag, reinterpret_cast<char*>(&now), sizeof(n ow), CachedMetadataHandler::SendToPlatform);
583 } 583 }
584 584
585 } // namespace blink 585 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698