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 985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
996 ASSERT(current_block() != NULL); | 996 ASSERT(current_block() != NULL); |
997 ASSERT(no_side_effects_scope_count_ == 0); | 997 ASSERT(no_side_effects_scope_count_ == 0); |
998 current_block()->AddSimulate(id, removable); | 998 current_block()->AddSimulate(id, removable); |
999 } | 999 } |
1000 | 1000 |
1001 | 1001 |
1002 HBoundsCheck* HGraphBuilder::AddBoundsCheck(HValue* index, | 1002 HBoundsCheck* HGraphBuilder::AddBoundsCheck(HValue* index, |
1003 HValue* length, | 1003 HValue* length, |
1004 BoundsCheckKeyMode key_mode, | 1004 BoundsCheckKeyMode key_mode, |
1005 Representation r) { | 1005 Representation r) { |
1006 if (!index->type().IsSmi()) { | |
1007 index = new(graph()->zone()) HCheckSmiOrInt32(index); | |
1008 AddInstruction(HCheckSmiOrInt32::cast(index)); | |
1009 } | |
1010 if (!length->type().IsSmi()) { | |
1011 length = new(graph()->zone()) HCheckSmiOrInt32(length); | |
1012 AddInstruction(HCheckSmiOrInt32::cast(length)); | |
1013 } | |
1014 HBoundsCheck* result = new(graph()->zone()) HBoundsCheck( | 1006 HBoundsCheck* result = new(graph()->zone()) HBoundsCheck( |
1015 index, length, key_mode, r); | 1007 index, length, key_mode, r); |
1016 AddInstruction(result); | 1008 AddInstruction(result); |
1017 return result; | 1009 return result; |
1018 } | 1010 } |
1019 | 1011 |
1020 | 1012 |
1021 HReturn* HGraphBuilder::AddReturn(HValue* value) { | 1013 HReturn* HGraphBuilder::AddReturn(HValue* value) { |
1022 HValue* context = environment()->LookupContext(); | 1014 HValue* context = environment()->LookupContext(); |
1023 int num_parameters = graph()->info()->num_parameters(); | 1015 int num_parameters = graph()->info()->num_parameters(); |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1331 if (is_store && IsFastSmiElementsKind(elements_kind) && | 1323 if (is_store && IsFastSmiElementsKind(elements_kind) && |
1332 !val->type().IsSmi()) { | 1324 !val->type().IsSmi()) { |
1333 AddInstruction(new(zone) HCheckSmi(val)); | 1325 AddInstruction(new(zone) HCheckSmi(val)); |
1334 } | 1326 } |
1335 | 1327 |
1336 if (IsGrowStoreMode(store_mode)) { | 1328 if (IsGrowStoreMode(store_mode)) { |
1337 NoObservableSideEffectsScope no_effects(this); | 1329 NoObservableSideEffectsScope no_effects(this); |
1338 | 1330 |
1339 elements = BuildCheckForCapacityGrow(object, elements, elements_kind, | 1331 elements = BuildCheckForCapacityGrow(object, elements, elements_kind, |
1340 length, key, is_js_array); | 1332 length, key, is_js_array); |
1341 if (!key->type().IsSmi()) { | 1333 checked_key = key; |
1342 checked_key = AddInstruction(new(zone) HCheckSmiOrInt32(key)); | |
1343 } else { | |
1344 checked_key = key; | |
1345 } | |
1346 } else { | 1334 } else { |
1347 checked_key = AddBoundsCheck( | 1335 checked_key = AddBoundsCheck( |
1348 key, length, ALLOW_SMI_KEY, checked_index_representation); | 1336 key, length, ALLOW_SMI_KEY, checked_index_representation); |
1349 | 1337 |
1350 if (is_store && (fast_elements || fast_smi_only_elements)) { | 1338 if (is_store && (fast_elements || fast_smi_only_elements)) { |
1351 if (store_mode == STORE_NO_TRANSITION_HANDLE_COW) { | 1339 if (store_mode == STORE_NO_TRANSITION_HANDLE_COW) { |
1352 NoObservableSideEffectsScope no_effects(this); | 1340 NoObservableSideEffectsScope no_effects(this); |
1353 | 1341 |
1354 elements = BuildCopyElementsOnWrite(object, elements, elements_kind, | 1342 elements = BuildCopyElementsOnWrite(object, elements, elements_kind, |
1355 length); | 1343 length); |
(...skipping 11122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12478 } | 12466 } |
12479 } | 12467 } |
12480 | 12468 |
12481 #ifdef DEBUG | 12469 #ifdef DEBUG |
12482 if (graph_ != NULL) graph_->Verify(false); // No full verify. | 12470 if (graph_ != NULL) graph_->Verify(false); // No full verify. |
12483 if (allocator_ != NULL) allocator_->Verify(); | 12471 if (allocator_ != NULL) allocator_->Verify(); |
12484 #endif | 12472 #endif |
12485 } | 12473 } |
12486 | 12474 |
12487 } } // namespace v8::internal | 12475 } } // namespace v8::internal |
OLD | NEW |