Chromium Code Reviews| 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); |