| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 TypeFeedbackOracle::TypeFeedbackOracle(Handle<Code> code, | 62 TypeFeedbackOracle::TypeFeedbackOracle(Handle<Code> code, |
| 63 Handle<Context> global_context) { | 63 Handle<Context> global_context) { |
| 64 global_context_ = global_context; | 64 global_context_ = global_context; |
| 65 BuildDictionary(code); | 65 BuildDictionary(code); |
| 66 ASSERT(reinterpret_cast<Address>(*dictionary_.location()) != kHandleZapValue); | 66 ASSERT(reinterpret_cast<Address>(*dictionary_.location()) != kHandleZapValue); |
| 67 } | 67 } |
| 68 | 68 |
| 69 | 69 |
| 70 Handle<Object> TypeFeedbackOracle::GetInfo(unsigned ast_id) { | 70 Handle<Object> TypeFeedbackOracle::GetInfo(unsigned ast_id) { |
| 71 int entry = dictionary_->FindEntry(ast_id); | 71 int entry = dictionary_->FindEntry(ast_id); |
| 72 return entry != NumberDictionary::kNotFound | 72 return entry != UnseededNumberDictionary::kNotFound |
| 73 ? Handle<Object>(dictionary_->ValueAt(entry)) | 73 ? Handle<Object>(dictionary_->ValueAt(entry)) |
| 74 : Isolate::Current()->factory()->undefined_value(); | 74 : Isolate::Current()->factory()->undefined_value(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 | 77 |
| 78 bool TypeFeedbackOracle::LoadIsMonomorphicNormal(Property* expr) { | 78 bool TypeFeedbackOracle::LoadIsMonomorphicNormal(Property* expr) { |
| 79 Handle<Object> map_or_code(GetInfo(expr->id())); | 79 Handle<Object> map_or_code(GetInfo(expr->id())); |
| 80 if (map_or_code->IsMap()) return true; | 80 if (map_or_code->IsMap()) return true; |
| 81 if (map_or_code->IsCode()) { | 81 if (map_or_code->IsCode()) { |
| 82 Handle<Code> code = Handle<Code>::cast(map_or_code); | 82 Handle<Code> code = Handle<Code>::cast(map_or_code); |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 for (RelocIterator it(*code, mask); !it.done(); it.next()) { | 463 for (RelocIterator it(*code, mask); !it.done(); it.next()) { |
| 464 infos->Add(*it.rinfo()); | 464 infos->Add(*it.rinfo()); |
| 465 } | 465 } |
| 466 } | 466 } |
| 467 | 467 |
| 468 | 468 |
| 469 void TypeFeedbackOracle::CreateDictionary(Handle<Code> code, | 469 void TypeFeedbackOracle::CreateDictionary(Handle<Code> code, |
| 470 ZoneList<RelocInfo>* infos) { | 470 ZoneList<RelocInfo>* infos) { |
| 471 DisableAssertNoAllocation allocation_allowed; | 471 DisableAssertNoAllocation allocation_allowed; |
| 472 byte* old_start = code->instruction_start(); | 472 byte* old_start = code->instruction_start(); |
| 473 dictionary_ = FACTORY->NewNumberDictionary(infos->length()); | 473 dictionary_ = FACTORY->NewUnseededNumberDictionary(infos->length()); |
| 474 byte* new_start = code->instruction_start(); | 474 byte* new_start = code->instruction_start(); |
| 475 RelocateRelocInfos(infos, old_start, new_start); | 475 RelocateRelocInfos(infos, old_start, new_start); |
| 476 } | 476 } |
| 477 | 477 |
| 478 | 478 |
| 479 void TypeFeedbackOracle::RelocateRelocInfos(ZoneList<RelocInfo>* infos, | 479 void TypeFeedbackOracle::RelocateRelocInfos(ZoneList<RelocInfo>* infos, |
| 480 byte* old_start, | 480 byte* old_start, |
| 481 byte* new_start) { | 481 byte* new_start) { |
| 482 for (int i = 0; i < infos->length(); i++) { | 482 for (int i = 0; i < infos->length(); i++) { |
| 483 RelocInfo* info = &(*infos)[i]; | 483 RelocInfo* info = &(*infos)[i]; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 SetInfo(ast_id, target); | 529 SetInfo(ast_id, target); |
| 530 break; | 530 break; |
| 531 | 531 |
| 532 default: | 532 default: |
| 533 break; | 533 break; |
| 534 } | 534 } |
| 535 } | 535 } |
| 536 | 536 |
| 537 | 537 |
| 538 void TypeFeedbackOracle::SetInfo(unsigned ast_id, Object* target) { | 538 void TypeFeedbackOracle::SetInfo(unsigned ast_id, Object* target) { |
| 539 ASSERT(dictionary_->FindEntry(ast_id) == NumberDictionary::kNotFound); | 539 ASSERT(dictionary_->FindEntry(ast_id) == UnseededNumberDictionary::kNotFound); |
| 540 MaybeObject* maybe_result = dictionary_->AtNumberPut(ast_id, target); | 540 MaybeObject* maybe_result = dictionary_->AtNumberPut(ast_id, target); |
| 541 USE(maybe_result); | 541 USE(maybe_result); |
| 542 #ifdef DEBUG | 542 #ifdef DEBUG |
| 543 Object* result = NULL; | 543 Object* result = NULL; |
| 544 // Dictionary has been allocated with sufficient size for all elements. | 544 // Dictionary has been allocated with sufficient size for all elements. |
| 545 ASSERT(maybe_result->ToObject(&result)); | 545 ASSERT(maybe_result->ToObject(&result)); |
| 546 ASSERT(*dictionary_ == result); | 546 ASSERT(*dictionary_ == result); |
| 547 #endif | 547 #endif |
| 548 } | 548 } |
| 549 | 549 |
| 550 } } // namespace v8::internal | 550 } } // namespace v8::internal |
| OLD | NEW |