OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1148 } | 1148 } |
1149 } | 1149 } |
1150 | 1150 |
1151 | 1151 |
1152 void HBoundsCheck::InferRepresentation(HInferRepresentation* h_infer) { | 1152 void HBoundsCheck::InferRepresentation(HInferRepresentation* h_infer) { |
1153 ASSERT(CheckFlag(kFlexibleRepresentation)); | 1153 ASSERT(CheckFlag(kFlexibleRepresentation)); |
1154 HValue* actual_index = index()->ActualValue(); | 1154 HValue* actual_index = index()->ActualValue(); |
1155 HValue* actual_length = length()->ActualValue(); | 1155 HValue* actual_length = length()->ActualValue(); |
1156 Representation index_rep = actual_index->representation(); | 1156 Representation index_rep = actual_index->representation(); |
1157 Representation length_rep = actual_length->representation(); | 1157 Representation length_rep = actual_length->representation(); |
1158 if (index_rep.IsTagged()) index_rep = Representation::Smi(); | 1158 if (index_rep.IsTagged() && actual_index->type().IsSmi()) { |
1159 if (length_rep.IsTagged()) length_rep = Representation::Smi(); | 1159 index_rep = Representation::Smi(); |
| 1160 } |
| 1161 if (length_rep.IsTagged() && actual_length->type().IsSmi()) { |
| 1162 length_rep = Representation::Smi(); |
| 1163 } |
1160 Representation r = index_rep.generalize(length_rep); | 1164 Representation r = index_rep.generalize(length_rep); |
1161 if (r.is_more_general_than(Representation::Integer32())) { | 1165 if (r.is_more_general_than(Representation::Integer32())) { |
1162 r = Representation::Integer32(); | 1166 r = Representation::Integer32(); |
1163 } | 1167 } |
1164 UpdateRepresentation(r, h_infer, "boundscheck"); | 1168 UpdateRepresentation(r, h_infer, "boundscheck"); |
1165 } | 1169 } |
1166 | 1170 |
1167 | 1171 |
1168 bool HBoundsCheckBaseIndexInformation::IsRelationTrueInternal( | 1172 bool HBoundsCheckBaseIndexInformation::IsRelationTrueInternal( |
1169 NumericRelation relation, | 1173 NumericRelation relation, |
(...skipping 2146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3316 | 3320 |
3317 #undef DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR | 3321 #undef DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR |
3318 | 3322 |
3319 | 3323 |
3320 HInstruction* HStringAdd::New( | 3324 HInstruction* HStringAdd::New( |
3321 Zone* zone, HValue* context, HValue* left, HValue* right) { | 3325 Zone* zone, HValue* context, HValue* left, HValue* right) { |
3322 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { | 3326 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { |
3323 HConstant* c_right = HConstant::cast(right); | 3327 HConstant* c_right = HConstant::cast(right); |
3324 HConstant* c_left = HConstant::cast(left); | 3328 HConstant* c_left = HConstant::cast(left); |
3325 if (c_left->HasStringValue() && c_right->HasStringValue()) { | 3329 if (c_left->HasStringValue() && c_right->HasStringValue()) { |
3326 Factory* factory = Isolate::Current()->factory(); | 3330 Handle<String> concat = zone->isolate()->factory()->NewFlatConcatString( |
3327 return new(zone) HConstant(factory->NewConsString(c_left->StringValue(), | 3331 c_left->StringValue(), c_right->StringValue()); |
3328 c_right->StringValue()), | 3332 return new(zone) HConstant(concat, Representation::Tagged()); |
3329 Representation::Tagged()); | |
3330 } | 3333 } |
3331 } | 3334 } |
3332 return new(zone) HStringAdd(context, left, right); | 3335 return new(zone) HStringAdd(context, left, right); |
3333 } | 3336 } |
3334 | 3337 |
3335 | 3338 |
3336 HInstruction* HStringCharFromCode::New( | 3339 HInstruction* HStringCharFromCode::New( |
3337 Zone* zone, HValue* context, HValue* char_code) { | 3340 Zone* zone, HValue* context, HValue* char_code) { |
3338 if (FLAG_fold_constants && char_code->IsConstant()) { | 3341 if (FLAG_fold_constants && char_code->IsConstant()) { |
3339 HConstant* c_code = HConstant::cast(char_code); | 3342 HConstant* c_code = HConstant::cast(char_code); |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3866 case kBackingStore: | 3869 case kBackingStore: |
3867 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); | 3870 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); |
3868 stream->Add("[backing-store]"); | 3871 stream->Add("[backing-store]"); |
3869 break; | 3872 break; |
3870 } | 3873 } |
3871 | 3874 |
3872 stream->Add("@%d", offset()); | 3875 stream->Add("@%d", offset()); |
3873 } | 3876 } |
3874 | 3877 |
3875 } } // namespace v8::internal | 3878 } } // namespace v8::internal |
OLD | NEW |