Reviewers: Michael Starzinger,

Description:
Bailout for %_FastOneByteArrayJoin again.

This recovers the performance loss for some ancient benchmarks.
Added some comments/UNIMPLEMENTED on the way.

BUG=v8:3947
LOG=n

Please review this at https://codereview.chromium.org/996153002/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+20, -4 lines):
  M src/bailout-reason.h
  M src/hydrogen.h
  M src/hydrogen.cc
  M src/runtime/runtime-array.cc
  M src/runtime/runtime-classes.cc


Index: src/bailout-reason.h
diff --git a/src/bailout-reason.h b/src/bailout-reason.h
index 403a1b41856a4967378a5fc2d4abc2968781c0db..9b801c841d5ce02bc4dc8c3d1eacb45afa89630f 100644
--- a/src/bailout-reason.h
+++ b/src/bailout-reason.h
@@ -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: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 3246dfa8e4cd0114e8664a03269da6fb01d2e88b..5b332b3aada09edb8399bfd9c56325f9cbfaffa9 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -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: src/hydrogen.h
diff --git a/src/hydrogen.h b/src/hydrogen.h
index da76657c03be400a6472558db4960213572ada7f..2e7a5dd17bdb26ed12a34c309c36cd946a5e3d4d 100644
--- a/src/hydrogen.h
+++ b/src/hydrogen.h
@@ -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: src/runtime/runtime-array.cc
diff --git a/src/runtime/runtime-array.cc b/src/runtime/runtime-array.cc
index 90a1e2c1ef3266405709491b9d61dec0bb808242..87d4f263ef42b135ee66a9914d8be384d4c389af 100644
--- a/src/runtime/runtime-array.cc
+++ b/src/runtime/runtime-array.cc
@@ -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_GetCachedArrayIndex 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: src/runtime/runtime-classes.cc
diff --git a/src/runtime/runtime-classes.cc b/src/runtime/runtime-classes.cc
index 36619b0bf0f9e6b9f5636e747ee18aa2a2ba96c4..67d7e6939a634213440744b054796355d6e3bd44 100644
--- a/src/runtime/runtime-classes.cc
+++ b/src/runtime/runtime-classes.cc
@@ -454,7 +454,7 @@ RUNTIME_FUNCTION(Runtime_HandleStepInForDerivedConstructors) {


 RUNTIME_FUNCTION(Runtime_DefaultConstructorCallSuper) {
-  UNREACHABLE();
+  UNIMPLEMENTED();
   return nullptr;
 }
 }


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to