| 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 void ReduceCheckHeapObject(HCheckHeapObject* instr) { | 261 void ReduceCheckHeapObject(HCheckHeapObject* instr) { |
| 262 if (FindMaps(instr->value()->ActualValue()) != NULL) { | 262 if (FindMaps(instr->value()->ActualValue()) != NULL) { |
| 263 // If the object has known maps, it's definitely a heap object. | 263 // If the object has known maps, it's definitely a heap object. |
| 264 instr->DeleteAndReplaceWith(instr->value()); | 264 instr->DeleteAndReplaceWith(instr->value()); |
| 265 INC_STAT(removed_cho_); | 265 INC_STAT(removed_cho_); |
| 266 } | 266 } |
| 267 } | 267 } |
| 268 | 268 |
| 269 void ReduceStoreNamedField(HStoreNamedField* instr) { | 269 void ReduceStoreNamedField(HStoreNamedField* instr) { |
| 270 HValue* object = instr->object()->ActualValue(); | 270 HValue* object = instr->object()->ActualValue(); |
| 271 if (instr->has_transition()) { | 271 if (IsMapAccess(instr->access())) { |
| 272 // This store transitions the object to a new map. | |
| 273 Kill(object); | |
| 274 Insert(object, MapConstant(instr->transition())); | |
| 275 } else if (IsMapAccess(instr->access())) { | |
| 276 // This is a store directly to the map field of the object. | 272 // This is a store directly to the map field of the object. |
| 277 Kill(object); | 273 Kill(object); |
| 278 if (!instr->value()->IsConstant()) return; | 274 if (!instr->value()->IsConstant()) return; |
| 279 Insert(object, MapConstant(instr->value())); | 275 Insert(object, MapConstant(instr->value())); |
| 280 } else { | 276 } else { |
| 281 // If the instruction changes maps, it should be handled above. | 277 // If the instruction changes maps, it should be handled above. |
| 282 CHECK(!instr->CheckGVNFlag(kChangesMaps)); | 278 CHECK(!instr->CheckGVNFlag(kChangesMaps)); |
| 283 } | 279 } |
| 284 } | 280 } |
| 285 | 281 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 void Apply(HCheckTable* table) { | 463 void Apply(HCheckTable* table) { |
| 468 if (maps_stored_) { | 464 if (maps_stored_) { |
| 469 // Uncontrollable map modifications; kill everything. | 465 // Uncontrollable map modifications; kill everything. |
| 470 table->Kill(); | 466 table->Kill(); |
| 471 return; | 467 return; |
| 472 } | 468 } |
| 473 | 469 |
| 474 // Kill maps for each store contained in these effects. | 470 // Kill maps for each store contained in these effects. |
| 475 for (int i = 0; i < stores_.length(); i++) { | 471 for (int i = 0; i < stores_.length(); i++) { |
| 476 HStoreNamedField* s = stores_[i]; | 472 HStoreNamedField* s = stores_[i]; |
| 477 if (table->IsMapAccess(s->access()) || s->has_transition()) { | 473 if (table->IsMapAccess(s->access())) { |
| 478 table->Kill(s->object()->ActualValue()); | 474 table->Kill(s->object()->ActualValue()); |
| 479 } | 475 } |
| 480 } | 476 } |
| 481 } | 477 } |
| 482 | 478 |
| 483 // Union these effects with the other effects. | 479 // Union these effects with the other effects. |
| 484 void Union(HCheckMapsEffects* that, Zone* zone) { | 480 void Union(HCheckMapsEffects* that, Zone* zone) { |
| 485 maps_stored_ |= that->maps_stored_; | 481 maps_stored_ |= that->maps_stored_; |
| 486 for (int i = 0; i < that->stores_.length(); i++) { | 482 for (int i = 0; i < that->stores_.length(); i++) { |
| 487 stores_.Add(that->stores_[i], zone); | 483 stores_.Add(that->stores_[i], zone); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 PRINT_STAT(removed_cho); | 523 PRINT_STAT(removed_cho); |
| 528 PRINT_STAT(narrowed); | 524 PRINT_STAT(narrowed); |
| 529 PRINT_STAT(loads); | 525 PRINT_STAT(loads); |
| 530 PRINT_STAT(empty); | 526 PRINT_STAT(empty); |
| 531 PRINT_STAT(compares_true); | 527 PRINT_STAT(compares_true); |
| 532 PRINT_STAT(compares_false); | 528 PRINT_STAT(compares_false); |
| 533 PRINT_STAT(transitions); | 529 PRINT_STAT(transitions); |
| 534 } | 530 } |
| 535 | 531 |
| 536 } } // namespace v8::internal | 532 } } // namespace v8::internal |
| OLD | NEW |