Changeset 61499 in webkit
- Timestamp:
- Jun 19, 2010 5:38:00 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r61498 r61499 1 2010-06-19 Tony Gentilcore <tonyg@chromium.org> 2 3 Reviewed by Adam Barth. 4 5 Persist V8's ScriptData to the memory cache. 6 https://bugs.webkit.org/show_bug.cgi?id=38661 7 8 When V8 ScriptData caching was originally submitted it causes crashes 9 in external scripts with high-byte characters. This new test crashes on 10 the original code, but now passes. 11 12 * fast/js/parser-high-byte-character-expected.txt: Added. 13 * fast/js/parser-high-byte-character.html: Added. 14 * fast/js/script-tests/parser-high-byte-character.js: Added. 15 (runTest): 16 1 17 2010-06-19 Dimitri Glazkov <dglazkov@chromium.org> 2 18 -
trunk/WebCore/ChangeLog
r61496 r61499 1 2010-06-19 Tony Gentilcore <tonyg@chromium.org> 2 3 Reviewed by Adam Barth. 4 5 Persist V8's ScriptData to the memory cache. 6 https://bugs.webkit.org/show_bug.cgi?id=38661 7 8 This stores V8's ScriptData in the memory cache and also causes the 9 network platform layer to be notified of the available cacheable 10 metadata. 11 12 Chromium's morejs benchmark showed a ~7% improvement when this was 13 originally submitted (before it had to be rolled back). 14 15 Test: fast/js/parser-high-byte-character.html 16 17 * bindings/v8/ScriptSourceCode.h: 18 (WebCore::ScriptSourceCode::ScriptSourceCode): 19 (WebCore::ScriptSourceCode::cachedScript): 20 * bindings/v8/V8Proxy.cpp: 21 (WebCore::V8Proxy::compileScript): 22 (WebCore::V8Proxy::precompileScript): 23 (WebCore::V8Proxy::evaluate): 24 * bindings/v8/V8Proxy.h: 25 1 26 2010-06-19 Kwang Yul Seo <skyul@company100.net> 2 27 -
trunk/WebCore/bindings/v8/ScriptSourceCode.h
r61408 r61499 32 32 #define ScriptSourceCode_h 33 33 34 #include "CachedResourceHandle.h" 34 35 #include "CachedScript.h" 35 36 #include "KURL.h" … … 42 43 ScriptSourceCode(const String& source, const KURL& url = KURL(), int startLine = 1) 43 44 : m_source(source) 45 , m_cachedScript(0) 44 46 , m_url(url) 45 47 , m_startLine(startLine) … … 51 53 ScriptSourceCode(CachedScript* cs) 52 54 : m_source(cs->script()) 55 , m_cachedScript(cs) 53 56 , m_url(ParsedURLString, cs->url()) 54 57 , m_startLine(1) … … 59 62 60 63 const String& source() const { return m_source; } 64 CachedScript* cachedScript() const { return m_cachedScript.get(); } 61 65 const KURL& url() const { return m_url; } 62 66 int startLine() const { return m_startLine; } … … 64 68 private: 65 69 String m_source; 70 CachedResourceHandle<CachedScript> m_cachedScript; 66 71 KURL m_url; 67 72 int m_startLine; -
trunk/WebCore/bindings/v8/V8Proxy.cpp
r61408 r61499 33 33 34 34 #include "CSSMutableStyleDeclaration.h" 35 #include "CachedMetadata.h" 35 36 #include "DateExtension.h" 36 37 #include "DocumentLoader.h" … … 70 71 #include <wtf/Assertions.h> 71 72 #include <wtf/OwnArrayPtr.h> 73 #include <wtf/OwnPtr.h> 72 74 #include <wtf/StdLibExtras.h> 73 75 #include <wtf/StringExtras.h> … … 233 235 } 234 236 235 v8::Handle<v8::Script> V8Proxy::compileScript(v8::Handle<v8::String> code, const String& fileName, int baseLine )237 v8::Handle<v8::Script> V8Proxy::compileScript(v8::Handle<v8::String> code, const String& fileName, int baseLine, v8::ScriptData* scriptData) 236 238 { 237 239 const uint16_t* fileNameString = fromWebCoreString(fileName); … … 239 241 v8::Handle<v8::Integer> line = v8::Integer::New(baseLine); 240 242 v8::ScriptOrigin origin(name, line); 241 v8::Handle<v8::Script> script = v8::Script::Compile(code, &origin );243 v8::Handle<v8::Script> script = v8::Script::Compile(code, &origin, scriptData); 242 244 return script; 243 245 } … … 338 340 } 339 341 342 PassOwnPtr<v8::ScriptData> V8Proxy::precompileScript(v8::Handle<v8::String> code, CachedScript* cachedScript) 343 { 344 // A pseudo-randomly chosen ID used to store and retrieve V8 ScriptData from 345 // the CachedScript. If the format changes, this ID should be changed too. 346 static const unsigned dataTypeID = 0xECC13BD7; 347 348 // Very small scripts are not worth the effort to preparse. 349 static const int minPreparseLength = 1024; 350 351 if (!cachedScript || code->Length() < minPreparseLength) 352 return 0; 353 354 CachedMetadata* cachedMetadata = cachedScript->cachedMetadata(dataTypeID); 355 if (cachedMetadata) 356 return v8::ScriptData::New(cachedMetadata->data(), cachedMetadata->size()); 357 358 OwnPtr<v8::ScriptData> scriptData(v8::ScriptData::PreCompile(code)); 359 cachedScript->setCachedMetadata(dataTypeID, scriptData->Data(), scriptData->Length()); 360 361 return scriptData.release(); 362 } 363 340 364 v8::Local<v8::Value> V8Proxy::evaluate(const ScriptSourceCode& source, Node* node) 341 365 { … … 363 387 PlatformBridge::traceEventBegin("v8.compile", node, ""); 364 388 #endif 389 OwnPtr<v8::ScriptData> scriptData = precompileScript(code, source.cachedScript()); 365 390 366 391 // NOTE: For compatibility with WebCore, ScriptSourceCode's line starts at 367 392 // 1, whereas v8 starts at 0. 368 v8::Handle<v8::Script> script = compileScript(code, source.url(), source.startLine() - 1 );393 v8::Handle<v8::Script> script = compileScript(code, source.url(), source.startLine() - 1, scriptData.get()); 369 394 #if PLATFORM(CHROMIUM) 370 395 PlatformBridge::traceEventEnd("v8.compile", node, ""); -
trunk/WebCore/bindings/v8/V8Proxy.h
r61408 r61499 54 54 namespace WebCore { 55 55 56 class CachedScript; 56 57 class DOMWindow; 57 58 class Frame; … … 286 287 static v8::Handle<v8::Value> checkNewLegal(const v8::Arguments&); 287 288 288 static v8::Handle<v8::Script> compileScript(v8::Handle<v8::String> code, const String& fileName, int baseLine );289 static v8::Handle<v8::Script> compileScript(v8::Handle<v8::String> code, const String& fileName, int baseLine, v8::ScriptData* = 0); 289 290 290 291 // If the exception code is different from zero, a DOM exception is … … 342 343 void resetIsolatedWorlds(); 343 344 345 PassOwnPtr<v8::ScriptData> precompileScript(v8::Handle<v8::String>, CachedScript*); 346 344 347 // Returns false when we're out of memory in V8. 345 348 bool setInjectedScriptContextDebugId(v8::Handle<v8::Context> targetContext);
Note: See TracChangeset
for help on using the changeset viewer.