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())) { | 385 if (!IsMapAccess(instr->access())) return; |
386 // Check if we introduce a map here. | |
387 if (!instr->map().IsNull()) { | |
388 Insert(instr, instr, instr->map()); | |
389 } | |
390 return; | |
391 } | |
392 | 386 |
393 HValue* object = instr->object()->ActualValue(); | 387 HValue* object = instr->object()->ActualValue(); |
394 MapSet maps = FindMaps(object); | 388 MapSet maps = FindMaps(object); |
395 if (maps == NULL || maps->size() != 1) return; // Not a constant. | 389 if (maps == NULL || maps->size() != 1) return; // Not a constant. |
396 | 390 |
397 Unique<Map> map = maps->at(0); | 391 Unique<Map> map = maps->at(0); |
398 HConstant* constant = HConstant::CreateAndInsertBefore( | 392 HConstant* constant = HConstant::CreateAndInsertBefore( |
399 instr->block()->graph()->zone(), map, true, instr); | 393 instr->block()->graph()->zone(), map, true, instr); |
400 instr->DeleteAndReplaceWith(constant); | 394 instr->DeleteAndReplaceWith(constant); |
401 INC_STAT(loads_); | 395 INC_STAT(loads_); |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 PRINT_STAT(removed_cho); | 736 PRINT_STAT(removed_cho); |
743 PRINT_STAT(narrowed); | 737 PRINT_STAT(narrowed); |
744 PRINT_STAT(loads); | 738 PRINT_STAT(loads); |
745 PRINT_STAT(empty); | 739 PRINT_STAT(empty); |
746 PRINT_STAT(compares_true); | 740 PRINT_STAT(compares_true); |
747 PRINT_STAT(compares_false); | 741 PRINT_STAT(compares_false); |
748 PRINT_STAT(transitions); | 742 PRINT_STAT(transitions); |
749 } | 743 } |
750 | 744 |
751 } } // namespace v8::internal | 745 } } // namespace v8::internal |
OLD | NEW |