8059604: Add CompileThresholdScaling flag to control when methods are first compiled (with and withour TieredCompilation)

This patch adds a new flag (CompileThresholdScaling) to control when methods are first compiled

Reviewed-by: anoll, iveresov, kvn
diff --git a/hotspot/src/share/vm/opto/bytecodeInfo.cpp b/hotspot/src/share/vm/opto/bytecodeInfo.cpp
index ae8da0f..3ee6c9b 100644
--- a/hotspot/src/share/vm/opto/bytecodeInfo.cpp
+++ b/hotspot/src/share/vm/opto/bytecodeInfo.cpp
@@ -298,10 +298,19 @@
     if (is_init_with_ea(callee_method, caller_method, C)) {
       // Escape Analysis: inline all executed constructors
       return false;
-    } else if (!callee_method->was_executed_more_than(MIN2(MinInliningThreshold,
-                                                           CompileThreshold >> 1))) {
-      set_msg("executed < MinInliningThreshold times");
-      return true;
+    } else {
+      intx counter_high_value;
+      // Tiered compilation uses a different "high value" than non-tiered compilation.
+      // Determine the right value to use.
+      if (TieredCompilation) {
+        counter_high_value = InvocationCounter::count_limit / 2;
+      } else {
+        counter_high_value = CompileThreshold / 2;
+      }
+      if (!callee_method->was_executed_more_than(MIN2(MinInliningThreshold, counter_high_value))) {
+        set_msg("executed < MinInliningThreshold times");
+        return true;
+      }
     }
   }