OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1152 capacity_checker.If<HCompareNumericAndBranch>(length, current_capacity, | 1152 capacity_checker.If<HCompareNumericAndBranch>(length, current_capacity, |
1153 Token::EQ); | 1153 Token::EQ); |
1154 capacity_checker.Then(); | 1154 capacity_checker.Then(); |
1155 | 1155 |
1156 HValue* context = environment()->LookupContext(); | 1156 HValue* context = environment()->LookupContext(); |
1157 | 1157 |
1158 HValue* new_capacity = | 1158 HValue* new_capacity = |
1159 BuildNewElementsCapacity(context, current_capacity); | 1159 BuildNewElementsCapacity(context, current_capacity); |
1160 | 1160 |
1161 HValue* new_elements = BuildGrowElementsCapacity(object, elements, | 1161 HValue* new_elements = BuildGrowElementsCapacity(object, elements, |
1162 kind, length, | 1162 kind, kind, length, |
1163 new_capacity); | 1163 new_capacity); |
1164 | 1164 |
1165 environment()->Push(new_elements); | 1165 environment()->Push(new_elements); |
1166 capacity_checker.Else(); | 1166 capacity_checker.Else(); |
1167 | 1167 |
1168 environment()->Push(elements); | 1168 environment()->Push(elements); |
1169 capacity_checker.End(); | 1169 capacity_checker.End(); |
1170 | 1170 |
1171 if (is_js_array) { | 1171 if (is_js_array) { |
1172 HValue* new_length = AddInstruction( | 1172 HValue* new_length = AddInstruction( |
(...skipping 23 matching lines...) Expand all Loading... |
1196 HValue* length) { | 1196 HValue* length) { |
1197 Factory* factory = isolate()->factory(); | 1197 Factory* factory = isolate()->factory(); |
1198 | 1198 |
1199 IfBuilder cow_checker(this); | 1199 IfBuilder cow_checker(this); |
1200 | 1200 |
1201 cow_checker.If<HCompareMap>(elements, factory->fixed_cow_array_map()); | 1201 cow_checker.If<HCompareMap>(elements, factory->fixed_cow_array_map()); |
1202 cow_checker.Then(); | 1202 cow_checker.Then(); |
1203 | 1203 |
1204 HValue* capacity = AddLoadFixedArrayLength(elements); | 1204 HValue* capacity = AddLoadFixedArrayLength(elements); |
1205 | 1205 |
1206 HValue* new_elements = BuildGrowElementsCapacity(object, elements, | 1206 HValue* new_elements = BuildGrowElementsCapacity(object, elements, kind, |
1207 kind, length, capacity); | 1207 kind, length, capacity); |
1208 | 1208 |
1209 environment()->Push(new_elements); | 1209 environment()->Push(new_elements); |
1210 | 1210 |
1211 cow_checker.Else(); | 1211 cow_checker.Else(); |
1212 | 1212 |
1213 environment()->Push(elements); | 1213 environment()->Push(elements); |
1214 | 1214 |
1215 cow_checker.End(); | 1215 cow_checker.End(); |
1216 | 1216 |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1468 HConstant* max_size_constant = Add<HConstant>(max_size); | 1468 HConstant* max_size_constant = Add<HConstant>(max_size); |
1469 // Since we're forcing Integer32 representation for this HBoundsCheck, | 1469 // Since we're forcing Integer32 representation for this HBoundsCheck, |
1470 // there's no need to Smi-check the index. | 1470 // there's no need to Smi-check the index. |
1471 Add<HBoundsCheck>(length, max_size_constant); | 1471 Add<HBoundsCheck>(length, max_size_constant); |
1472 } | 1472 } |
1473 | 1473 |
1474 | 1474 |
1475 HValue* HGraphBuilder::BuildGrowElementsCapacity(HValue* object, | 1475 HValue* HGraphBuilder::BuildGrowElementsCapacity(HValue* object, |
1476 HValue* elements, | 1476 HValue* elements, |
1477 ElementsKind kind, | 1477 ElementsKind kind, |
| 1478 ElementsKind new_kind, |
1478 HValue* length, | 1479 HValue* length, |
1479 HValue* new_capacity) { | 1480 HValue* new_capacity) { |
1480 HValue* context = environment()->LookupContext(); | 1481 HValue* context = environment()->LookupContext(); |
1481 | 1482 |
1482 BuildNewSpaceArrayCheck(new_capacity, kind); | 1483 BuildNewSpaceArrayCheck(new_capacity, new_kind); |
1483 | 1484 |
1484 HValue* new_elements = BuildAllocateElementsAndInitializeElementsHeader( | 1485 HValue* new_elements = BuildAllocateElementsAndInitializeElementsHeader( |
1485 context, kind, new_capacity); | 1486 context, new_kind, new_capacity); |
1486 | 1487 |
1487 BuildCopyElements(context, elements, kind, | 1488 BuildCopyElements(context, elements, kind, |
1488 new_elements, kind, | 1489 new_elements, new_kind, |
1489 length, new_capacity); | 1490 length, new_capacity); |
1490 | 1491 |
1491 AddStore(object, HObjectAccess::ForElementsPointer(), new_elements); | 1492 AddStore(object, HObjectAccess::ForElementsPointer(), new_elements); |
1492 | 1493 |
1493 return new_elements; | 1494 return new_elements; |
1494 } | 1495 } |
1495 | 1496 |
1496 | 1497 |
1497 void HGraphBuilder::BuildFillElementsWithHole(HValue* context, | 1498 void HGraphBuilder::BuildFillElementsWithHole(HValue* context, |
1498 HValue* elements, | 1499 HValue* elements, |
(...skipping 8688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10187 if (ShouldProduceTraceOutput()) { | 10188 if (ShouldProduceTraceOutput()) { |
10188 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 10189 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
10189 } | 10190 } |
10190 | 10191 |
10191 #ifdef DEBUG | 10192 #ifdef DEBUG |
10192 graph_->Verify(false); // No full verify. | 10193 graph_->Verify(false); // No full verify. |
10193 #endif | 10194 #endif |
10194 } | 10195 } |
10195 | 10196 |
10196 } } // namespace v8::internal | 10197 } } // namespace v8::internal |
OLD | NEW |