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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 instr->DeleteAndReplaceWith(instr->value()); | 375 instr->DeleteAndReplaceWith(instr->value()); |
376 INC_STAT(removed_); | 376 INC_STAT(removed_); |
377 } else if (value != instr) { | 377 } else if (value != instr) { |
378 instr->DeleteAndReplaceWith(value); | 378 instr->DeleteAndReplaceWith(value); |
379 INC_STAT(redundant_); | 379 INC_STAT(redundant_); |
380 } | 380 } |
381 } | 381 } |
382 | 382 |
383 void ReduceLoadNamedField(HLoadNamedField* instr) { | 383 void ReduceLoadNamedField(HLoadNamedField* instr) { |
384 // Reduce a load of the map field when it is known to be a constant. | 384 // Reduce a load of the map field when it is known to be a constant. |
385 if (!IsMapAccess(instr->access())) return; | 385 if (!IsMapAccess(instr->access())) { |
| 386 // Check if we introduce a map here. |
| 387 if (!instr->map().IsNull()) { |
| 388 Insert(instr, instr, instr->map()); |
| 389 } |
| 390 return; |
| 391 } |
386 | 392 |
387 HValue* object = instr->object()->ActualValue(); | 393 HValue* object = instr->object()->ActualValue(); |
388 MapSet maps = FindMaps(object); | 394 MapSet maps = FindMaps(object); |
389 if (maps == NULL || maps->size() != 1) return; // Not a constant. | 395 if (maps == NULL || maps->size() != 1) return; // Not a constant. |
390 | 396 |
391 Unique<Map> map = maps->at(0); | 397 Unique<Map> map = maps->at(0); |
392 HConstant* constant = HConstant::CreateAndInsertBefore( | 398 HConstant* constant = HConstant::CreateAndInsertBefore( |
393 instr->block()->graph()->zone(), map, true, instr); | 399 instr->block()->graph()->zone(), map, true, instr); |
394 instr->DeleteAndReplaceWith(constant); | 400 instr->DeleteAndReplaceWith(constant); |
395 INC_STAT(loads_); | 401 INC_STAT(loads_); |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 PRINT_STAT(removed_cho); | 742 PRINT_STAT(removed_cho); |
737 PRINT_STAT(narrowed); | 743 PRINT_STAT(narrowed); |
738 PRINT_STAT(loads); | 744 PRINT_STAT(loads); |
739 PRINT_STAT(empty); | 745 PRINT_STAT(empty); |
740 PRINT_STAT(compares_true); | 746 PRINT_STAT(compares_true); |
741 PRINT_STAT(compares_false); | 747 PRINT_STAT(compares_false); |
742 PRINT_STAT(transitions); | 748 PRINT_STAT(transitions); |
743 } | 749 } |
744 | 750 |
745 } } // namespace v8::internal | 751 } } // namespace v8::internal |
OLD | NEW |