| 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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 } | 298 } |
| 299 return this; | 299 return this; |
| 300 } | 300 } |
| 301 | 301 |
| 302 void ReduceCheckMaps(HCheckMaps* instr) { | 302 void ReduceCheckMaps(HCheckMaps* instr) { |
| 303 HValue* object = instr->value()->ActualValue(); | 303 HValue* object = instr->value()->ActualValue(); |
| 304 HCheckTableEntry* entry = Find(object); | 304 HCheckTableEntry* entry = Find(object); |
| 305 if (entry != NULL) { | 305 if (entry != NULL) { |
| 306 // entry found; | 306 // entry found; |
| 307 MapSet a = entry->maps_; | 307 MapSet a = entry->maps_; |
| 308 MapSet i = instr->map_set().Copy(phase_->zone()); | 308 MapSet i = instr->map_set()->Copy(phase_->zone()); |
| 309 if (a->IsSubset(i)) { | 309 if (a->IsSubset(i)) { |
| 310 // The first check is more strict; the second is redundant. | 310 // The first check is more strict; the second is redundant. |
| 311 if (entry->check_ != NULL) { | 311 if (entry->check_ != NULL) { |
| 312 TRACE(("Replacing redundant CheckMaps #%d at B%d with #%d\n", | 312 TRACE(("Replacing redundant CheckMaps #%d at B%d with #%d\n", |
| 313 instr->id(), instr->block()->block_id(), entry->check_->id())); | 313 instr->id(), instr->block()->block_id(), entry->check_->id())); |
| 314 instr->DeleteAndReplaceWith(entry->check_); | 314 instr->DeleteAndReplaceWith(entry->check_); |
| 315 INC_STAT(redundant_); | 315 INC_STAT(redundant_); |
| 316 } else { | 316 } else { |
| 317 TRACE(("Marking redundant CheckMaps #%d at B%d as dead\n", | 317 TRACE(("Marking redundant CheckMaps #%d at B%d as dead\n", |
| 318 instr->id(), instr->block()->block_id())); | 318 instr->id(), instr->block()->block_id())); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 } | 357 } |
| 358 | 358 |
| 359 if (FLAG_trace_check_elimination) { | 359 if (FLAG_trace_check_elimination) { |
| 360 Print(this); | 360 Print(this); |
| 361 } | 361 } |
| 362 INC_STAT(narrowed_); | 362 INC_STAT(narrowed_); |
| 363 } | 363 } |
| 364 } | 364 } |
| 365 } else { | 365 } else { |
| 366 // No entry; insert a new one. | 366 // No entry; insert a new one. |
| 367 Insert(object, instr, instr->map_set().Copy(phase_->zone())); | 367 Insert(object, instr, instr->map_set()->Copy(phase_->zone())); |
| 368 } | 368 } |
| 369 } | 369 } |
| 370 | 370 |
| 371 void ReduceCheckValue(HCheckValue* instr) { | 371 void ReduceCheckValue(HCheckValue* instr) { |
| 372 // Canonicalize HCheckValues; they might have their values load-eliminated. | 372 // Canonicalize HCheckValues; they might have their values load-eliminated. |
| 373 HValue* value = instr->Canonicalize(); | 373 HValue* value = instr->Canonicalize(); |
| 374 if (value == NULL) { | 374 if (value == NULL) { |
| 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())) { |
| 386 // Check if we introduce field maps here. | 386 // Check if we introduce field maps here. |
| 387 if (instr->map_set().size() != 0) { | 387 if (instr->map_set()->size() != 0) { |
| 388 Insert(instr, instr, instr->map_set().Copy(phase_->zone())); | 388 Insert(instr, instr, instr->map_set()->Copy(phase_->zone())); |
| 389 } | 389 } |
| 390 return; | 390 return; |
| 391 } | 391 } |
| 392 | 392 |
| 393 HValue* object = instr->object()->ActualValue(); | 393 HValue* object = instr->object()->ActualValue(); |
| 394 MapSet maps = FindMaps(object); | 394 MapSet maps = FindMaps(object); |
| 395 if (maps == NULL || maps->size() != 1) return; // Not a constant. | 395 if (maps == NULL || maps->size() != 1) return; // Not a constant. |
| 396 | 396 |
| 397 Unique<Map> map = maps->at(0); | 397 Unique<Map> map = maps->at(0); |
| 398 HConstant* constant = HConstant::CreateAndInsertBefore( | 398 HConstant* constant = HConstant::CreateAndInsertBefore( |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 742 PRINT_STAT(removed_cho); | 742 PRINT_STAT(removed_cho); |
| 743 PRINT_STAT(narrowed); | 743 PRINT_STAT(narrowed); |
| 744 PRINT_STAT(loads); | 744 PRINT_STAT(loads); |
| 745 PRINT_STAT(empty); | 745 PRINT_STAT(empty); |
| 746 PRINT_STAT(compares_true); | 746 PRINT_STAT(compares_true); |
| 747 PRINT_STAT(compares_false); | 747 PRINT_STAT(compares_false); |
| 748 PRINT_STAT(transitions); | 748 PRINT_STAT(transitions); |
| 749 } | 749 } |
| 750 | 750 |
| 751 } } // namespace v8::internal | 751 } } // namespace v8::internal |
| OLD | NEW |