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

Side by Side Diff: src/heap.cc

Issue 253393006: WeakHashTable::Put() and callers handlified. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing review comments Created 6 years, 8 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/heap.h ('k') | src/lithium-codegen.cc » ('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 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 5654 matching lines...) Expand 10 before | Expand all | Expand 10 after
5665 for (int i = 0; i < gc_epilogue_callbacks_.length(); ++i) { 5665 for (int i = 0; i < gc_epilogue_callbacks_.length(); ++i) {
5666 if (gc_epilogue_callbacks_[i].callback == callback) { 5666 if (gc_epilogue_callbacks_[i].callback == callback) {
5667 gc_epilogue_callbacks_.Remove(i); 5667 gc_epilogue_callbacks_.Remove(i);
5668 return; 5668 return;
5669 } 5669 }
5670 } 5670 }
5671 UNREACHABLE(); 5671 UNREACHABLE();
5672 } 5672 }
5673 5673
5674 5674
5675 MaybeObject* Heap::AddWeakObjectToCodeDependency(Object* obj, 5675 // TODO(ishell): Find a better place for this.
5676 DependentCode* dep) { 5676 void Heap::AddWeakObjectToCodeDependency(Handle<Object> obj,
5677 ASSERT(!InNewSpace(obj)); 5677 Handle<DependentCode> dep) {
5678 ASSERT(!InNewSpace(dep)); 5678 ASSERT(!InNewSpace(*obj));
5679 MaybeObject* maybe_obj = 5679 ASSERT(!InNewSpace(*dep));
5680 WeakHashTable::cast(weak_object_to_code_table_)->Put(obj, dep); 5680 Handle<WeakHashTable> table(WeakHashTable::cast(weak_object_to_code_table_),
5681 WeakHashTable* table; 5681 isolate());
5682 if (!maybe_obj->To(&table)) return maybe_obj; 5682 table = WeakHashTable::Put(table, obj, dep);
5683 if (ShouldZapGarbage() && weak_object_to_code_table_ != table) { 5683
5684 if (ShouldZapGarbage() && weak_object_to_code_table_ != *table) {
5684 WeakHashTable::cast(weak_object_to_code_table_)->Zap(the_hole_value()); 5685 WeakHashTable::cast(weak_object_to_code_table_)->Zap(the_hole_value());
5685 } 5686 }
5686 set_weak_object_to_code_table(table); 5687 set_weak_object_to_code_table(*table);
5687 ASSERT_EQ(dep, WeakHashTable::cast(weak_object_to_code_table_)->Lookup(obj)); 5688 ASSERT_EQ(*dep, table->Lookup(*obj));
5688 return weak_object_to_code_table_;
5689 } 5689 }
5690 5690
5691 5691
5692 DependentCode* Heap::LookupWeakObjectToCodeDependency(Object* obj) { 5692 DependentCode* Heap::LookupWeakObjectToCodeDependency(Object* obj) {
5693 Object* dep = WeakHashTable::cast(weak_object_to_code_table_)->Lookup(obj); 5693 Object* dep = WeakHashTable::cast(weak_object_to_code_table_)->Lookup(obj);
5694 if (dep->IsDependentCode()) return DependentCode::cast(dep); 5694 if (dep->IsDependentCode()) return DependentCode::cast(dep);
5695 return DependentCode::cast(empty_fixed_array()); 5695 return DependentCode::cast(empty_fixed_array());
5696 } 5696 }
5697 5697
5698 5698
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
6676 static_cast<int>(object_sizes_last_time_[index])); 6676 static_cast<int>(object_sizes_last_time_[index]));
6677 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) 6677 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT)
6678 #undef ADJUST_LAST_TIME_OBJECT_COUNT 6678 #undef ADJUST_LAST_TIME_OBJECT_COUNT
6679 6679
6680 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 6680 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
6681 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 6681 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
6682 ClearObjectStats(); 6682 ClearObjectStats();
6683 } 6683 }
6684 6684
6685 } } // namespace v8::internal 6685 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap.h ('k') | src/lithium-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698