Bailout for %_FastOneByteArrayJoin again.
authorsvenpanne <svenpanne@chromium.org>
Wed, 11 Mar 2015 13:28:29 +0000 (06:28 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 11 Mar 2015 13:28:46 +0000 (13:28 +0000)
This recovers the performance loss for some ancient benchmarks.
Added some comments/UNIMPLEMENTED on the way.

BUG=v8:3947
LOG=n

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

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

src/bailout-reason.h
src/hydrogen.cc
src/hydrogen.h
src/runtime/runtime-array.cc
src/runtime/runtime-classes.cc

index 403a1b4..9b801c8 100644 (file)
@@ -116,6 +116,8 @@ namespace internal {
     "Improper object on prototype chain for store")                            \
   V(kIndexIsNegative, "Index is negative")                                     \
   V(kIndexIsTooLarge, "Index is too large")                                    \
+  V(kInlinedRuntimeFunctionFastOneByteArrayJoin,                               \
+    "Inlined runtime function: FastOneByteArrayJoin")                          \
   V(kInlinedRuntimeFunctionGetFromCache,                                       \
     "Inlined runtime function: GetFromCache")                                  \
   V(kInliningBailedOut, "Inlining bailed out")                                 \
index 3246dfa..5b332b3 100644 (file)
@@ -12677,6 +12677,16 @@ void HOptimizedGraphBuilder::GenerateGetCachedArrayIndex(CallRuntime* call) {
 }
 
 
+void HOptimizedGraphBuilder::GenerateFastOneByteArrayJoin(CallRuntime* call) {
+  // Simply returning undefined here would be semantically correct and even
+  // avoid the bailout. Nevertheless, some ancient benchmarks like SunSpider's
+  // string-fasta would tank, because fullcode contains an optimized version.
+  // Obviously the fullcode => Crankshaft => bailout => fullcode dance is
+  // faster... *sigh*
+  return Bailout(kInlinedRuntimeFunctionFastOneByteArrayJoin);
+}
+
+
 void HOptimizedGraphBuilder::GenerateDebugBreakInOptimizedCode(
     CallRuntime* call) {
   Add<HDebugBreak>();
index da76657..2e7a5dd 100644 (file)
@@ -2187,6 +2187,7 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor {
   F(IsMinusZero)                       \
   F(HasCachedArrayIndex)               \
   F(GetCachedArrayIndex)               \
+  F(FastOneByteArrayJoin)              \
   F(DebugBreakInOptimizedCode)         \
   F(StringCharCodeAt)                  \
   F(StringAdd)                         \
index 90a1e2c..0e4f5b4 100644 (file)
@@ -1338,15 +1338,18 @@ RUNTIME_FUNCTION(Runtime_HasCachedArrayIndex) {
 
 
 RUNTIME_FUNCTION(Runtime_GetCachedArrayIndex) {
-  SealHandleScope shs(isolate);
-  DCHECK(args.length() == 1);
-  return isolate->heap()->undefined_value();
+  // This can never be reached, because Runtime_HasCachedArrayIndex always
+  // returns false.
+  UNIMPLEMENTED();
+  return nullptr;
 }
 
 
 RUNTIME_FUNCTION(Runtime_FastOneByteArrayJoin) {
   SealHandleScope shs(isolate);
   DCHECK(args.length() == 2);
+  // Returning undefined means that this fast path fails and one has to resort
+  // to a slow path.
   return isolate->heap()->undefined_value();
 }
 }
index 36619b0..67d7e69 100644 (file)
@@ -454,7 +454,7 @@ RUNTIME_FUNCTION(Runtime_HandleStepInForDerivedConstructors) {
 
 
 RUNTIME_FUNCTION(Runtime_DefaultConstructorCallSuper) {
-  UNREACHABLE();
+  UNIMPLEMENTED();
   return nullptr;
 }
 }