OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "v8.h" | 5 #include "v8.h" |
6 | 6 |
7 #include "accessors.h" | 7 #include "accessors.h" |
8 #include "api.h" | 8 #include "api.h" |
9 #include "bootstrapper.h" | 9 #include "bootstrapper.h" |
10 #include "codegen.h" | 10 #include "codegen.h" |
(...skipping 5496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5507 ASSERT(!InNewSpace(*dep)); | 5507 ASSERT(!InNewSpace(*dep)); |
5508 HandleScope scope(isolate()); | 5508 HandleScope scope(isolate()); |
5509 Handle<WeakHashTable> table(WeakHashTable::cast(weak_object_to_code_table_), | 5509 Handle<WeakHashTable> table(WeakHashTable::cast(weak_object_to_code_table_), |
5510 isolate()); | 5510 isolate()); |
5511 table = WeakHashTable::Put(table, obj, dep); | 5511 table = WeakHashTable::Put(table, obj, dep); |
5512 | 5512 |
5513 if (ShouldZapGarbage() && weak_object_to_code_table_ != *table) { | 5513 if (ShouldZapGarbage() && weak_object_to_code_table_ != *table) { |
5514 WeakHashTable::cast(weak_object_to_code_table_)->Zap(the_hole_value()); | 5514 WeakHashTable::cast(weak_object_to_code_table_)->Zap(the_hole_value()); |
5515 } | 5515 } |
5516 set_weak_object_to_code_table(*table); | 5516 set_weak_object_to_code_table(*table); |
5517 ASSERT_EQ(*dep, table->Lookup(*obj)); | 5517 ASSERT_EQ(*dep, table->Lookup(obj)); |
5518 } | 5518 } |
5519 | 5519 |
5520 | 5520 |
5521 DependentCode* Heap::LookupWeakObjectToCodeDependency(Object* obj) { | 5521 DependentCode* Heap::LookupWeakObjectToCodeDependency(Handle<Object> obj) { |
5522 Object* dep = WeakHashTable::cast(weak_object_to_code_table_)->Lookup(obj); | 5522 Object* dep = WeakHashTable::cast(weak_object_to_code_table_)->Lookup(obj); |
5523 if (dep->IsDependentCode()) return DependentCode::cast(dep); | 5523 if (dep->IsDependentCode()) return DependentCode::cast(dep); |
5524 return DependentCode::cast(empty_fixed_array()); | 5524 return DependentCode::cast(empty_fixed_array()); |
5525 } | 5525 } |
5526 | 5526 |
5527 | 5527 |
5528 void Heap::EnsureWeakObjectToCodeTable() { | 5528 void Heap::EnsureWeakObjectToCodeTable() { |
5529 if (!weak_object_to_code_table()->IsHashTable()) { | 5529 if (!weak_object_to_code_table()->IsHashTable()) { |
5530 set_weak_object_to_code_table(*WeakHashTable::New( | 5530 set_weak_object_to_code_table(*WeakHashTable::New( |
5531 isolate(), 16, USE_DEFAULT_MINIMUM_CAPACITY, TENURED)); | 5531 isolate(), 16, USE_DEFAULT_MINIMUM_CAPACITY, TENURED)); |
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6506 static_cast<int>(object_sizes_last_time_[index])); | 6506 static_cast<int>(object_sizes_last_time_[index])); |
6507 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6507 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6508 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6508 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6509 | 6509 |
6510 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6510 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6511 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6511 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6512 ClearObjectStats(); | 6512 ClearObjectStats(); |
6513 } | 6513 } |
6514 | 6514 |
6515 } } // namespace v8::internal | 6515 } } // namespace v8::internal |
OLD | NEW |