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

Unified Diff: src/runtime.cc

Issue 18214005: Added %NeverOptimize runtime call that can disable optimizations for a method for tests. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 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') | test/mjsunit/compiler/inline-arguments.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 6e045608b9c10d19178a4ee1f5308e9e2e214123..e6c3bc348352dac2360cc78966a7fa229169579b 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -8346,6 +8346,37 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_OptimizeFunctionOnNextCall) {
}
+static void MarkNeverOptimize(JSFunction *function) {
+ Code *code = function->code();
+ if (code != NULL && code->kind() == Code::FUNCTION) {
+ code->set_optimizable(false);
+ }
+ Code *shared_code = function->shared()->code();
+ if (shared_code != NULL && shared_code->kind() == Code::FUNCTION) {
+ shared_code->set_optimizable(false);
+ }
+}
+
+
+RUNTIME_FUNCTION(MaybeObject*, Runtime_NeverOptimize) {
+ HandleScope scope(isolate);
+
+ if (args.length() == 0) {
+ // mark the top frame as do not optimize
Jakob Kummerow 2013/07/11 15:23:33 nit: Begin with capitalization, end with punctuati
titzer 2013/07/11 15:29:02 Done. (fixed this before submitting).
+ JavaScriptFrameIterator it(isolate);
+ if (!it.done()) MarkNeverOptimize(JSFunction::cast(it.frame()->function()));
Jakob Kummerow 2013/07/11 15:23:33 Instead of rolling your own MarkNeverOptimize, I t
titzer 2013/07/11 15:29:02 I also did something similar prior to submit...as
+ return isolate->heap()->undefined_value();
+ }
+
+ // mark the passed functions as do not optimize
+ for (int i = 0; i < args.length(); i++) {
+ CONVERT_ARG_CHECKED(JSFunction, function, i);
+ MarkNeverOptimize(function);
+ }
+ return isolate->heap()->undefined_value();
+}
+
+
RUNTIME_FUNCTION(MaybeObject*, Runtime_CompleteOptimization) {
HandleScope scope(isolate);
ASSERT(args.length() == 1);
« no previous file with comments | « src/runtime.h ('k') | test/mjsunit/compiler/inline-arguments.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698