Revision: 23610
Author:   [email protected]
Date:     Tue Sep  2 12:46:37 2014 UTC
Log:      Lower simplified StringAdd to stub call.

[email protected]
TEST=cctest/test-simplified-lowering/LowerStringOps_to_calls

Review URL: https://codereview.chromium.org/530973002
https://code.google.com/p/v8/source/detail?r=23610

Modified:
 /branches/bleeding_edge/src/compiler/js-typed-lowering.cc
 /branches/bleeding_edge/src/compiler/simplified-lowering.cc
 /branches/bleeding_edge/src/compiler/simplified-lowering.h
 /branches/bleeding_edge/test/cctest/compiler/test-simplified-lowering.cc

=======================================
--- /branches/bleeding_edge/src/compiler/js-typed-lowering.cc Mon Sep 1 12:17:43 2014 UTC +++ /branches/bleeding_edge/src/compiler/js-typed-lowering.cc Tue Sep 2 12:46:37 2014 UTC
@@ -222,7 +222,8 @@
   if (r.OneInputIs(Type::String())) {
     r.ConvertInputsToString();
     return r.ChangeToPureOperator(simplified()->StringAdd());
-  } else if (r.NeitherInputCanBe(Type::String())) {
+  }
+  if (r.NeitherInputCanBe(Type::String())) {
     r.ConvertInputsToNumber();
     return r.ChangeToPureOperator(simplified()->NumberAdd());
   }
=======================================
--- /branches/bleeding_edge/src/compiler/simplified-lowering.cc Tue Sep 2 10:14:21 2014 UTC +++ /branches/bleeding_edge/src/compiler/simplified-lowering.cc Tue Sep 2 12:46:37 2014 UTC
@@ -521,7 +521,7 @@
       }
       case IrOpcode::kStringAdd: {
         VisitBinop(node, kMachAnyTagged, kMachAnyTagged);
-        // TODO(titzer): lower StringAdd to stub/runtime call.
+        if (lower()) lowering->DoStringAdd(node);
         break;
       }
       case IrOpcode::kLoadField: {
@@ -819,6 +819,19 @@
   node->set_op(machine_.Store(access.machine_type, kind));
   node->ReplaceInput(1, ComputeIndex(access, node->InputAt(1)));
 }
+
+
+void SimplifiedLowering::DoStringAdd(Node* node) {
+ StringAddStub stub(zone()->isolate(), STRING_ADD_CHECK_NONE, NOT_TENURED);
+  CodeStubInterfaceDescriptor* d = stub.GetInterfaceDescriptor();
+  CallDescriptor::Flags flags = CallDescriptor::kNoFlags;
+ CallDescriptor* desc = Linkage::GetStubCallDescriptor(d, 0, flags, zone());
+  node->set_op(jsgraph()->common()->Call(desc));
+  node->InsertInput(zone(), 0, jsgraph()->HeapConstant(stub.GetCode()));
+  node->AppendInput(zone(), jsgraph()->UndefinedConstant());
+  node->AppendInput(zone(), graph()->start());
+  node->AppendInput(zone(), graph()->start());
+}


 }  // namespace compiler
=======================================
--- /branches/bleeding_edge/src/compiler/simplified-lowering.h Wed Aug 27 11:14:10 2014 UTC +++ /branches/bleeding_edge/src/compiler/simplified-lowering.h Tue Sep 2 12:46:37 2014 UTC
@@ -27,6 +27,7 @@
   void DoStoreField(Node* node);
   void DoLoadElement(Node* node);
   void DoStoreElement(Node* node);
+  void DoStringAdd(Node* node);

  private:
   JSGraph* jsgraph_;
=======================================
--- /branches/bleeding_edge/test/cctest/compiler/test-simplified-lowering.cc Thu Aug 28 17:53:24 2014 UTC +++ /branches/bleeding_edge/test/cctest/compiler/test-simplified-lowering.cc Tue Sep 2 12:46:37 2014 UTC
@@ -1051,15 +1051,15 @@
 }


-TEST(LowerStringOps_to_rtcalls) {
-  if (false) {  // TODO(titzer): lower StringOps to runtime calls
-    TestingGraph t(Type::String(), Type::String());
+TEST(LowerStringOps_to_calls) {
+  TestingGraph t(Type::String(), Type::String());
+  if (false) {  // TODO(titzer): lower StringOps to stub/runtime calls
     t.CheckLoweringBinop(IrOpcode::kCall, t.simplified()->StringEqual());
t.CheckLoweringBinop(IrOpcode::kCall, t.simplified()->StringLessThan());
     t.CheckLoweringBinop(IrOpcode::kCall,
                          t.simplified()->StringLessThanOrEqual());
-    t.CheckLoweringBinop(IrOpcode::kCall, t.simplified()->StringAdd());
   }
+  t.CheckLoweringBinop(IrOpcode::kCall, t.simplified()->StringAdd());
 }


--
--
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