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, Representation::Smi()); | 1131 length_checker.IfCompare(length, key, Token::EQ); |
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( | 1139 capacity_checker.IfCompare(length, current_capacity, Token::EQ); |
1140 length, current_capacity, Token::EQ, Representation::Smi()); | |
1141 capacity_checker.Then(); | 1140 capacity_checker.Then(); |
1142 | 1141 |
1143 HValue* context = environment()->LookupContext(); | 1142 HValue* context = environment()->LookupContext(); |
1144 | 1143 |
1145 HValue* new_capacity = | 1144 HValue* new_capacity = |
1146 BuildNewElementsCapacity(context, current_capacity); | 1145 BuildNewElementsCapacity(context, current_capacity); |
1147 | 1146 |
1148 HValue* new_elements = BuildGrowElementsCapacity(object, elements, | 1147 HValue* new_elements = BuildGrowElementsCapacity(object, elements, |
1149 kind, length, | 1148 kind, length, |
1150 new_capacity); | 1149 new_capacity); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1252 length = AddInstruction(new(zone) HFixedArrayBaseLength(elements)); | 1251 length = AddInstruction(new(zone) HFixedArrayBaseLength(elements)); |
1253 } | 1252 } |
1254 HValue* checked_key = NULL; | 1253 HValue* checked_key = NULL; |
1255 if (IsExternalArrayElementsKind(elements_kind)) { | 1254 if (IsExternalArrayElementsKind(elements_kind)) { |
1256 if (store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS) { | 1255 if (store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS) { |
1257 NoObservableSideEffectsScope no_effects(this); | 1256 NoObservableSideEffectsScope no_effects(this); |
1258 HLoadExternalArrayPointer* external_elements = | 1257 HLoadExternalArrayPointer* external_elements = |
1259 new(zone) HLoadExternalArrayPointer(elements); | 1258 new(zone) HLoadExternalArrayPointer(elements); |
1260 AddInstruction(external_elements); | 1259 AddInstruction(external_elements); |
1261 IfBuilder length_checker(this); | 1260 IfBuilder length_checker(this); |
1262 length_checker.IfCompare(key, length, Token::LT, Representation::Smi()); | 1261 length_checker.IfCompare(key, length, Token::LT); |
1263 length_checker.Then(); | 1262 length_checker.Then(); |
1264 IfBuilder negative_checker(this); | 1263 IfBuilder negative_checker(this); |
1265 HValue* bounds_check = negative_checker.IfCompare( | 1264 HValue* bounds_check = negative_checker.IfCompare( |
1266 key, graph()->GetConstant0(), Token::GTE, Representation::Smi()); | 1265 key, graph()->GetConstant0(), Token::GTE); |
1267 negative_checker.Then(); | 1266 negative_checker.Then(); |
1268 HInstruction* result = BuildExternalArrayElementAccess( | 1267 HInstruction* result = BuildExternalArrayElementAccess( |
1269 external_elements, key, val, bounds_check, | 1268 external_elements, key, val, bounds_check, |
1270 elements_kind, is_store); | 1269 elements_kind, is_store); |
1271 AddInstruction(result); | 1270 AddInstruction(result); |
1272 negative_checker.ElseDeopt(); | 1271 negative_checker.ElseDeopt(); |
1273 length_checker.End(); | 1272 length_checker.End(); |
1274 return result; | 1273 return result; |
1275 } else { | 1274 } else { |
1276 ASSERT(store_mode == STANDARD_STORE); | 1275 ASSERT(store_mode == STANDARD_STORE); |
(...skipping 10238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11515 } | 11514 } |
11516 } | 11515 } |
11517 | 11516 |
11518 #ifdef DEBUG | 11517 #ifdef DEBUG |
11519 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 11518 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
11520 if (allocator_ != NULL) allocator_->Verify(); | 11519 if (allocator_ != NULL) allocator_->Verify(); |
11521 #endif | 11520 #endif |
11522 } | 11521 } |
11523 | 11522 |
11524 } } // namespace v8::internal | 11523 } } // namespace v8::internal |
OLD | NEW |