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 5442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5453 } | 5453 } |
5454 UNREACHABLE(); | 5454 UNREACHABLE(); |
5455 } | 5455 } |
5456 | 5456 |
5457 | 5457 |
5458 // TODO(ishell): Find a better place for this. | 5458 // TODO(ishell): Find a better place for this. |
5459 void Heap::AddWeakObjectToCodeDependency(Handle<Object> obj, | 5459 void Heap::AddWeakObjectToCodeDependency(Handle<Object> obj, |
5460 Handle<DependentCode> dep) { | 5460 Handle<DependentCode> dep) { |
5461 ASSERT(!InNewSpace(*obj)); | 5461 ASSERT(!InNewSpace(*obj)); |
5462 ASSERT(!InNewSpace(*dep)); | 5462 ASSERT(!InNewSpace(*dep)); |
| 5463 // This handle scope keeps the table handle local to this function, which |
| 5464 // allows us to safely skip write barriers in table update operations. |
5463 HandleScope scope(isolate()); | 5465 HandleScope scope(isolate()); |
5464 Handle<WeakHashTable> table(WeakHashTable::cast(weak_object_to_code_table_), | 5466 Handle<WeakHashTable> table(WeakHashTable::cast(weak_object_to_code_table_), |
5465 isolate()); | 5467 isolate()); |
5466 table = WeakHashTable::Put(table, obj, dep); | 5468 table = WeakHashTable::Put(table, obj, dep); |
5467 | 5469 |
5468 if (ShouldZapGarbage() && weak_object_to_code_table_ != *table) { | 5470 if (ShouldZapGarbage() && weak_object_to_code_table_ != *table) { |
5469 WeakHashTable::cast(weak_object_to_code_table_)->Zap(the_hole_value()); | 5471 WeakHashTable::cast(weak_object_to_code_table_)->Zap(the_hole_value()); |
5470 } | 5472 } |
5471 set_weak_object_to_code_table(*table); | 5473 set_weak_object_to_code_table(*table); |
5472 ASSERT_EQ(*dep, table->Lookup(obj)); | 5474 ASSERT_EQ(*dep, table->Lookup(obj)); |
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6465 static_cast<int>(object_sizes_last_time_[index])); | 6467 static_cast<int>(object_sizes_last_time_[index])); |
6466 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 6468 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
6467 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 6469 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
6468 | 6470 |
6469 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 6471 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
6470 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 6472 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
6471 ClearObjectStats(); | 6473 ClearObjectStats(); |
6472 } | 6474 } |
6473 | 6475 |
6474 } } // namespace v8::internal | 6476 } } // namespace v8::internal |
OLD | NEW |