865 Node* str1_value = make_load(no_ctrl, str1_valuea, value_type, T_OBJECT, string_type->add_offset(value_offset)); |
865 Node* str1_value = make_load(no_ctrl, str1_valuea, value_type, T_OBJECT, string_type->add_offset(value_offset)); |
866 Node* str1_offseta = basic_plus_adr(str1, str1, offset_offset); |
866 Node* str1_offseta = basic_plus_adr(str1, str1, offset_offset); |
867 Node* str1_offset = make_load(no_ctrl, str1_offseta, TypeInt::INT, T_INT, string_type->add_offset(offset_offset)); |
867 Node* str1_offset = make_load(no_ctrl, str1_offseta, TypeInt::INT, T_INT, string_type->add_offset(offset_offset)); |
868 Node* str1_start = array_element_address(str1_value, str1_offset, T_CHAR); |
868 Node* str1_start = array_element_address(str1_value, str1_offset, T_CHAR); |
869 |
869 |
870 // Pin loads from String::equals() argument since it could be NULL. |
|
871 Node* str2_ctrl = (opcode == Op_StrEquals) ? control() : no_ctrl; |
|
872 Node* str2_valuea = basic_plus_adr(str2, str2, value_offset); |
870 Node* str2_valuea = basic_plus_adr(str2, str2, value_offset); |
873 Node* str2_value = make_load(str2_ctrl, str2_valuea, value_type, T_OBJECT, string_type->add_offset(value_offset)); |
871 Node* str2_value = make_load(no_ctrl, str2_valuea, value_type, T_OBJECT, string_type->add_offset(value_offset)); |
874 Node* str2_offseta = basic_plus_adr(str2, str2, offset_offset); |
872 Node* str2_offseta = basic_plus_adr(str2, str2, offset_offset); |
875 Node* str2_offset = make_load(str2_ctrl, str2_offseta, TypeInt::INT, T_INT, string_type->add_offset(offset_offset)); |
873 Node* str2_offset = make_load(no_ctrl, str2_offseta, TypeInt::INT, T_INT, string_type->add_offset(offset_offset)); |
876 Node* str2_start = array_element_address(str2_value, str2_offset, T_CHAR); |
874 Node* str2_start = array_element_address(str2_value, str2_offset, T_CHAR); |
877 |
875 |
878 Node* result = NULL; |
876 Node* result = NULL; |
879 switch (opcode) { |
877 switch (opcode) { |
880 case Op_StrIndexOf: |
878 case Op_StrIndexOf: |
1010 Node* argument_cnt; |
1008 Node* argument_cnt; |
1011 |
1009 |
1012 if (!stopped()) { |
1010 if (!stopped()) { |
1013 // Properly cast the argument to String |
1011 // Properly cast the argument to String |
1014 argument = _gvn.transform(new (C, 2) CheckCastPPNode(control(), argument, string_type)); |
1012 argument = _gvn.transform(new (C, 2) CheckCastPPNode(control(), argument, string_type)); |
|
1013 // This path is taken only when argument's type is String:NotNull. |
|
1014 argument = cast_not_null(argument, false); |
1015 |
1015 |
1016 // Get counts for string and argument |
1016 // Get counts for string and argument |
1017 Node* receiver_cnta = basic_plus_adr(receiver, receiver, count_offset); |
1017 Node* receiver_cnta = basic_plus_adr(receiver, receiver, count_offset); |
1018 receiver_cnt = make_load(no_ctrl, receiver_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); |
1018 receiver_cnt = make_load(no_ctrl, receiver_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); |
1019 |
1019 |
1020 // Pin load from argument string since it could be NULL. |
|
1021 Node* argument_cnta = basic_plus_adr(argument, argument, count_offset); |
1020 Node* argument_cnta = basic_plus_adr(argument, argument, count_offset); |
1022 argument_cnt = make_load(control(), argument_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); |
1021 argument_cnt = make_load(no_ctrl, argument_cnta, TypeInt::INT, T_INT, string_type->add_offset(count_offset)); |
1023 |
1022 |
1024 // Check for receiver count != argument count |
1023 // Check for receiver count != argument count |
1025 Node* cmp = _gvn.transform( new(C, 3) CmpINode(receiver_cnt, argument_cnt) ); |
1024 Node* cmp = _gvn.transform( new(C, 3) CmpINode(receiver_cnt, argument_cnt) ); |
1026 Node* bol = _gvn.transform( new(C, 2) BoolNode(cmp, BoolTest::ne) ); |
1025 Node* bol = _gvn.transform( new(C, 2) BoolNode(cmp, BoolTest::ne) ); |
1027 Node* if_ne = generate_slow_guard(bol, NULL); |
1026 Node* if_ne = generate_slow_guard(bol, NULL); |