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

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

Issue 2654733004: [tests] Make assertOptimized()/assertUnoptimized() great again. (Closed)
Patch Set: Rebasing for relanding Created 3 years, 11 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
Index: src/runtime/runtime-test.cc
diff --git a/src/runtime/runtime-test.cc b/src/runtime/runtime-test.cc
index 8176cbfa69bc3f063917f6d8573c9dfbf87eeabe..36a7b43dd400221301df5e98381642d0ec78cd1f 100644
--- a/src/runtime/runtime-test.cc
+++ b/src/runtime/runtime-test.cc
@@ -236,21 +236,28 @@ RUNTIME_FUNCTION(Runtime_NeverOptimizeFunction) {
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()) {
- return Smi::FromInt(4); // 4 == "never".
+ 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);
}
// 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();
+ return Smi::FromInt(status);
}
Handle<JSFunction> function = Handle<JSFunction>::cast(function_object);
+ status |= static_cast<int>(OptimizationStatus::kIsFunction);
bool sync_with_compiler_thread = true;
if (args.length() == 2) {
@@ -269,22 +276,16 @@ RUNTIME_FUNCTION(Runtime_GetOptimizationStatus) {
base::OS::Sleep(base::TimeDelta::FromMilliseconds(50));
}
}
- 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->IsOptimized()) {
+ status |= static_cast<int>(OptimizationStatus::kOptimized);
+ if (function->code()->is_turbofanned()) {
+ status |= static_cast<int>(OptimizationStatus::kTurboFanned);
+ }
}
if (function->IsInterpreted()) {
- return Smi::FromInt(8); // 8 == "Interpreted".
+ status |= static_cast<int>(OptimizationStatus::kInterpreted);
}
- return function->IsOptimized() ? Smi::FromInt(1) // 1 == "yes".
- : Smi::FromInt(2); // 2 == "no".
+ return Smi::FromInt(status);
}

Powered by Google App Engine
This is Rietveld 408576698