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

Side by Side Diff: src/runtime.cc

Issue 6879108: Expose optimization info via runtime functions (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: address comments Created 9 years, 7 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') | test/mjsunit/assert-opt-and-deopt.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 7536 matching lines...) Expand 10 before | Expand all | Expand 10 after
7547 RUNTIME_FUNCTION(MaybeObject*, Runtime_OptimizeFunctionOnNextCall) { 7547 RUNTIME_FUNCTION(MaybeObject*, Runtime_OptimizeFunctionOnNextCall) {
7548 HandleScope scope(isolate); 7548 HandleScope scope(isolate);
7549 ASSERT(args.length() == 1); 7549 ASSERT(args.length() == 1);
7550 CONVERT_ARG_CHECKED(JSFunction, function, 0); 7550 CONVERT_ARG_CHECKED(JSFunction, function, 0);
7551 if (!function->IsOptimizable()) return isolate->heap()->undefined_value(); 7551 if (!function->IsOptimizable()) return isolate->heap()->undefined_value();
7552 function->MarkForLazyRecompilation(); 7552 function->MarkForLazyRecompilation();
7553 return isolate->heap()->undefined_value(); 7553 return isolate->heap()->undefined_value();
7554 } 7554 }
7555 7555
7556 7556
7557 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOptimizationStatus) {
7558 HandleScope scope(isolate);
7559 ASSERT(args.length() == 1);
7560 if (!V8::UseCrankshaft()) {
7561 return Smi::FromInt(4); // 4 == "never".
7562 }
7563 if (FLAG_always_opt) {
7564 return Smi::FromInt(3); // 3 == "always".
7565 }
7566 CONVERT_ARG_CHECKED(JSFunction, function, 0);
7567 return function->IsOptimized() ? Smi::FromInt(1) // 1 == "yes".
7568 : Smi::FromInt(2); // 2 == "no".
7569 }
7570
7571
7572 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOptimizationCount) {
7573 HandleScope scope(isolate);
7574 ASSERT(args.length() == 1);
7575 CONVERT_ARG_CHECKED(JSFunction, function, 0);
7576 return Smi::FromInt(function->shared()->opt_count());
7577 }
7578
7579
7557 RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileForOnStackReplacement) { 7580 RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileForOnStackReplacement) {
7558 HandleScope scope(isolate); 7581 HandleScope scope(isolate);
7559 ASSERT(args.length() == 1); 7582 ASSERT(args.length() == 1);
7560 CONVERT_ARG_CHECKED(JSFunction, function, 0); 7583 CONVERT_ARG_CHECKED(JSFunction, function, 0);
7561 7584
7562 // We're not prepared to handle a function with arguments object. 7585 // We're not prepared to handle a function with arguments object.
7563 ASSERT(!function->shared()->scope_info()->HasArgumentsShadow()); 7586 ASSERT(!function->shared()->scope_info()->HasArgumentsShadow());
7564 7587
7565 // We have hit a back edge in an unoptimized frame for a function that was 7588 // We have hit a back edge in an unoptimized frame for a function that was
7566 // selected for on-stack replacement. Find the unoptimized code object. 7589 // selected for on-stack replacement. Find the unoptimized code object.
(...skipping 4584 matching lines...) Expand 10 before | Expand all | Expand 10 after
12151 } else { 12174 } else {
12152 // Handle last resort GC and make sure to allow future allocations 12175 // Handle last resort GC and make sure to allow future allocations
12153 // to grow the heap without causing GCs (if possible). 12176 // to grow the heap without causing GCs (if possible).
12154 isolate->counters()->gc_last_resort_from_js()->Increment(); 12177 isolate->counters()->gc_last_resort_from_js()->Increment();
12155 isolate->heap()->CollectAllGarbage(false); 12178 isolate->heap()->CollectAllGarbage(false);
12156 } 12179 }
12157 } 12180 }
12158 12181
12159 12182
12160 } } // namespace v8::internal 12183 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | test/mjsunit/assert-opt-and-deopt.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698