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

Side by Side 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, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/runtime.h ('k') | src/v8.cc » ('j') | src/v8.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 13082 matching lines...) Expand 10 before | Expand all | Expand 10 after
13093 return Smi::FromInt(message->start_position()); 13093 return Smi::FromInt(message->start_position());
13094 } 13094 }
13095 13095
13096 13096
13097 RUNTIME_FUNCTION(MaybeObject*, Runtime_MessageGetScript) { 13097 RUNTIME_FUNCTION(MaybeObject*, Runtime_MessageGetScript) {
13098 CONVERT_ARG_CHECKED(JSMessageObject, message, 0); 13098 CONVERT_ARG_CHECKED(JSMessageObject, message, 0);
13099 return message->script(); 13099 return message->script();
13100 } 13100 }
13101 13101
13102 13102
13103 RUNTIME_FUNCTION(MaybeObject*,
13104 Runtime_GetShortTermEvalCompilationCacheStatistics) {
13105 if (!FLAG_json_eval_cache) return isolate->heap()->undefined_value();
13106 HandleScope scope(isolate);
13107
13108 const int kValueCount = 4;
13109 const char* keys[kValueCount] = { "entryCount",
13110 "maxEntries",
13111 "totalSize",
13112 "maxTotalSize" };
13113 int values[kValueCount];
13114 isolate->compilation_cache()->GetShortTermEvalStatistics(&values[0],
13115 &values[1],
13116 &values[2],
13117 &values[3]);
13118
13119 Handle<JSObject> result =
13120 isolate->factory()->NewJSObject(isolate->object_function());
13121 PropertyAttributes attribs = NONE;
13122
13123 for (int i = 0; i < kValueCount; i++) {
13124 Handle<String> key =
13125 isolate->factory()->LookupAsciiSymbol(CStrVector(keys[i]));
13126 Handle<Object> value(Smi::FromInt(values[i]));
13127 RETURN_IF_EMPTY_HANDLE(isolate,
13128 SetProperty(result, key, value, attribs, kStrictMode));
13129 }
13130
13131 return *result;
13132 }
13133
13134
13135 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClearShortTermCompilationCache) {
13136 bool result = isolate->compilation_cache()->ClearShortTerm();
13137 return result
13138 ? isolate->heap()->true_value()
13139 : isolate->heap()->false_value();
13140 }
13141
13142
13103 #ifdef DEBUG 13143 #ifdef DEBUG
13104 // ListNatives is ONLY used by the fuzz-natives.js in debug mode 13144 // ListNatives is ONLY used by the fuzz-natives.js in debug mode
13105 // Exclude the code in release mode. 13145 // Exclude the code in release mode.
13106 RUNTIME_FUNCTION(MaybeObject*, Runtime_ListNatives) { 13146 RUNTIME_FUNCTION(MaybeObject*, Runtime_ListNatives) {
13107 ASSERT(args.length() == 0); 13147 ASSERT(args.length() == 0);
13108 HandleScope scope; 13148 HandleScope scope;
13109 #define COUNT_ENTRY(Name, argc, ressize) + 1 13149 #define COUNT_ENTRY(Name, argc, ressize) + 1
13110 int entry_count = 0 13150 int entry_count = 0
13111 RUNTIME_FUNCTION_LIST(COUNT_ENTRY) 13151 RUNTIME_FUNCTION_LIST(COUNT_ENTRY)
13112 INLINE_FUNCTION_LIST(COUNT_ENTRY) 13152 INLINE_FUNCTION_LIST(COUNT_ENTRY)
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
13279 // Handle last resort GC and make sure to allow future allocations 13319 // Handle last resort GC and make sure to allow future allocations
13280 // to grow the heap without causing GCs (if possible). 13320 // to grow the heap without causing GCs (if possible).
13281 isolate->counters()->gc_last_resort_from_js()->Increment(); 13321 isolate->counters()->gc_last_resort_from_js()->Increment();
13282 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13322 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13283 "Runtime::PerformGC"); 13323 "Runtime::PerformGC");
13284 } 13324 }
13285 } 13325 }
13286 13326
13287 13327
13288 } } // namespace v8::internal 13328 } } // namespace v8::internal
OLDNEW
« 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