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

Unified Diff: src/runtime.cc

Issue 10990076: Short term JSON eval cache Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 3 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime.h ('k') | src/v8.cc » ('j') | src/v8.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
===================================================================
--- src/runtime.cc (revision 12582)
+++ src/runtime.cc (working copy)
@@ -13100,6 +13100,46 @@
}
+RUNTIME_FUNCTION(MaybeObject*,
+ Runtime_GetShortTermEvalCompilationCacheStatistics) {
+ if (!FLAG_json_eval_cache) return isolate->heap()->undefined_value();
+ HandleScope scope(isolate);
+
+ const int kValueCount = 4;
+ const char* keys[kValueCount] = { "entryCount",
+ "maxEntries",
+ "totalSize",
+ "maxTotalSize" };
+ int values[kValueCount];
+ isolate->compilation_cache()->GetShortTermEvalStatistics(&values[0],
+ &values[1],
+ &values[2],
+ &values[3]);
+
+ Handle<JSObject> result =
+ isolate->factory()->NewJSObject(isolate->object_function());
+ PropertyAttributes attribs = NONE;
+
+ for (int i = 0; i < kValueCount; i++) {
+ Handle<String> key =
+ isolate->factory()->LookupAsciiSymbol(CStrVector(keys[i]));
+ Handle<Object> value(Smi::FromInt(values[i]));
+ RETURN_IF_EMPTY_HANDLE(isolate,
+ SetProperty(result, key, value, attribs, kStrictMode));
+ }
+
+ return *result;
+}
+
+
+RUNTIME_FUNCTION(MaybeObject*, Runtime_ClearShortTermCompilationCache) {
+ bool result = isolate->compilation_cache()->ClearShortTerm();
+ return result
+ ? isolate->heap()->true_value()
+ : isolate->heap()->false_value();
+}
+
+
#ifdef DEBUG
// ListNatives is ONLY used by the fuzz-natives.js in debug mode
// Exclude the code in release mode.
« no previous file with comments | « src/runtime.h ('k') | src/v8.cc » ('j') | src/v8.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698