Revision: 18775
Author:   [email protected]
Date:     Thu Jan 23 12:18:12 2014 UTC
Log:      [a64] Implement LStringCompareAndBranch on a64

BUG=314606
[email protected], [email protected]

Review URL: https://codereview.chromium.org/133193003
http://code.google.com/p/v8/source/detail?r=18775

Modified:
 /branches/experimental/a64/src/a64/lithium-a64.cc
 /branches/experimental/a64/src/a64/lithium-a64.h
 /branches/experimental/a64/src/a64/lithium-codegen-a64.cc

=======================================
--- /branches/experimental/a64/src/a64/lithium-a64.cc Wed Jan 22 18:10:34 2014 UTC +++ /branches/experimental/a64/src/a64/lithium-a64.cc Thu Jan 23 12:18:12 2014 UTC
@@ -295,6 +295,14 @@
   stream->Add(" <- ");
   value()->PrintTo(stream);
 }
+
+
+void LStringCompareAndBranch::PrintDataTo(StringStream* stream) {
+  stream->Add("if string_compare(");
+  left()->PrintTo(stream);
+  right()->PrintTo(stream);
+  stream->Add(") then B%d else B%d", true_block_id(), false_block_id());
+}


 void LTransitionElementsKind::PrintDataTo(StringStream* stream) {
@@ -2112,7 +2120,13 @@

 LInstruction* LChunkBuilder::DoStringCompareAndBranch(
     HStringCompareAndBranch* instr) {
-  UNIMPLEMENTED_INSTRUCTION();
+  ASSERT(instr->left()->representation().IsTagged());
+  ASSERT(instr->right()->representation().IsTagged());
+  LOperand* left = UseFixed(instr->left(), x1);
+  LOperand* right = UseFixed(instr->right(), x0);
+  LStringCompareAndBranch* result =
+      new(zone()) LStringCompareAndBranch(left, right);
+  return MarkAsCall(result, instr);
 }


=======================================
--- /branches/experimental/a64/src/a64/lithium-a64.h Wed Jan 22 18:10:34 2014 UTC +++ /branches/experimental/a64/src/a64/lithium-a64.h Thu Jan 23 12:18:12 2014 UTC
@@ -174,6 +174,7 @@
   V(StringAdd)                                  \
   V(StringCharCodeAt)                           \
   V(StringCharFromCode)                         \
+  V(StringCompareAndBranch)                     \
   V(StringLength)                               \
   V(SubI)                                       \
   V(TaggedToI)                                  \
@@ -2286,6 +2287,26 @@
 };


+class LStringCompareAndBranch: public LControlInstruction<2, 0> {
+ public:
+  LStringCompareAndBranch(LOperand* left, LOperand* right) {
+    inputs_[0] = left;
+    inputs_[1] = right;
+  }
+
+  LOperand* left() { return inputs_[0]; }
+  LOperand* right() { return inputs_[1]; }
+
+  DECLARE_CONCRETE_INSTRUCTION(StringCompareAndBranch,
+                               "string-compare-and-branch")
+  DECLARE_HYDROGEN_ACCESSOR(StringCompareAndBranch)
+
+  Token::Value op() const { return hydrogen()->token(); }
+
+  virtual void PrintDataTo(StringStream* stream);
+};
+
+
 class LStringLength: public LTemplateInstruction<1, 1, 0> {
  public:
   explicit LStringLength(LOperand* string) {
=======================================
--- /branches/experimental/a64/src/a64/lithium-codegen-a64.cc Wed Jan 22 18:10:34 2014 UTC +++ /branches/experimental/a64/src/a64/lithium-codegen-a64.cc Thu Jan 23 12:18:12 2014 UTC
@@ -4732,6 +4732,19 @@
   CallRuntimeFromDeferred(Runtime::kCharFromCode, 1, instr);
   __ StoreToSafepointRegisterSlot(x0, result);
 }
+
+
+void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) {
+  Token::Value op = instr->op();
+
+  Handle<Code> ic = CompareIC::GetUninitialized(isolate(), op);
+  CallCode(ic, RelocInfo::CODE_TARGET, instr);
+  InlineSmiCheckInfo::EmitNotInlined(masm());
+
+  Condition condition = TokenToCondition(op, false);
+
+  EmitBranch(instr, condition);
+}


 void LCodeGen::DoStringLength(LStringLength* instr) {

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