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 "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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 memory_reducer_(nullptr), | 130 memory_reducer_(nullptr), |
131 object_stats_(nullptr), | 131 object_stats_(nullptr), |
132 scavenge_job_(nullptr), | 132 scavenge_job_(nullptr), |
133 full_codegen_bytes_generated_(0), | 133 full_codegen_bytes_generated_(0), |
134 crankshaft_codegen_bytes_generated_(0), | 134 crankshaft_codegen_bytes_generated_(0), |
135 new_space_allocation_counter_(0), | 135 new_space_allocation_counter_(0), |
136 old_generation_allocation_counter_(0), | 136 old_generation_allocation_counter_(0), |
137 old_generation_size_at_last_gc_(0), | 137 old_generation_size_at_last_gc_(0), |
138 gcs_since_last_deopt_(0), | 138 gcs_since_last_deopt_(0), |
139 allocation_sites_scratchpad_length_(0), | 139 allocation_sites_scratchpad_length_(0), |
| 140 last_script_id_(v8::UnboundScript::kNoScriptId), |
140 ring_buffer_full_(false), | 141 ring_buffer_full_(false), |
141 ring_buffer_end_(0), | 142 ring_buffer_end_(0), |
142 promotion_queue_(this), | 143 promotion_queue_(this), |
143 configured_(false), | 144 configured_(false), |
144 current_gc_flags_(Heap::kNoGCFlags), | 145 current_gc_flags_(Heap::kNoGCFlags), |
145 current_gc_callback_flags_(GCCallbackFlags::kNoGCCallbackFlags), | 146 current_gc_callback_flags_(GCCallbackFlags::kNoGCCallbackFlags), |
146 external_string_table_(this), | 147 external_string_table_(this), |
147 chunks_queued_for_free_(NULL), | 148 chunks_queued_for_free_(NULL), |
148 concurrent_unmapping_tasks_active_(0), | 149 concurrent_unmapping_tasks_active_(0), |
149 pending_unmapping_tasks_semaphore_(0), | 150 pending_unmapping_tasks_semaphore_(0), |
(...skipping 2567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2717 | 2718 |
2718 set_script_list(Smi::FromInt(0)); | 2719 set_script_list(Smi::FromInt(0)); |
2719 | 2720 |
2720 Handle<SeededNumberDictionary> slow_element_dictionary = | 2721 Handle<SeededNumberDictionary> slow_element_dictionary = |
2721 SeededNumberDictionary::New(isolate(), 0, TENURED); | 2722 SeededNumberDictionary::New(isolate(), 0, TENURED); |
2722 slow_element_dictionary->set_requires_slow_elements(); | 2723 slow_element_dictionary->set_requires_slow_elements(); |
2723 set_empty_slow_element_dictionary(*slow_element_dictionary); | 2724 set_empty_slow_element_dictionary(*slow_element_dictionary); |
2724 | 2725 |
2725 set_materialized_objects(*factory->NewFixedArray(0, TENURED)); | 2726 set_materialized_objects(*factory->NewFixedArray(0, TENURED)); |
2726 | 2727 |
2727 // Handling of script id generation is in Factory::NewScript. | |
2728 set_last_script_id(Smi::FromInt(v8::UnboundScript::kNoScriptId)); | |
2729 | |
2730 // Allocate the empty script. | 2728 // Allocate the empty script. |
2731 Handle<Script> script = factory->NewScript(factory->empty_string()); | 2729 Handle<Script> script = factory->NewScript(factory->empty_string()); |
2732 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); | 2730 script->set_type(Script::TYPE_NATIVE); |
2733 set_empty_script(*script); | 2731 set_empty_script(*script); |
2734 | 2732 |
2735 Handle<PropertyCell> cell = factory->NewPropertyCell(); | 2733 Handle<PropertyCell> cell = factory->NewPropertyCell(); |
2736 cell->set_value(Smi::FromInt(Isolate::kArrayProtectorValid)); | 2734 cell->set_value(Smi::FromInt(Isolate::kArrayProtectorValid)); |
2737 set_array_protector(*cell); | 2735 set_array_protector(*cell); |
2738 | 2736 |
2739 cell = factory->NewPropertyCell(); | 2737 cell = factory->NewPropertyCell(); |
2740 cell->set_value(the_hole_value()); | 2738 cell->set_value(the_hole_value()); |
2741 set_empty_property_cell(*cell); | 2739 set_empty_property_cell(*cell); |
2742 | 2740 |
(...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3903 int attempts = 0; | 3901 int attempts = 0; |
3904 do { | 3902 do { |
3905 hash = isolate()->random_number_generator()->NextInt() & Name::kHashBitMask; | 3903 hash = isolate()->random_number_generator()->NextInt() & Name::kHashBitMask; |
3906 attempts++; | 3904 attempts++; |
3907 } while (hash == 0 && attempts < 30); | 3905 } while (hash == 0 && attempts < 30); |
3908 if (hash == 0) hash = 1; // never return 0 | 3906 if (hash == 0) hash = 1; // never return 0 |
3909 | 3907 |
3910 Symbol::cast(result) | 3908 Symbol::cast(result) |
3911 ->set_hash_field(Name::kIsNotArrayIndexMask | (hash << Name::kHashShift)); | 3909 ->set_hash_field(Name::kIsNotArrayIndexMask | (hash << Name::kHashShift)); |
3912 Symbol::cast(result)->set_name(undefined_value()); | 3910 Symbol::cast(result)->set_name(undefined_value()); |
3913 Symbol::cast(result)->set_flags(Smi::FromInt(0)); | 3911 Symbol::cast(result)->set_flags(0); |
3914 | 3912 |
3915 DCHECK(!Symbol::cast(result)->is_private()); | 3913 DCHECK(!Symbol::cast(result)->is_private()); |
3916 return result; | 3914 return result; |
3917 } | 3915 } |
3918 | 3916 |
3919 | 3917 |
3920 AllocationResult Heap::AllocateStruct(InstanceType type) { | 3918 AllocationResult Heap::AllocateStruct(InstanceType type) { |
3921 Map* map; | 3919 Map* map; |
3922 switch (type) { | 3920 switch (type) { |
3923 #define MAKE_CASE(NAME, Name, name) \ | 3921 #define MAKE_CASE(NAME, Name, name) \ |
(...skipping 2203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6127 } | 6125 } |
6128 | 6126 |
6129 | 6127 |
6130 // static | 6128 // static |
6131 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6129 int Heap::GetStaticVisitorIdForMap(Map* map) { |
6132 return StaticVisitorBase::GetVisitorId(map); | 6130 return StaticVisitorBase::GetVisitorId(map); |
6133 } | 6131 } |
6134 | 6132 |
6135 } // namespace internal | 6133 } // namespace internal |
6136 } // namespace v8 | 6134 } // namespace v8 |
OLD | NEW |