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

Side by Side Diff: src/heap/heap.cc

Issue 1292963006: [heap] Move {hidden_string} into the root list. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « src/heap/heap.h ('k') | src/objects.h » ('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 // 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 "src/heap/heap.h" 5 #include "src/heap/heap.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api.h" 8 #include "src/api.h"
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/once.h" 10 #include "src/base/once.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 gc_count_(0), 89 gc_count_(0),
90 remembered_unmapped_pages_index_(0), 90 remembered_unmapped_pages_index_(0),
91 #ifdef DEBUG 91 #ifdef DEBUG
92 allocation_timeout_(0), 92 allocation_timeout_(0),
93 #endif // DEBUG 93 #endif // DEBUG
94 old_generation_allocation_limit_(initial_old_generation_size_), 94 old_generation_allocation_limit_(initial_old_generation_size_),
95 old_gen_exhausted_(false), 95 old_gen_exhausted_(false),
96 optimize_for_memory_usage_(false), 96 optimize_for_memory_usage_(false),
97 inline_allocation_disabled_(false), 97 inline_allocation_disabled_(false),
98 store_buffer_rebuilder_(store_buffer()), 98 store_buffer_rebuilder_(store_buffer()),
99 hidden_string_(NULL),
100 total_regexp_code_generated_(0), 99 total_regexp_code_generated_(0),
101 tracer_(this), 100 tracer_(this),
102 high_survival_rate_period_length_(0), 101 high_survival_rate_period_length_(0),
103 promoted_objects_size_(0), 102 promoted_objects_size_(0),
104 promotion_ratio_(0), 103 promotion_ratio_(0),
105 semi_space_copied_object_size_(0), 104 semi_space_copied_object_size_(0),
106 previous_semi_space_copied_object_size_(0), 105 previous_semi_space_copied_object_size_(0),
107 semi_space_copied_rate_(0), 106 semi_space_copied_rate_(0),
108 nodes_died_in_new_space_(0), 107 nodes_died_in_new_space_(0),
109 nodes_copied_in_new_space_(0), 108 nodes_copied_in_new_space_(0),
(...skipping 3110 matching lines...) Expand 10 before | Expand all | Expand 10 after
3220 set_exception(*factory->NewOddball(factory->exception_map(), "exception", 3219 set_exception(*factory->NewOddball(factory->exception_map(), "exception",
3221 handle(Smi::FromInt(-5), isolate()), 3220 handle(Smi::FromInt(-5), isolate()),
3222 "undefined", Oddball::kException)); 3221 "undefined", Oddball::kException));
3223 3222
3224 for (unsigned i = 0; i < arraysize(constant_string_table); i++) { 3223 for (unsigned i = 0; i < arraysize(constant_string_table); i++) {
3225 Handle<String> str = 3224 Handle<String> str =
3226 factory->InternalizeUtf8String(constant_string_table[i].contents); 3225 factory->InternalizeUtf8String(constant_string_table[i].contents);
3227 roots_[constant_string_table[i].index] = *str; 3226 roots_[constant_string_table[i].index] = *str;
3228 } 3227 }
3229 3228
3229 // The {hidden_string} is special because it is an empty string, but does not
3230 // match any string (even the {empty_string}) when looked up in properties.
3230 // Allocate the hidden string which is used to identify the hidden properties 3231 // Allocate the hidden string which is used to identify the hidden properties
3231 // in JSObjects. The hash code has a special value so that it will not match 3232 // in JSObjects. The hash code has a special value so that it will not match
3232 // the empty string when searching for the property. It cannot be part of the 3233 // the empty string when searching for the property. It cannot be part of the
3233 // loop above because it needs to be allocated manually with the special 3234 // loop above because it needs to be allocated manually with the special
3234 // hash code in place. The hash code for the hidden_string is zero to ensure 3235 // hash code in place. The hash code for the hidden_string is zero to ensure
3235 // that it will always be at the first entry in property descriptors. 3236 // that it will always be at the first entry in property descriptors.
3236 hidden_string_ = *factory->NewOneByteInternalizedString( 3237 set_hidden_string(*factory->NewOneByteInternalizedString(
3237 OneByteVector("", 0), String::kEmptyStringHash); 3238 OneByteVector("", 0), String::kEmptyStringHash));
3238 3239
3239 // Create the code_stubs dictionary. The initial size is set to avoid 3240 // Create the code_stubs dictionary. The initial size is set to avoid
3240 // expanding the dictionary during bootstrapping. 3241 // expanding the dictionary during bootstrapping.
3241 set_code_stubs(*UnseededNumberDictionary::New(isolate(), 128)); 3242 set_code_stubs(*UnseededNumberDictionary::New(isolate(), 128));
3242 3243
3243 // Create the non_monomorphic_cache used in stub-cache.cc. The initial size 3244 // Create the non_monomorphic_cache used in stub-cache.cc. The initial size
3244 // is set to avoid expanding the dictionary during bootstrapping. 3245 // is set to avoid expanding the dictionary during bootstrapping.
3245 set_non_monomorphic_cache(*UnseededNumberDictionary::New(isolate(), 64)); 3246 set_non_monomorphic_cache(*UnseededNumberDictionary::New(isolate(), 64));
3246 3247
3247 set_polymorphic_code_cache(PolymorphicCodeCache::cast( 3248 set_polymorphic_code_cache(PolymorphicCodeCache::cast(
(...skipping 2000 matching lines...) Expand 10 before | Expand all | Expand 10 after
5248 ExecutionAccess access(isolate()); 5249 ExecutionAccess access(isolate());
5249 v->VisitPointers(&roots_[kSmiRootsStart], &roots_[kRootListLength]); 5250 v->VisitPointers(&roots_[kSmiRootsStart], &roots_[kRootListLength]);
5250 v->Synchronize(VisitorSynchronization::kSmiRootList); 5251 v->Synchronize(VisitorSynchronization::kSmiRootList);
5251 } 5252 }
5252 5253
5253 5254
5254 void Heap::IterateStrongRoots(ObjectVisitor* v, VisitMode mode) { 5255 void Heap::IterateStrongRoots(ObjectVisitor* v, VisitMode mode) {
5255 v->VisitPointers(&roots_[0], &roots_[kStrongRootListLength]); 5256 v->VisitPointers(&roots_[0], &roots_[kStrongRootListLength]);
5256 v->Synchronize(VisitorSynchronization::kStrongRootList); 5257 v->Synchronize(VisitorSynchronization::kStrongRootList);
5257 5258
5258 v->VisitPointer(bit_cast<Object**>(&hidden_string_));
5259 v->Synchronize(VisitorSynchronization::kInternalizedString);
5260
5261 isolate_->bootstrapper()->Iterate(v); 5259 isolate_->bootstrapper()->Iterate(v);
5262 v->Synchronize(VisitorSynchronization::kBootstrapper); 5260 v->Synchronize(VisitorSynchronization::kBootstrapper);
5263 isolate_->Iterate(v); 5261 isolate_->Iterate(v);
5264 v->Synchronize(VisitorSynchronization::kTop); 5262 v->Synchronize(VisitorSynchronization::kTop);
5265 Relocatable::Iterate(isolate_, v); 5263 Relocatable::Iterate(isolate_, v);
5266 v->Synchronize(VisitorSynchronization::kRelocatable); 5264 v->Synchronize(VisitorSynchronization::kRelocatable);
5267 5265
5268 if (isolate_->deoptimizer_data() != NULL) { 5266 if (isolate_->deoptimizer_data() != NULL) {
5269 isolate_->deoptimizer_data()->Iterate(v); 5267 isolate_->deoptimizer_data()->Iterate(v);
5270 } 5268 }
(...skipping 1634 matching lines...) Expand 10 before | Expand all | Expand 10 after
6905 *object_type = "CODE_TYPE"; \ 6903 *object_type = "CODE_TYPE"; \
6906 *object_sub_type = "CODE_AGE/" #name; \ 6904 *object_sub_type = "CODE_AGE/" #name; \
6907 return true; 6905 return true;
6908 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME) 6906 CODE_AGE_LIST_COMPLETE(COMPARE_AND_RETURN_NAME)
6909 #undef COMPARE_AND_RETURN_NAME 6907 #undef COMPARE_AND_RETURN_NAME
6910 } 6908 }
6911 return false; 6909 return false;
6912 } 6910 }
6913 } // namespace internal 6911 } // namespace internal
6914 } // namespace v8 6912 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/heap.h ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698