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

Unified Diff: src/runtime/runtime-test.cc

Issue 2145993002: [runtime] Make %GetOptimizationStatus fuzzable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_issue-cr-627828
Patch Set: Created 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-test.cc
diff --git a/src/runtime/runtime-test.cc b/src/runtime/runtime-test.cc
index 0ae752dae04a3ed59aedad06f9ca25b7d91c8f30..2219b6160eb69f135b8d8e6f20aae4c8e616ea69 100644
--- a/src/runtime/runtime-test.cc
+++ b/src/runtime/runtime-test.cc
@@ -30,7 +30,6 @@ RUNTIME_FUNCTION(Runtime_DeoptimizeFunction) {
// This function is used by fuzzers to get coverage in compiler.
// Ignore calls on non-function objects to avoid runtime errors.
CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0);
- // If it is not a JSFunction, just return.
if (!function_object->IsJSFunction()) {
return isolate->heap()->undefined_value();
}
@@ -111,7 +110,6 @@ RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) {
// This function is used by fuzzers to get coverage for optimizations
// in compiler. Ignore calls on non-function objects to avoid runtime errors.
CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0);
- // If it is not a JSFunction, just return.
if (!function_object->IsJSFunction()) {
return isolate->heap()->undefined_value();
}
@@ -212,14 +210,25 @@ RUNTIME_FUNCTION(Runtime_GetOptimizationStatus) {
if (!isolate->use_crankshaft()) {
return Smi::FromInt(4); // 4 == "never".
}
+
+ // This function is used by fuzzers to get coverage for optimizations
+ // in compiler. Ignore calls on non-function objects to avoid runtime errors.
+ CONVERT_ARG_HANDLE_CHECKED(Object, function_object, 0);
+ if (!function_object->IsJSFunction()) {
+ return isolate->heap()->undefined_value();
+ }
+ Handle<JSFunction> function = Handle<JSFunction>::cast(function_object);
+
bool sync_with_compiler_thread = true;
if (args.length() == 2) {
- CONVERT_ARG_HANDLE_CHECKED(String, sync, 1);
+ CONVERT_ARG_HANDLE_CHECKED(Object, sync_object, 1);
+ if (!sync_object->IsString()) return isolate->heap()->undefined_value();
+ Handle<String> sync = Handle<String>::cast(sync_object);
if (sync->IsOneByteEqualTo(STATIC_CHAR_VECTOR("no sync"))) {
sync_with_compiler_thread = false;
}
}
- CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
+
if (isolate->concurrent_recompilation_enabled() &&
sync_with_compiler_thread) {
while (function->IsInOptimizationQueue()) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698