| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 V8CompileHistogram::V8CompileHistogram(V8CompileHistogram::Cacheability cacheabi
lity) | 69 V8CompileHistogram::V8CompileHistogram(V8CompileHistogram::Cacheability cacheabi
lity) |
| 70 : m_cacheability(cacheability) | 70 : m_cacheability(cacheability) |
| 71 , m_timeStamp(WTF::currentTime()) | 71 , m_timeStamp(WTF::currentTime()) |
| 72 { | 72 { |
| 73 } | 73 } |
| 74 | 74 |
| 75 V8CompileHistogram::~V8CompileHistogram() | 75 V8CompileHistogram::~V8CompileHistogram() |
| 76 { | 76 { |
| 77 int64_t elapsedMicroSeconds = static_cast<int64_t>((WTF::currentTime() - m_t
imeStamp) * 1000000); | 77 int64_t elapsedMicroSeconds = static_cast<int64_t>((WTF::currentTime() - m_t
imeStamp) * 1000000); |
| 78 const char* name = (m_cacheability == Cacheable) ? "V8.CompileCacheableMicro
Seconds" : "V8.CompileNoncacheableMicroSeconds"; | 78 const char* name = (m_cacheability == Cacheable) ? "V8.CompileCacheableMicro
Seconds" : "V8.CompileNoncacheableMicroSeconds"; |
| 79 blink::Platform::current()->histogramCustomCounts(name, elapsedMicroSeconds,
0, 1000000, 50); | 79 Platform::current()->histogramCustomCounts(name, elapsedMicroSeconds, 0, 100
0000, 50); |
| 80 } | 80 } |
| 81 | 81 |
| 82 // In order to make sure all pending messages to be processed in | 82 // In order to make sure all pending messages to be processed in |
| 83 // v8::Function::Call, we don't call throwStackOverflowException | 83 // v8::Function::Call, we don't call throwStackOverflowException |
| 84 // directly. Instead, we create a v8::Function of | 84 // directly. Instead, we create a v8::Function of |
| 85 // throwStackOverflowException and call it. | 85 // throwStackOverflowException and call it. |
| 86 void throwStackOverflowException(const v8::FunctionCallbackInfo<v8::Value>& info
) | 86 void throwStackOverflowException(const v8::FunctionCallbackInfo<v8::Value>& info
) |
| 87 { | 87 { |
| 88 V8ThrowException::throwRangeError(info.GetIsolate(), "Maximum call stack siz
e exceeded."); | 88 V8ThrowException::throwRangeError(info.GetIsolate(), "Maximum call stack siz
e exceeded."); |
| 89 } | 89 } |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 int length = cachedData->length; | 159 int length = cachedData->length; |
| 160 std::string compressedOutput; | 160 std::string compressedOutput; |
| 161 if (compressed) { | 161 if (compressed) { |
| 162 snappy::Compress(data, length, &compressedOutput); | 162 snappy::Compress(data, length, &compressedOutput); |
| 163 data = compressedOutput.data(); | 163 data = compressedOutput.data(); |
| 164 length = compressedOutput.length(); | 164 length = compressedOutput.length(); |
| 165 } | 165 } |
| 166 if (length > 1024) { | 166 if (length > 1024) { |
| 167 // Omit histogram samples for small cache data to avoid outliers. | 167 // Omit histogram samples for small cache data to avoid outliers. |
| 168 int cacheSizeRatio = static_cast<int>(100.0 * length / code->Length(
)); | 168 int cacheSizeRatio = static_cast<int>(100.0 * length / code->Length(
)); |
| 169 blink::Platform::current()->histogramCustomCounts("V8.CodeCacheSizeR
atio", cacheSizeRatio, 0, 10000, 50); | 169 Platform::current()->histogramCustomCounts("V8.CodeCacheSizeRatio",
cacheSizeRatio, 0, 10000, 50); |
| 170 } | 170 } |
| 171 cacheHandler->clearCachedMetadata(CachedMetadataHandler::CacheLocally); | 171 cacheHandler->clearCachedMetadata(CachedMetadataHandler::CacheLocally); |
| 172 cacheHandler->setCachedMetadata(tag, data, length, cacheType); | 172 cacheHandler->setCachedMetadata(tag, data, length, cacheType); |
| 173 } | 173 } |
| 174 return script; | 174 return script; |
| 175 } | 175 } |
| 176 | 176 |
| 177 // Compile a script, and consume or produce a V8 Cache, depending on whether the | 177 // Compile a script, and consume or produce a V8 Cache, depending on whether the |
| 178 // given resource already has cached data available. | 178 // given resource already has cached data available. |
| 179 v8::MaybeLocal<v8::Script> compileAndConsumeOrProduce(CachedMetadataHandler* cac
heHandler, unsigned tag, v8::ScriptCompiler::CompileOptions consumeOptions, v8::
ScriptCompiler::CompileOptions produceOptions, bool compressed, CachedMetadataHa
ndler::CacheType cacheType, v8::Isolate* isolate, v8::Local<v8::String> code, v8
::ScriptOrigin origin) | 179 v8::MaybeLocal<v8::Script> compileAndConsumeOrProduce(CachedMetadataHandler* cac
heHandler, unsigned tag, v8::ScriptCompiler::CompileOptions consumeOptions, v8::
ScriptCompiler::CompileOptions produceOptions, bool compressed, CachedMetadataHa
ndler::CacheType cacheType, v8::Isolate* isolate, v8::Local<v8::String> code, v8
::ScriptOrigin origin) |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 { | 538 { |
| 539 return cacheTag(CacheTagParser, cacheHandler); | 539 return cacheTag(CacheTagParser, cacheHandler); |
| 540 } | 540 } |
| 541 | 541 |
| 542 unsigned V8ScriptRunner::tagForCodeCache(CachedMetadataHandler* cacheHandler) | 542 unsigned V8ScriptRunner::tagForCodeCache(CachedMetadataHandler* cacheHandler) |
| 543 { | 543 { |
| 544 return cacheTag(CacheTagCode, cacheHandler); | 544 return cacheTag(CacheTagCode, cacheHandler); |
| 545 } | 545 } |
| 546 | 546 |
| 547 } // namespace blink | 547 } // namespace blink |
| OLD | NEW |