| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 } | 584 } |
| 585 | 585 |
| 586 | 586 |
| 587 // Things are a bit tricky here: The iterator for the RelocInfos and the infos | 587 // Things are a bit tricky here: The iterator for the RelocInfos and the infos |
| 588 // themselves are not GC-safe, so we first get all infos, then we create the | 588 // themselves are not GC-safe, so we first get all infos, then we create the |
| 589 // dictionary (possibly triggering GC), and finally we relocate the collected | 589 // dictionary (possibly triggering GC), and finally we relocate the collected |
| 590 // infos before we process them. | 590 // infos before we process them. |
| 591 void TypeFeedbackOracle::BuildDictionary(Handle<Code> code) { | 591 void TypeFeedbackOracle::BuildDictionary(Handle<Code> code) { |
| 592 AssertNoAllocation no_allocation; | 592 AssertNoAllocation no_allocation; |
| 593 ZoneList<RelocInfo> infos(16, zone()); | 593 ZoneList<RelocInfo> infos(16, zone()); |
| 594 HandleScope scope; | 594 HandleScope scope(code->GetIsolate()); |
| 595 GetRelocInfos(code, &infos); | 595 GetRelocInfos(code, &infos); |
| 596 CreateDictionary(code, &infos); | 596 CreateDictionary(code, &infos); |
| 597 ProcessRelocInfos(&infos); | 597 ProcessRelocInfos(&infos); |
| 598 ProcessTypeFeedbackCells(code); | 598 ProcessTypeFeedbackCells(code); |
| 599 // Allocate handle in the parent scope. | 599 // Allocate handle in the parent scope. |
| 600 dictionary_ = scope.CloseAndEscape(dictionary_); | 600 dictionary_ = scope.CloseAndEscape(dictionary_); |
| 601 } | 601 } |
| 602 | 602 |
| 603 | 603 |
| 604 void TypeFeedbackOracle::GetRelocInfos(Handle<Code> code, | 604 void TypeFeedbackOracle::GetRelocInfos(Handle<Code> code, |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 712 USE(maybe_result); | 712 USE(maybe_result); |
| 713 #ifdef DEBUG | 713 #ifdef DEBUG |
| 714 Object* result = NULL; | 714 Object* result = NULL; |
| 715 // Dictionary has been allocated with sufficient size for all elements. | 715 // Dictionary has been allocated with sufficient size for all elements. |
| 716 ASSERT(maybe_result->ToObject(&result)); | 716 ASSERT(maybe_result->ToObject(&result)); |
| 717 ASSERT(*dictionary_ == result); | 717 ASSERT(*dictionary_ == result); |
| 718 #endif | 718 #endif |
| 719 } | 719 } |
| 720 | 720 |
| 721 } } // namespace v8::internal | 721 } } // namespace v8::internal |
| OLD | NEW |