Remove obsolete JSFunction::IsOptimizable predicate.
authormstarzinger <mstarzinger@chromium.org>
Thu, 21 May 2015 13:05:48 +0000 (06:05 -0700)
committerCommit bot <commit-bot@chromium.org>
Thu, 21 May 2015 13:05:28 +0000 (13:05 +0000)
This just delegates to SharedFunctionInfo::optimization_disabled and
was primarily used for assertions. Removing it due to misleading name
because already optimized functions reported being "non-optimizable".

R=titzer@chromium.org

Review URL: https://codereview.chromium.org/1150683002

Cr-Commit-Position: refs/heads/master@{#28551}

src/objects-inl.h
src/objects.cc
src/objects.h
src/runtime-profiler.cc
src/runtime/runtime-test.cc
test/cctest/test-compiler.cc

index fea849afaa242b3a4f25c3ca68fe8fac720f2b79..aa82b83915ca3f169cfb9a280fa4789f04c978bf 100644 (file)
@@ -6022,11 +6022,6 @@ bool JSFunction::IsOptimized() {
 }
 
 
-bool JSFunction::IsOptimizable() {
-  return code()->kind() == Code::FUNCTION && !shared()->optimization_disabled();
-}
-
-
 bool JSFunction::IsMarkedForOptimization() {
   return code() == GetIsolate()->builtins()->builtin(
       Builtins::kCompileOptimized);
index 24ecc6b50e99272e7d10110f2e286369aca12bbc..8d87ed73914caa7c747a56885292975ee9a5a80c 100644 (file)
@@ -9808,7 +9808,7 @@ void JSFunction::JSFunctionIterateBody(int object_size, ObjectVisitor* v) {
 void JSFunction::MarkForOptimization() {
   Isolate* isolate = GetIsolate();
   DCHECK(!IsOptimized());
-  DCHECK(shared()->allows_lazy_compilation() || IsOptimizable());
+  DCHECK(shared()->allows_lazy_compilation());
   set_code_no_write_barrier(
       isolate->builtins()->builtin(Builtins::kCompileOptimized));
   // No write barrier required, since the builtin is part of the root set.
@@ -9832,7 +9832,7 @@ void JSFunction::AttemptConcurrentOptimization() {
   }
   DCHECK(!IsInOptimizationQueue());
   DCHECK(!IsOptimized());
-  DCHECK(shared()->allows_lazy_compilation() || IsOptimizable());
+  DCHECK(shared()->allows_lazy_compilation());
   DCHECK(isolate->concurrent_recompilation_enabled());
   if (FLAG_trace_concurrent_recompilation) {
     PrintF("  ** Marking ");
@@ -9840,7 +9840,7 @@ void JSFunction::AttemptConcurrentOptimization() {
     PrintF(" for concurrent recompilation.\n");
   }
   set_code_no_write_barrier(
-      GetIsolate()->builtins()->builtin(Builtins::kCompileOptimizedConcurrent));
+      isolate->builtins()->builtin(Builtins::kCompileOptimizedConcurrent));
   // No write barrier required, since the builtin is part of the root set.
 }
 
index 665da0384ce861d661fed39ac2101fd03a31bc2a..29a1e13789cb8bb7802ab2134ea9c71a7b1c3327 100644 (file)
@@ -7619,9 +7619,6 @@ class JSFunction: public JSObject {
   // Tells whether or not this function has been optimized.
   inline bool IsOptimized();
 
-  // Tells whether or not this function can be optimized.
-  inline bool IsOptimizable();
-
   // Mark this function for lazy recompilation. The function will be
   // recompiled the next time it is executed.
   void MarkForOptimization();
index 22567d3b90576be19f829e6a55ea33c5b4d68e53..838888aeb1dca635d7903abcfae57d13980e199c 100644 (file)
@@ -88,8 +88,6 @@ static void GetICCounts(SharedFunctionInfo* shared,
 
 
 void RuntimeProfiler::Optimize(JSFunction* function, const char* reason) {
-  DCHECK(function->IsOptimizable());
-
   if (FLAG_trace_opt && function->PassesFilter(FLAG_hydrogen_filter)) {
     PrintF("[marking ");
     function->ShortPrint();
@@ -217,7 +215,7 @@ void RuntimeProfiler::OptimizeNow() {
       }
       continue;
     }
-    if (!function->IsOptimizable()) continue;
+    if (function->IsOptimized()) continue;
 
     int ticks = shared_code->profiler_ticks();
 
index e115ba9e2477110208be70a60c197dba08bbb443..28f16a46861f651e63292039d1680e2017e154f4 100644 (file)
@@ -87,8 +87,7 @@ RUNTIME_FUNCTION(Runtime_OptimizeFunctionOnNextCall) {
   CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
   // The following assertion was lifted from the DCHECK inside
   // JSFunction::MarkForOptimization().
-  RUNTIME_ASSERT(function->shared()->allows_lazy_compilation() ||
-                 function->IsOptimizable());
+  RUNTIME_ASSERT(function->shared()->allows_lazy_compilation());
 
   // If the function is already optimized, just return.
   if (function->IsOptimized()) return isolate->heap()->undefined_value();
@@ -131,8 +130,7 @@ RUNTIME_FUNCTION(Runtime_OptimizeOsr) {
 
   // The following assertion was lifted from the DCHECK inside
   // JSFunction::MarkForOptimization().
-  RUNTIME_ASSERT(function->shared()->allows_lazy_compilation() ||
-                 function->IsOptimizable());
+  RUNTIME_ASSERT(function->shared()->allows_lazy_compilation());
 
   // If the function is already optimized, just return.
   if (function->IsOptimized()) return isolate->heap()->undefined_value();
index ef09891cb7d7eee60fdc8cef6d514f28ed78dd30..57704f9c1ee023364c00eed7eda6aa7a2beda1f0 100644 (file)
@@ -395,10 +395,8 @@ TEST(OptimizedCodeSharing) {
         *v8::Local<v8::Function>::Cast(env->Global()->Get(v8_str("closure1"))));
     Handle<JSFunction> fun2 = v8::Utils::OpenHandle(
         *v8::Local<v8::Function>::Cast(env->Global()->Get(v8_str("closure2"))));
-    CHECK(fun1->IsOptimized()
-          || !CcTest::i_isolate()->use_crankshaft() || !fun1->IsOptimizable());
-    CHECK(fun2->IsOptimized()
-          || !CcTest::i_isolate()->use_crankshaft() || !fun2->IsOptimizable());
+    CHECK(fun1->IsOptimized() || !CcTest::i_isolate()->use_crankshaft());
+    CHECK(fun2->IsOptimized() || !CcTest::i_isolate()->use_crankshaft());
     CHECK_EQ(fun1->code(), fun2->code());
   }
 }