Reviewers: danno, mvstanton, Paul Lind, palfia, kisg, dusmil,

Description:
MIPS: A performance regression in array literal creation was caused by
refactoring.

Port r18046 (99c7352)

Original commit message:
A performance regression in array literal creation was caused by refactoring
that eliminated a special fast case for shallow arrays. At the same time the
general case got a bit slower. This CL restores most of the performance without coding the special fast case. The virtual dispatching is unnecessary because we
know what we want to do at compile time. A flag was added to
Runtime::CreateArrayLiteral. The flags delivers information about shallowness but also whether or not allocation mementos should be created. This is useful
for crankshafted code.

BUG=v8:3008
LOG=Y

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

SVN Base: https://github.com/v8/v8.git@gbl

Affected files (+8, -3 lines):
  M src/mips/code-stubs-mips.cc
  M src/mips/full-codegen-mips.cc


Index: src/mips/code-stubs-mips.cc
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc
index 47afeb4330a4c8a2514501be78d3e3c8efdaa04f..0c5e35caecfabfcb07e57cd1af220f3409c724f5 100644
--- a/src/mips/code-stubs-mips.cc
+++ b/src/mips/code-stubs-mips.cc
@@ -78,7 +78,7 @@ void FastCloneShallowArrayStub::InitializeInterfaceDescriptor(
   descriptor->register_param_count_ = 3;
   descriptor->register_params_ = registers;
   descriptor->deoptimization_handler_ =
-      Runtime::FunctionForId(Runtime::kCreateArrayLiteral)->entry;
+ Runtime::FunctionForId(Runtime::kCreateArrayLiteralStubBailout)->entry;
 }


Index: src/mips/full-codegen-mips.cc
diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc
index 486eb9db2db7a9da86f06f3521a4bf692881a553..8b16e6c157254c0747db0f1a5e36af39522bcff3 100644
--- a/src/mips/full-codegen-mips.cc
+++ b/src/mips/full-codegen-mips.cc
@@ -1780,6 +1780,10 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
   Comment cmnt(masm_, "[ ArrayLiteral");

   expr->BuildConstantElements(isolate());
+  int flags = expr->depth() == 1
+      ? ArrayLiteral::kShallowElements
+      : ArrayLiteral::kNoFlags;
+
   ZoneList<Expression*>* subexprs = expr->values();
   int length = subexprs->length();

@@ -1808,8 +1812,9 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
         1, a1, a2);
   } else if (expr->depth() > 1 || Serializer::enabled() ||
              length > FastCloneShallowArrayStub::kMaximumClonedLength) {
-    __ Push(a3, a2, a1);
-    __ CallRuntime(Runtime::kCreateArrayLiteral, 3);
+    __ li(a0, Operand(Smi::FromInt(flags)));
+    __ Push(a3, a2, a1, a0);
+    __ CallRuntime(Runtime::kCreateArrayLiteral, 4);
   } else {
     ASSERT(IsFastSmiOrObjectElementsKind(constant_elements_kind) ||
            FLAG_smi_only_arrays);


--
--
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/groups/opt_out.

Reply via email to