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

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

Issue 705953002: Script streaming: turn off cached data to prevent crashes. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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 | « Source/bindings/core/v8/ScriptStreamer.cpp ('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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // Failed resources should never get this far. 120 // Failed resources should never get this far.
121 ASSERT(!resource->errorOccurred()); 121 ASSERT(!resource->errorOccurred());
122 ASSERT(streamer->isFinished()); 122 ASSERT(streamer->isFinished());
123 ASSERT(!streamer->streamingSuppressed()); 123 ASSERT(!streamer->streamingSuppressed());
124 script = v8::ScriptCompiler::Compile(isolate, streamer->source(), code, origin); 124 script = v8::ScriptCompiler::Compile(isolate, streamer->source(), code, origin);
125 // Whether to produce the cached data or not is decided when the 125 // Whether to produce the cached data or not is decided when the
126 // streamer is started. Here we only need to get the data out. 126 // streamer is started. Here we only need to get the data out.
127 const v8::ScriptCompiler::CachedData* newCachedData = streamer->source() ->GetCachedData(); 127 const v8::ScriptCompiler::CachedData* newCachedData = streamer->source() ->GetCachedData();
128 if (newCachedData) { 128 if (newCachedData) {
129 resource->clearCachedMetadata(); 129 resource->clearCachedMetadata();
130 resource->setCachedMetadata(streamer->cachedDataType(), reinterpret_ cast<const char*>(newCachedData->data), newCachedData->length); 130 // Temporarily disable cached metadata for streaming; it's
131 // producing broken data. FIXME: enable it again.
132 // resource->setCachedMetadata(streamer->cachedDataType(), reinterpr et_cast<const char*>(newCachedData->data), newCachedData->length);
131 } 133 }
132 } else if (!resource || !resource->url().protocolIsInHTTPFamily() || code->L ength() < 1024) { 134 } else if (!resource || !resource->url().protocolIsInHTTPFamily() || code->L ength() < 1024) {
133 v8::ScriptCompiler::Source source(code, origin); 135 v8::ScriptCompiler::Source source(code, origin);
134 script = v8::ScriptCompiler::Compile(isolate, &source, v8::ScriptCompile r::kNoCompileOptions); 136 script = v8::ScriptCompiler::Compile(isolate, &source, v8::ScriptCompile r::kNoCompileOptions);
135 } else { 137 } else {
136 switch (cacheOptions) { 138 switch (cacheOptions) {
137 case V8CacheOptionsParse: 139 case V8CacheOptionsParse:
138 cacheTag = tagForParserCache(); 140 cacheTag = tagForParserCache();
139 script = resource->cachedMetadata(cacheTag) 141 script = resource->cachedMetadata(cacheTag)
140 ? compileAndConsumeCache(isolate, code, origin, resource, v8::Sc riptCompiler::kConsumeParserCache, cacheTag) 142 ? compileAndConsumeCache(isolate, code, origin, resource, v8::Sc riptCompiler::kConsumeParserCache, cacheTag)
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 { 292 {
291 return StringHash::hash(v8::V8::GetVersion()) * 2; 293 return StringHash::hash(v8::V8::GetVersion()) * 2;
292 } 294 }
293 295
294 unsigned V8ScriptRunner::tagForCodeCache() 296 unsigned V8ScriptRunner::tagForCodeCache()
295 { 297 {
296 return StringHash::hash(v8::V8::GetVersion()) * 2 + 1; 298 return StringHash::hash(v8::V8::GetVersion()) * 2 + 1;
297 } 299 }
298 300
299 } // namespace blink 301 } // namespace blink
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/ScriptStreamer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698