451 //------------------------------is_range_check--------------------------------- |
451 //------------------------------is_range_check--------------------------------- |
452 // Return 0 if not a range check. Return 1 if a range check and set index and |
452 // Return 0 if not a range check. Return 1 if a range check and set index and |
453 // offset. Return 2 if we had to negate the test. Index is NULL if the check |
453 // offset. Return 2 if we had to negate the test. Index is NULL if the check |
454 // is versus a constant. |
454 // is versus a constant. |
455 int IfNode::is_range_check(Node* &range, Node* &index, jint &offset) { |
455 int IfNode::is_range_check(Node* &range, Node* &index, jint &offset) { |
|
456 if (outcnt() != 2) { |
|
457 return 0; |
|
458 } |
456 Node* b = in(1); |
459 Node* b = in(1); |
457 if (b == NULL || !b->is_Bool()) return 0; |
460 if (b == NULL || !b->is_Bool()) return 0; |
458 BoolNode* bn = b->as_Bool(); |
461 BoolNode* bn = b->as_Bool(); |
459 Node* cmp = bn->in(1); |
462 Node* cmp = bn->in(1); |
460 if (cmp == NULL) return 0; |
463 if (cmp == NULL) return 0; |