OLD | NEW |
---|---|
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 7406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7417 RUNTIME_FUNCTION(MaybeObject*, Runtime_OptimizeFunctionOnNextCall) { | 7417 RUNTIME_FUNCTION(MaybeObject*, Runtime_OptimizeFunctionOnNextCall) { |
7418 HandleScope scope(isolate); | 7418 HandleScope scope(isolate); |
7419 ASSERT(args.length() == 1); | 7419 ASSERT(args.length() == 1); |
7420 CONVERT_ARG_CHECKED(JSFunction, function, 0); | 7420 CONVERT_ARG_CHECKED(JSFunction, function, 0); |
7421 if (!function->IsOptimizable()) return isolate->heap()->undefined_value(); | 7421 if (!function->IsOptimizable()) return isolate->heap()->undefined_value(); |
7422 function->MarkForLazyRecompilation(); | 7422 function->MarkForLazyRecompilation(); |
7423 return isolate->heap()->undefined_value(); | 7423 return isolate->heap()->undefined_value(); |
7424 } | 7424 } |
7425 | 7425 |
7426 | 7426 |
7427 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsOptimizedFunction) { | |
danno
2011/05/04 07:47:04
Perhaps this should be called FunctionOptimization
Jakob Kummerow
2011/05/06 15:58:15
Done.
| |
7428 HandleScope scope(isolate); | |
7429 ASSERT(args.length() == 1); | |
7430 if (!V8::UseCrankshaft()) { | |
7431 return Smi::FromInt(4); // 4 == "never". | |
7432 } | |
7433 if (FLAG_always_opt) { | |
7434 return Smi::FromInt(3); // 3 == "always". | |
7435 } | |
7436 CONVERT_ARG_CHECKED(JSFunction, function, 0); | |
7437 return function->IsOptimized() ? Smi::FromInt(1) // 1 == "yes". | |
7438 : Smi::FromInt(2); // 2 == "no". | |
7439 } | |
7440 | |
7441 | |
7442 RUNTIME_FUNCTION(MaybeObject*, Runtime_GetOptimizationCount) { | |
7443 HandleScope scope(isolate); | |
7444 ASSERT(args.length() == 1); | |
7445 CONVERT_ARG_CHECKED(JSFunction, function, 0); | |
7446 return Smi::FromInt(function->shared()->opt_count()); | |
7447 } | |
7448 | |
7449 | |
7427 RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileForOnStackReplacement) { | 7450 RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileForOnStackReplacement) { |
7428 HandleScope scope(isolate); | 7451 HandleScope scope(isolate); |
7429 ASSERT(args.length() == 1); | 7452 ASSERT(args.length() == 1); |
7430 CONVERT_ARG_CHECKED(JSFunction, function, 0); | 7453 CONVERT_ARG_CHECKED(JSFunction, function, 0); |
7431 | 7454 |
7432 // We're not prepared to handle a function with arguments object. | 7455 // We're not prepared to handle a function with arguments object. |
7433 ASSERT(!function->shared()->scope_info()->HasArgumentsShadow()); | 7456 ASSERT(!function->shared()->scope_info()->HasArgumentsShadow()); |
7434 | 7457 |
7435 // We have hit a back edge in an unoptimized frame for a function that was | 7458 // We have hit a back edge in an unoptimized frame for a function that was |
7436 // selected for on-stack replacement. Find the unoptimized code object. | 7459 // selected for on-stack replacement. Find the unoptimized code object. |
(...skipping 4545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11982 } else { | 12005 } else { |
11983 // Handle last resort GC and make sure to allow future allocations | 12006 // Handle last resort GC and make sure to allow future allocations |
11984 // to grow the heap without causing GCs (if possible). | 12007 // to grow the heap without causing GCs (if possible). |
11985 isolate->counters()->gc_last_resort_from_js()->Increment(); | 12008 isolate->counters()->gc_last_resort_from_js()->Increment(); |
11986 isolate->heap()->CollectAllGarbage(false); | 12009 isolate->heap()->CollectAllGarbage(false); |
11987 } | 12010 } |
11988 } | 12011 } |
11989 | 12012 |
11990 | 12013 |
11991 } } // namespace v8::internal | 12014 } } // namespace v8::internal |
OLD | NEW |