| 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 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1121 | 1121 |
| 1122 HValue* HGraphBuilder::BuildCheckForCapacityGrow(HValue* object, | 1122 HValue* HGraphBuilder::BuildCheckForCapacityGrow(HValue* object, |
| 1123 HValue* elements, | 1123 HValue* elements, |
| 1124 ElementsKind kind, | 1124 ElementsKind kind, |
| 1125 HValue* length, | 1125 HValue* length, |
| 1126 HValue* key, | 1126 HValue* key, |
| 1127 bool is_js_array) { | 1127 bool is_js_array) { |
| 1128 Zone* zone = this->zone(); | 1128 Zone* zone = this->zone(); |
| 1129 IfBuilder length_checker(this); | 1129 IfBuilder length_checker(this); |
| 1130 | 1130 |
| 1131 length_checker.IfCompare(length, key, Token::EQ); | 1131 length_checker.IfCompare(length, key, Token::EQ, Representation::Smi()); |
| 1132 length_checker.Then(); | 1132 length_checker.Then(); |
| 1133 | 1133 |
| 1134 HValue* current_capacity = | 1134 HValue* current_capacity = |
| 1135 AddInstruction(new(zone) HFixedArrayBaseLength(elements)); | 1135 AddInstruction(new(zone) HFixedArrayBaseLength(elements)); |
| 1136 | 1136 |
| 1137 IfBuilder capacity_checker(this); | 1137 IfBuilder capacity_checker(this); |
| 1138 | 1138 |
| 1139 capacity_checker.IfCompare(length, current_capacity, Token::EQ); | 1139 capacity_checker.IfCompare( |
| 1140 length, current_capacity, Token::EQ, Representation::Smi()); |
| 1140 capacity_checker.Then(); | 1141 capacity_checker.Then(); |
| 1141 | 1142 |
| 1142 HValue* context = environment()->LookupContext(); | 1143 HValue* context = environment()->LookupContext(); |
| 1143 | 1144 |
| 1144 HValue* new_capacity = | 1145 HValue* new_capacity = |
| 1145 BuildNewElementsCapacity(context, current_capacity); | 1146 BuildNewElementsCapacity(context, current_capacity); |
| 1146 | 1147 |
| 1147 HValue* new_elements = BuildGrowElementsCapacity(object, elements, | 1148 HValue* new_elements = BuildGrowElementsCapacity(object, elements, |
| 1148 kind, length, | 1149 kind, length, |
| 1149 new_capacity); | 1150 new_capacity); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1251 length = AddInstruction(new(zone) HFixedArrayBaseLength(elements)); | 1252 length = AddInstruction(new(zone) HFixedArrayBaseLength(elements)); |
| 1252 } | 1253 } |
| 1253 HValue* checked_key = NULL; | 1254 HValue* checked_key = NULL; |
| 1254 if (IsExternalArrayElementsKind(elements_kind)) { | 1255 if (IsExternalArrayElementsKind(elements_kind)) { |
| 1255 if (store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS) { | 1256 if (store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS) { |
| 1256 NoObservableSideEffectsScope no_effects(this); | 1257 NoObservableSideEffectsScope no_effects(this); |
| 1257 HLoadExternalArrayPointer* external_elements = | 1258 HLoadExternalArrayPointer* external_elements = |
| 1258 new(zone) HLoadExternalArrayPointer(elements); | 1259 new(zone) HLoadExternalArrayPointer(elements); |
| 1259 AddInstruction(external_elements); | 1260 AddInstruction(external_elements); |
| 1260 IfBuilder length_checker(this); | 1261 IfBuilder length_checker(this); |
| 1261 length_checker.IfCompare(key, length, Token::LT); | 1262 length_checker.IfCompare(key, length, Token::LT, Representation::Smi()); |
| 1262 length_checker.Then(); | 1263 length_checker.Then(); |
| 1263 IfBuilder negative_checker(this); | 1264 IfBuilder negative_checker(this); |
| 1264 HValue* bounds_check = negative_checker.IfCompare( | 1265 HValue* bounds_check = negative_checker.IfCompare( |
| 1265 key, graph()->GetConstant0(), Token::GTE); | 1266 key, graph()->GetConstant0(), Token::GTE, Representation::Smi()); |
| 1266 negative_checker.Then(); | 1267 negative_checker.Then(); |
| 1267 HInstruction* result = BuildExternalArrayElementAccess( | 1268 HInstruction* result = BuildExternalArrayElementAccess( |
| 1268 external_elements, key, val, bounds_check, | 1269 external_elements, key, val, bounds_check, |
| 1269 elements_kind, is_store); | 1270 elements_kind, is_store); |
| 1270 AddInstruction(result); | 1271 AddInstruction(result); |
| 1271 negative_checker.ElseDeopt(); | 1272 negative_checker.ElseDeopt(); |
| 1272 length_checker.End(); | 1273 length_checker.End(); |
| 1273 return result; | 1274 return result; |
| 1274 } else { | 1275 } else { |
| 1275 ASSERT(store_mode == STANDARD_STORE); | 1276 ASSERT(store_mode == STANDARD_STORE); |
| (...skipping 10195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11471 } | 11472 } |
| 11472 } | 11473 } |
| 11473 | 11474 |
| 11474 #ifdef DEBUG | 11475 #ifdef DEBUG |
| 11475 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 11476 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
| 11476 if (allocator_ != NULL) allocator_->Verify(); | 11477 if (allocator_ != NULL) allocator_->Verify(); |
| 11477 #endif | 11478 #endif |
| 11478 } | 11479 } |
| 11479 | 11480 |
| 11480 } } // namespace v8::internal | 11481 } } // namespace v8::internal |
| OLD | NEW |