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() && actual_index->type().IsSmi()) { | 1158 if (index_rep.IsTagged()) index_rep = Representation::Smi(); |
1159 index_rep = Representation::Smi(); | 1159 if (length_rep.IsTagged()) length_rep = Representation::Smi(); |
1160 } | |
1161 if (length_rep.IsTagged() && actual_length->type().IsSmi()) { | |
1162 length_rep = Representation::Smi(); | |
1163 } | |
1164 Representation r = index_rep.generalize(length_rep); | 1160 Representation r = index_rep.generalize(length_rep); |
1165 if (r.is_more_general_than(Representation::Integer32())) { | 1161 if (r.is_more_general_than(Representation::Integer32())) { |
1166 r = Representation::Integer32(); | 1162 r = Representation::Integer32(); |
1167 } | 1163 } |
1168 UpdateRepresentation(r, h_infer, "boundscheck"); | 1164 UpdateRepresentation(r, h_infer, "boundscheck"); |
1169 } | 1165 } |
1170 | 1166 |
1171 | 1167 |
1172 bool HBoundsCheckBaseIndexInformation::IsRelationTrueInternal( | 1168 bool HBoundsCheckBaseIndexInformation::IsRelationTrueInternal( |
1173 NumericRelation relation, | 1169 NumericRelation relation, |
(...skipping 2146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3320 | 3316 |
3321 #undef DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR | 3317 #undef DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR |
3322 | 3318 |
3323 | 3319 |
3324 HInstruction* HStringAdd::New( | 3320 HInstruction* HStringAdd::New( |
3325 Zone* zone, HValue* context, HValue* left, HValue* right) { | 3321 Zone* zone, HValue* context, HValue* left, HValue* right) { |
3326 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { | 3322 if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { |
3327 HConstant* c_right = HConstant::cast(right); | 3323 HConstant* c_right = HConstant::cast(right); |
3328 HConstant* c_left = HConstant::cast(left); | 3324 HConstant* c_left = HConstant::cast(left); |
3329 if (c_left->HasStringValue() && c_right->HasStringValue()) { | 3325 if (c_left->HasStringValue() && c_right->HasStringValue()) { |
3330 Handle<String> concat = zone->isolate()->factory()->NewFlatConcatString( | 3326 Factory* factory = Isolate::Current()->factory(); |
3331 c_left->StringValue(), c_right->StringValue()); | 3327 return new(zone) HConstant(factory->NewConsString(c_left->StringValue(), |
3332 return new(zone) HConstant(concat, Representation::Tagged()); | 3328 c_right->StringValue()), |
| 3329 Representation::Tagged()); |
3333 } | 3330 } |
3334 } | 3331 } |
3335 return new(zone) HStringAdd(context, left, right); | 3332 return new(zone) HStringAdd(context, left, right); |
3336 } | 3333 } |
3337 | 3334 |
3338 | 3335 |
3339 HInstruction* HStringCharFromCode::New( | 3336 HInstruction* HStringCharFromCode::New( |
3340 Zone* zone, HValue* context, HValue* char_code) { | 3337 Zone* zone, HValue* context, HValue* char_code) { |
3341 if (FLAG_fold_constants && char_code->IsConstant()) { | 3338 if (FLAG_fold_constants && char_code->IsConstant()) { |
3342 HConstant* c_code = HConstant::cast(char_code); | 3339 HConstant* c_code = HConstant::cast(char_code); |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3869 case kBackingStore: | 3866 case kBackingStore: |
3870 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); | 3867 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); |
3871 stream->Add("[backing-store]"); | 3868 stream->Add("[backing-store]"); |
3872 break; | 3869 break; |
3873 } | 3870 } |
3874 | 3871 |
3875 stream->Add("@%d", offset()); | 3872 stream->Add("@%d", offset()); |
3876 } | 3873 } |
3877 | 3874 |
3878 } } // namespace v8::internal | 3875 } } // namespace v8::internal |
OLD | NEW |