| OLD | NEW |
| 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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 // Failed resources should never get this far. | 320 // Failed resources should never get this far. |
| 321 ASSERT(!resource->errorOccurred()); | 321 ASSERT(!resource->errorOccurred()); |
| 322 ASSERT(streamer->isFinished()); | 322 ASSERT(streamer->isFinished()); |
| 323 ASSERT(!streamer->streamingSuppressed()); | 323 ASSERT(!streamer->streamingSuppressed()); |
| 324 return WTF::bind<v8::Isolate*, v8::Local<v8::String>, v8::ScriptOrigin>(post
StreamCompile, cacheOptions, resource->cacheHandler(), streamer); | 324 return WTF::bind<v8::Isolate*, v8::Local<v8::String>, v8::ScriptOrigin>(post
StreamCompile, cacheOptions, resource->cacheHandler(), streamer); |
| 325 } | 325 } |
| 326 } // namespace | 326 } // namespace |
| 327 | 327 |
| 328 v8::MaybeLocal<v8::Script> V8ScriptRunner::compileScript(const ScriptSourceCode&
source, v8::Isolate* isolate, AccessControlStatus accessControlStatus, V8CacheO
ptions cacheOptions) | 328 v8::MaybeLocal<v8::Script> V8ScriptRunner::compileScript(const ScriptSourceCode&
source, v8::Isolate* isolate, AccessControlStatus accessControlStatus, V8CacheO
ptions cacheOptions) |
| 329 { | 329 { |
| 330 if (source.source().length() >= v8::String::kMaxLength) { | 330 if (source.source() && source.source()->length() >= v8::String::kMaxLength)
{ |
| 331 V8ThrowException::throwGeneralError(isolate, "Source file too large."); | 331 V8ThrowException::throwGeneralError(isolate, "Source file too large."); |
| 332 return v8::Local<v8::Script>(); | 332 return v8::Local<v8::Script>(); |
| 333 } | 333 } |
| 334 return compileScript(v8String(isolate, source.source()), source.url(), sourc
e.sourceMapUrl(), source.startPosition(), isolate, source.resource(), source.str
eamer(), source.resource() ? source.resource()->cacheHandler() : nullptr, access
ControlStatus, cacheOptions); | 334 return compileScript(v8String(isolate, source.source()), source.url(), sourc
e.sourceMapUrl(), source.startPosition(), isolate, source.resource(), source.str
eamer(), source.resource() ? source.resource()->cacheHandler() : nullptr, access
ControlStatus, cacheOptions); |
| 335 } | 335 } |
| 336 | 336 |
| 337 v8::MaybeLocal<v8::Script> V8ScriptRunner::compileScript(const String& code, con
st String& fileName, const String& sourceMapUrl, const TextPosition& textPositio
n, v8::Isolate* isolate, CachedMetadataHandler* cacheMetadataHandler, AccessCont
rolStatus accessControlStatus, V8CacheOptions v8CacheOptions) | 337 v8::MaybeLocal<v8::Script> V8ScriptRunner::compileScript(PassRefPtr<Compressable
String> code, const String& fileName, const String& sourceMapUrl, const TextPosi
tion& textPosition, v8::Isolate* isolate, CachedMetadataHandler* cacheMetadataHa
ndler, AccessControlStatus accessControlStatus, V8CacheOptions v8CacheOptions) |
| 338 { | 338 { |
| 339 if (code.length() >= v8::String::kMaxLength) { | 339 if (code->length() >= v8::String::kMaxLength) { |
| 340 V8ThrowException::throwGeneralError(isolate, "Source file too large."); | 340 V8ThrowException::throwGeneralError(isolate, "Source file too large."); |
| 341 return v8::Local<v8::Script>(); | 341 return v8::Local<v8::Script>(); |
| 342 } | 342 } |
| 343 return compileScript(v8String(isolate, code), fileName, sourceMapUrl, textPo
sition, isolate, nullptr, nullptr, cacheMetadataHandler, accessControlStatus, v8
CacheOptions); | 343 return compileScript(v8String(isolate, code), fileName, sourceMapUrl, textPo
sition, isolate, nullptr, nullptr, cacheMetadataHandler, accessControlStatus, v8
CacheOptions); |
| 344 } | 344 } |
| 345 | 345 |
| 346 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) | 346 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) |
| 347 { | 347 { |
| 348 TRACE_EVENT2("v8,devtools.timeline", "v8.compile", "fileName", fileName.utf8
(), "data", InspectorCompileScriptEvent::data(fileName, scriptStartPosition)); | 348 TRACE_EVENT2("v8,devtools.timeline", "v8.compile", "fileName", fileName.utf8
(), "data", InspectorCompileScriptEvent::data(fileName, scriptStartPosition)); |
| 349 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Compile"); | 349 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Compile"); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 { | 494 { |
| 495 return cacheTag(CacheTagParser, cacheHandler); | 495 return cacheTag(CacheTagParser, cacheHandler); |
| 496 } | 496 } |
| 497 | 497 |
| 498 unsigned V8ScriptRunner::tagForCodeCache(CachedMetadataHandler* cacheHandler) | 498 unsigned V8ScriptRunner::tagForCodeCache(CachedMetadataHandler* cacheHandler) |
| 499 { | 499 { |
| 500 return cacheTag(CacheTagCode, cacheHandler); | 500 return cacheTag(CacheTagCode, cacheHandler); |
| 501 } | 501 } |
| 502 | 502 |
| 503 } // namespace blink | 503 } // namespace blink |
| OLD | NEW |