Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: src/type-info.cc

Issue 9227007: Version 3.8.6 (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/type-info.h ('k') | src/utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 Isolate* isolate) { 64 Isolate* isolate) {
65 global_context_ = global_context; 65 global_context_ = global_context;
66 isolate_ = isolate; 66 isolate_ = isolate;
67 BuildDictionary(code); 67 BuildDictionary(code);
68 ASSERT(reinterpret_cast<Address>(*dictionary_.location()) != kHandleZapValue); 68 ASSERT(reinterpret_cast<Address>(*dictionary_.location()) != kHandleZapValue);
69 } 69 }
70 70
71 71
72 Handle<Object> TypeFeedbackOracle::GetInfo(unsigned ast_id) { 72 Handle<Object> TypeFeedbackOracle::GetInfo(unsigned ast_id) {
73 int entry = dictionary_->FindEntry(ast_id); 73 int entry = dictionary_->FindEntry(ast_id);
74 return entry != NumberDictionary::kNotFound 74 return entry != UnseededNumberDictionary::kNotFound
75 ? Handle<Object>(dictionary_->ValueAt(entry)) 75 ? Handle<Object>(dictionary_->ValueAt(entry))
76 : Handle<Object>::cast(isolate_->factory()->undefined_value()); 76 : Handle<Object>::cast(isolate_->factory()->undefined_value());
77 } 77 }
78 78
79 79
80 bool TypeFeedbackOracle::LoadIsMonomorphicNormal(Property* expr) { 80 bool TypeFeedbackOracle::LoadIsMonomorphicNormal(Property* expr) {
81 Handle<Object> map_or_code = GetInfo(expr->id()); 81 Handle<Object> map_or_code = GetInfo(expr->id());
82 if (map_or_code->IsMap()) return true; 82 if (map_or_code->IsMap()) return true;
83 if (map_or_code->IsCode()) { 83 if (map_or_code->IsCode()) {
84 Handle<Code> code = Handle<Code>::cast(map_or_code); 84 Handle<Code> code = Handle<Code>::cast(map_or_code);
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 for (RelocIterator it(*code, mask); !it.done(); it.next()) { 552 for (RelocIterator it(*code, mask); !it.done(); it.next()) {
553 infos->Add(*it.rinfo()); 553 infos->Add(*it.rinfo());
554 } 554 }
555 } 555 }
556 556
557 557
558 void TypeFeedbackOracle::CreateDictionary(Handle<Code> code, 558 void TypeFeedbackOracle::CreateDictionary(Handle<Code> code,
559 ZoneList<RelocInfo>* infos) { 559 ZoneList<RelocInfo>* infos) {
560 DisableAssertNoAllocation allocation_allowed; 560 DisableAssertNoAllocation allocation_allowed;
561 byte* old_start = code->instruction_start(); 561 byte* old_start = code->instruction_start();
562 dictionary_ = FACTORY->NewNumberDictionary(infos->length()); 562 dictionary_ = FACTORY->NewUnseededNumberDictionary(infos->length());
563 byte* new_start = code->instruction_start(); 563 byte* new_start = code->instruction_start();
564 RelocateRelocInfos(infos, old_start, new_start); 564 RelocateRelocInfos(infos, old_start, new_start);
565 } 565 }
566 566
567 567
568 void TypeFeedbackOracle::RelocateRelocInfos(ZoneList<RelocInfo>* infos, 568 void TypeFeedbackOracle::RelocateRelocInfos(ZoneList<RelocInfo>* infos,
569 byte* old_start, 569 byte* old_start,
570 byte* new_start) { 570 byte* new_start) {
571 for (int i = 0; i < infos->length(); i++) { 571 for (int i = 0; i < infos->length(); i++) {
572 RelocInfo* info = &(*infos)[i]; 572 RelocInfo* info = &(*infos)[i];
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 break; 632 break;
633 633
634 default: 634 default:
635 break; 635 break;
636 } 636 }
637 } 637 }
638 } 638 }
639 639
640 640
641 void TypeFeedbackOracle::SetInfo(unsigned ast_id, Object* target) { 641 void TypeFeedbackOracle::SetInfo(unsigned ast_id, Object* target) {
642 ASSERT(dictionary_->FindEntry(ast_id) == NumberDictionary::kNotFound); 642 ASSERT(dictionary_->FindEntry(ast_id) == UnseededNumberDictionary::kNotFound);
643 MaybeObject* maybe_result = dictionary_->AtNumberPut(ast_id, target); 643 MaybeObject* maybe_result = dictionary_->AtNumberPut(ast_id, target);
644 USE(maybe_result); 644 USE(maybe_result);
645 #ifdef DEBUG 645 #ifdef DEBUG
646 Object* result = NULL; 646 Object* result = NULL;
647 // Dictionary has been allocated with sufficient size for all elements. 647 // Dictionary has been allocated with sufficient size for all elements.
648 ASSERT(maybe_result->ToObject(&result)); 648 ASSERT(maybe_result->ToObject(&result));
649 ASSERT(*dictionary_ == result); 649 ASSERT(*dictionary_ == result);
650 #endif 650 #endif
651 } 651 }
652 652
653 } } // namespace v8::internal 653 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/type-info.h ('k') | src/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698