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

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

Issue 2655223003: Revert of [tests] Make assertOptimized()/assertUnoptimized() great again. (Closed)
Patch Set: 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
« no previous file with comments | « src/runtime/runtime.h ('k') | test/cctest/test-api-interceptors.cc » ('j') | 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 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".
}
« no previous file with comments | « src/runtime/runtime.h ('k') | test/cctest/test-api-interceptors.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698