Index: src/runtime/runtime-test.cc |
diff --git a/src/runtime/runtime-test.cc b/src/runtime/runtime-test.cc |
index 36a7b43dd400221301df5e98381642d0ec78cd1f..8176cbfa69bc3f063917f6d8573c9dfbf87eeabe 100644 |
--- a/src/runtime/runtime-test.cc |
+++ b/src/runtime/runtime-test.cc |
@@ -236,28 +236,21 @@ |
return isolate->heap()->undefined_value(); |
} |
+ |
RUNTIME_FUNCTION(Runtime_GetOptimizationStatus) { |
HandleScope scope(isolate); |
DCHECK(args.length() == 1 || args.length() == 2); |
- int status = 0; |
if (!isolate->use_crankshaft()) { |
- status |= static_cast<int>(OptimizationStatus::kNeverOptimize); |
- } |
- if (FLAG_always_opt || FLAG_prepare_always_opt) { |
- status |= static_cast<int>(OptimizationStatus::kAlwaysOptimize); |
- } |
- if (FLAG_deopt_every_n_times) { |
- status |= static_cast<int>(OptimizationStatus::kMaybeDeopted); |
+ 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 Smi::FromInt(status); |
+ return isolate->heap()->undefined_value(); |
} |
Handle<JSFunction> function = Handle<JSFunction>::cast(function_object); |
- status |= static_cast<int>(OptimizationStatus::kIsFunction); |
bool sync_with_compiler_thread = true; |
if (args.length() == 2) { |
@@ -276,16 +269,22 @@ |
base::OS::Sleep(base::TimeDelta::FromMilliseconds(50)); |
} |
} |
- if (function->IsOptimized()) { |
- status |= static_cast<int>(OptimizationStatus::kOptimized); |
- if (function->code()->is_turbofanned()) { |
- status |= static_cast<int>(OptimizationStatus::kTurboFanned); |
- } |
+ if (FLAG_always_opt || FLAG_prepare_always_opt) { |
+ // With --always-opt, optimization status expectations might not |
+ // match up, so just return a sentinel. |
+ return Smi::FromInt(3); // 3 == "always". |
+ } |
+ if (FLAG_deopt_every_n_times) { |
+ return Smi::FromInt(6); // 6 == "maybe deopted". |
+ } |
+ if (function->IsOptimized() && function->code()->is_turbofanned()) { |
+ return Smi::FromInt(7); // 7 == "TurboFan compiler". |
} |
if (function->IsInterpreted()) { |
- status |= static_cast<int>(OptimizationStatus::kInterpreted); |
- } |
- return Smi::FromInt(status); |
+ return Smi::FromInt(8); // 8 == "Interpreted". |
+ } |
+ return function->IsOptimized() ? Smi::FromInt(1) // 1 == "yes". |
+ : Smi::FromInt(2); // 2 == "no". |
} |