Reviewers: Hannes Payer,

Description:
Inline some more compare operations.

BUG=

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

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+29, -0 lines):
  M src/hydrogen.cc


Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 57ea17313b2533e9cda72621789279b39aba428f..a6326f09841cae0e4361190619166438bc16038b 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -8292,6 +8292,35 @@ void HOptimizedGraphBuilder::VisitCompareOperation(CompareOperation* expr) {
         New<HCompareObjectEqAndBranch>(left, right);
     result->set_position(expr->position());
     return ast_context()->ReturnControl(result, expr->id());
+  } else if (combined_type->Is(Type::String())) {
+    BuildCheckHeapObject(left);
+    AddInstruction(HCheckInstanceType::NewIsString(left, zone()));
+    BuildCheckHeapObject(right);
+    AddInstruction(HCheckInstanceType::NewIsString(right, zone()));
+    HStringCompareAndBranch* result =
+        New<HStringCompareAndBranch>(left, right, op);
+    result->set_position(expr->position());
+    return ast_context()->ReturnControl(result, expr->id());
+  } else if (combined_type->NumClasses() == 1 &&
+             Token::IsEqualityOp(op)) {
+    BuildCheckHeapObject(left);
+    BuildCheckMap(left, combined_type->Classes().Current());
+    BuildCheckHeapObject(right);
+    BuildCheckMap(right, combined_type->Classes().Current());
+    HCompareObjectEqAndBranch* result =
+        New<HCompareObjectEqAndBranch>(left, right);
+    result->set_position(expr->position());
+    return ast_context()->ReturnInstruction(result, expr->id());
+  } else if (combined_type->Is(Type::Receiver()) &&
+             Token::IsEqualityOp(op)) {
+    BuildCheckHeapObject(left);
+    AddInstruction(HCheckInstanceType::NewIsSpecObject(left, zone()));
+    BuildCheckHeapObject(right);
+    AddInstruction(HCheckInstanceType::NewIsSpecObject(right, zone()));
+    HCompareObjectEqAndBranch* result =
+        New<HCompareObjectEqAndBranch>(left, right);
+    result->set_position(expr->position());
+    return ast_context()->ReturnInstruction(result, expr->id());
   } else {
     if (combined_rep.IsTagged() || combined_rep.IsNone()) {
       HCompareGeneric* result =


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