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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // Temporarily disable cached metadata for streaming; it's | 130 resource->setCachedMetadata(streamer->cachedDataType(), reinterpret_
cast<const char*>(newCachedData->data), newCachedData->length, Resource::CacheLo
cally); |
131 // producing broken data. FIXME: enable it again. | |
132 // resource->setCachedMetadata(streamer->cachedDataType(), reinterpr
et_cast<const char*>(newCachedData->data), newCachedData->length); | |
133 } | 131 } |
134 } else if (!resource || !resource->url().protocolIsInHTTPFamily() || code->L
ength() < 1024) { | 132 } else if (!resource || !resource->url().protocolIsInHTTPFamily() || code->L
ength() < 1024) { |
135 v8::ScriptCompiler::Source source(code, origin); | 133 v8::ScriptCompiler::Source source(code, origin); |
136 script = v8::ScriptCompiler::Compile(isolate, &source, v8::ScriptCompile
r::kNoCompileOptions); | 134 script = v8::ScriptCompiler::Compile(isolate, &source, v8::ScriptCompile
r::kNoCompileOptions); |
137 } else { | 135 } else { |
138 switch (cacheOptions) { | 136 switch (cacheOptions) { |
139 case V8CacheOptionsParse: | 137 case V8CacheOptionsParse: |
140 cacheTag = tagForParserCache(); | 138 cacheTag = tagForParserCache(); |
141 script = resource->cachedMetadata(cacheTag) | 139 script = resource->cachedMetadata(cacheTag) |
142 ? compileAndConsumeCache(isolate, code, origin, resource, v8::Sc
riptCompiler::kConsumeParserCache, cacheTag) | 140 ? compileAndConsumeCache(isolate, code, origin, resource, v8::Sc
riptCompiler::kConsumeParserCache, cacheTag) |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 { | 290 { |
293 return StringHash::hash(v8::V8::GetVersion()) * 2; | 291 return StringHash::hash(v8::V8::GetVersion()) * 2; |
294 } | 292 } |
295 | 293 |
296 unsigned V8ScriptRunner::tagForCodeCache() | 294 unsigned V8ScriptRunner::tagForCodeCache() |
297 { | 295 { |
298 return StringHash::hash(v8::V8::GetVersion()) * 2 + 1; | 296 return StringHash::hash(v8::V8::GetVersion()) * 2 + 1; |
299 } | 297 } |
300 | 298 |
301 } // namespace blink | 299 } // namespace blink |
OLD | NEW |