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 5455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5466 } | 5466 } |
5467 UNREACHABLE(); | 5467 UNREACHABLE(); |
5468 } | 5468 } |
5469 | 5469 |
5470 | 5470 |
5471 // TODO(ishell): Find a better place for this. | 5471 // TODO(ishell): Find a better place for this. |
5472 void Heap::AddWeakObjectToCodeDependency(Handle<Object> obj, | 5472 void Heap::AddWeakObjectToCodeDependency(Handle<Object> obj, |
5473 Handle<DependentCode> dep) { | 5473 Handle<DependentCode> dep) { |
5474 ASSERT(!InNewSpace(*obj)); | 5474 ASSERT(!InNewSpace(*obj)); |
5475 ASSERT(!InNewSpace(*dep)); | 5475 ASSERT(!InNewSpace(*dep)); |
| 5476 // This handle scope keeps the table handle local to this function, which |
| 5477 // allows us to safely skip write barriers in table update operations. |
5476 HandleScope scope(isolate()); | 5478 HandleScope scope(isolate()); |
5477 Handle<WeakHashTable> table(WeakHashTable::cast(weak_object_to_code_table_), | 5479 Handle<WeakHashTable> table(WeakHashTable::cast(weak_object_to_code_table_), |
5478 isolate()); | 5480 isolate()); |
5479 table = WeakHashTable::Put(table, obj, dep); | 5481 table = WeakHashTable::Put(table, obj, dep); |
5480 | 5482 |
5481 if (ShouldZapGarbage() && weak_object_to_code_table_ != *table) { | 5483 if (ShouldZapGarbage() && weak_object_to_code_table_ != *table) { |
5482 WeakHashTable::cast(weak_object_to_code_table_)->Zap(the_hole_value()); | 5484 WeakHashTable::cast(weak_object_to_code_table_)->Zap(the_hole_value()); |
5483 } | 5485 } |
5484 set_weak_object_to_code_table(*table); | 5486 set_weak_object_to_code_table(*table); |
5485 ASSERT_EQ(*dep, table->Lookup(obj)); | 5487 ASSERT_EQ(*dep, table->Lookup(obj)); |
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6478 static_cast<int>(object_sizes_last_time_[index])); | 6480 static_cast<int>(object_sizes_last_time_[index])); |
6479 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6481 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6480 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6482 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6481 | 6483 |
6482 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6484 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6483 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6485 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6484 ClearObjectStats(); | 6486 ClearObjectStats(); |
6485 } | 6487 } |
6486 | 6488 |
6487 } } // namespace v8::internal | 6489 } } // namespace v8::internal |
OLD | NEW |