OLD | NEW |
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 6947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6958 // Create initial maps. | 6958 // Create initial maps. |
6959 if (!CreateInitialMaps()) return false; | 6959 if (!CreateInitialMaps()) return false; |
6960 if (!CreateApiObjects()) return false; | 6960 if (!CreateApiObjects()) return false; |
6961 | 6961 |
6962 // Create initial objects | 6962 // Create initial objects |
6963 if (!CreateInitialObjects()) return false; | 6963 if (!CreateInitialObjects()) return false; |
6964 | 6964 |
6965 native_contexts_list_ = undefined_value(); | 6965 native_contexts_list_ = undefined_value(); |
6966 array_buffers_list_ = undefined_value(); | 6966 array_buffers_list_ = undefined_value(); |
6967 allocation_sites_list_ = undefined_value(); | 6967 allocation_sites_list_ = undefined_value(); |
| 6968 weak_object_to_code_ = undefined_value(); |
6968 return true; | 6969 return true; |
6969 } | 6970 } |
6970 | 6971 |
6971 | 6972 |
6972 void Heap::SetStackLimits() { | 6973 void Heap::SetStackLimits() { |
6973 ASSERT(isolate_ != NULL); | 6974 ASSERT(isolate_ != NULL); |
6974 ASSERT(isolate_ == isolate()); | 6975 ASSERT(isolate_ == isolate()); |
6975 // On 64 bit machines, pointers are generally out of range of Smis. We write | 6976 // On 64 bit machines, pointers are generally out of range of Smis. We write |
6976 // something that looks like an out of range Smi to the GC. | 6977 // something that looks like an out of range Smi to the GC. |
6977 | 6978 |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7101 for (int i = 0; i < gc_epilogue_callbacks_.length(); ++i) { | 7102 for (int i = 0; i < gc_epilogue_callbacks_.length(); ++i) { |
7102 if (gc_epilogue_callbacks_[i].callback == callback) { | 7103 if (gc_epilogue_callbacks_[i].callback == callback) { |
7103 gc_epilogue_callbacks_.Remove(i); | 7104 gc_epilogue_callbacks_.Remove(i); |
7104 return; | 7105 return; |
7105 } | 7106 } |
7106 } | 7107 } |
7107 UNREACHABLE(); | 7108 UNREACHABLE(); |
7108 } | 7109 } |
7109 | 7110 |
7110 | 7111 |
| 7112 MaybeObject* Heap::AddWeakObjectToCodeDependency(Object* obj, |
| 7113 DependentCode* dep) { |
| 7114 ASSERT(!InNewSpace(obj)); |
| 7115 ASSERT(!InNewSpace(dep)); |
| 7116 MaybeObject* maybe_obj = |
| 7117 WeakHashTable::cast(weak_object_to_code_)->Put(obj, dep); |
| 7118 WeakHashTable* table; |
| 7119 if (!maybe_obj->To(&table)) return maybe_obj; |
| 7120 set_weak_object_to_code(table); |
| 7121 ASSERT_EQ(dep, WeakHashTable::cast(weak_object_to_code_)->Lookup(obj)); |
| 7122 return weak_object_to_code_; |
| 7123 } |
| 7124 |
| 7125 |
| 7126 DependentCode* Heap::LookupWeakObjectToCodeDependency(Object* obj) { |
| 7127 Object* dep = WeakHashTable::cast(weak_object_to_code_)->Lookup(obj); |
| 7128 if (dep->IsDependentCode()) return DependentCode::cast(dep); |
| 7129 return DependentCode::cast(empty_fixed_array()); |
| 7130 } |
| 7131 |
| 7132 |
7111 #ifdef DEBUG | 7133 #ifdef DEBUG |
7112 | 7134 |
7113 class PrintHandleVisitor: public ObjectVisitor { | 7135 class PrintHandleVisitor: public ObjectVisitor { |
7114 public: | 7136 public: |
7115 void VisitPointers(Object** start, Object** end) { | 7137 void VisitPointers(Object** start, Object** end) { |
7116 for (Object** p = start; p < end; p++) | 7138 for (Object** p = start; p < end; p++) |
7117 PrintF(" handle %p to %p\n", | 7139 PrintF(" handle %p to %p\n", |
7118 reinterpret_cast<void*>(p), | 7140 reinterpret_cast<void*>(p), |
7119 reinterpret_cast<void*>(*p)); | 7141 reinterpret_cast<void*>(*p)); |
7120 } | 7142 } |
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8101 if (FLAG_concurrent_recompilation) { | 8123 if (FLAG_concurrent_recompilation) { |
8102 heap_->relocation_mutex_->Lock(); | 8124 heap_->relocation_mutex_->Lock(); |
8103 #ifdef DEBUG | 8125 #ifdef DEBUG |
8104 heap_->relocation_mutex_locked_by_optimizer_thread_ = | 8126 heap_->relocation_mutex_locked_by_optimizer_thread_ = |
8105 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); | 8127 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); |
8106 #endif // DEBUG | 8128 #endif // DEBUG |
8107 } | 8129 } |
8108 } | 8130 } |
8109 | 8131 |
8110 } } // namespace v8::internal | 8132 } } // namespace v8::internal |
OLD | NEW |