| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 int mask = RelocInfo::ModeMask(RelocInfo::CODE_TARGET_WITH_ID); | 558 int mask = RelocInfo::ModeMask(RelocInfo::CODE_TARGET_WITH_ID); |
| 559 for (RelocIterator it(*code, mask); !it.done(); it.next()) { | 559 for (RelocIterator it(*code, mask); !it.done(); it.next()) { |
| 560 infos->Add(*it.rinfo()); | 560 infos->Add(*it.rinfo()); |
| 561 } | 561 } |
| 562 } | 562 } |
| 563 | 563 |
| 564 | 564 |
| 565 void TypeFeedbackOracle::CreateDictionary(Handle<Code> code, | 565 void TypeFeedbackOracle::CreateDictionary(Handle<Code> code, |
| 566 ZoneList<RelocInfo>* infos) { | 566 ZoneList<RelocInfo>* infos) { |
| 567 DisableAssertNoAllocation allocation_allowed; | 567 DisableAssertNoAllocation allocation_allowed; |
| 568 int length = infos->length() + code->type_feedback_cells()->CellCount(); |
| 568 byte* old_start = code->instruction_start(); | 569 byte* old_start = code->instruction_start(); |
| 569 dictionary_ = FACTORY->NewUnseededNumberDictionary(infos->length()); | 570 dictionary_ = FACTORY->NewUnseededNumberDictionary(length); |
| 570 byte* new_start = code->instruction_start(); | 571 byte* new_start = code->instruction_start(); |
| 571 RelocateRelocInfos(infos, old_start, new_start); | 572 RelocateRelocInfos(infos, old_start, new_start); |
| 572 } | 573 } |
| 573 | 574 |
| 574 | 575 |
| 575 void TypeFeedbackOracle::RelocateRelocInfos(ZoneList<RelocInfo>* infos, | 576 void TypeFeedbackOracle::RelocateRelocInfos(ZoneList<RelocInfo>* infos, |
| 576 byte* old_start, | 577 byte* old_start, |
| 577 byte* new_start) { | 578 byte* new_start) { |
| 578 for (int i = 0; i < infos->length(); i++) { | 579 for (int i = 0; i < infos->length(); i++) { |
| 579 RelocInfo* info = &(*infos)[i]; | 580 RelocInfo* info = &(*infos)[i]; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 653 USE(maybe_result); | 654 USE(maybe_result); |
| 654 #ifdef DEBUG | 655 #ifdef DEBUG |
| 655 Object* result = NULL; | 656 Object* result = NULL; |
| 656 // Dictionary has been allocated with sufficient size for all elements. | 657 // Dictionary has been allocated with sufficient size for all elements. |
| 657 ASSERT(maybe_result->ToObject(&result)); | 658 ASSERT(maybe_result->ToObject(&result)); |
| 658 ASSERT(*dictionary_ == result); | 659 ASSERT(*dictionary_ == result); |
| 659 #endif | 660 #endif |
| 660 } | 661 } |
| 661 | 662 |
| 662 } } // namespace v8::internal | 663 } } // namespace v8::internal |
| OLD | NEW |