| 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 2707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2718 | 2718 |
| 2719 set_script_list(Smi::FromInt(0)); | 2719 set_script_list(Smi::FromInt(0)); |
| 2720 | 2720 |
| 2721 Handle<SeededNumberDictionary> slow_element_dictionary = | 2721 Handle<SeededNumberDictionary> slow_element_dictionary = |
| 2722 SeededNumberDictionary::New(isolate(), 0, TENURED); | 2722 SeededNumberDictionary::New(isolate(), 0, TENURED); |
| 2723 slow_element_dictionary->set_requires_slow_elements(); | 2723 slow_element_dictionary->set_requires_slow_elements(); |
| 2724 set_empty_slow_element_dictionary(*slow_element_dictionary); | 2724 set_empty_slow_element_dictionary(*slow_element_dictionary); |
| 2725 | 2725 |
| 2726 set_materialized_objects(*factory->NewFixedArray(0, TENURED)); | 2726 set_materialized_objects(*factory->NewFixedArray(0, TENURED)); |
| 2727 | 2727 |
| 2728 // Handling of script id generation is in Factory::NewScript. | 2728 // Handling of script id generation is in Heap::NextScriptId(). |
| 2729 set_last_script_id(Smi::FromInt(v8::UnboundScript::kNoScriptId)); | 2729 set_last_script_id(Smi::FromInt(v8::UnboundScript::kNoScriptId)); |
| 2730 | 2730 |
| 2731 // Allocate the empty script. | 2731 // Allocate the empty script. |
| 2732 Handle<Script> script = factory->NewScript(factory->empty_string()); | 2732 Handle<Script> script = factory->NewScript(factory->empty_string()); |
| 2733 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); | 2733 script->set_type(Script::TYPE_NATIVE); |
| 2734 set_empty_script(*script); | 2734 set_empty_script(*script); |
| 2735 | 2735 |
| 2736 Handle<PropertyCell> cell = factory->NewPropertyCell(); | 2736 Handle<PropertyCell> cell = factory->NewPropertyCell(); |
| 2737 cell->set_value(Smi::FromInt(Isolate::kArrayProtectorValid)); | 2737 cell->set_value(Smi::FromInt(Isolate::kArrayProtectorValid)); |
| 2738 set_array_protector(*cell); | 2738 set_array_protector(*cell); |
| 2739 | 2739 |
| 2740 cell = factory->NewPropertyCell(); | 2740 cell = factory->NewPropertyCell(); |
| 2741 cell->set_value(the_hole_value()); | 2741 cell->set_value(the_hole_value()); |
| 2742 set_empty_property_cell(*cell); | 2742 set_empty_property_cell(*cell); |
| 2743 | 2743 |
| (...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3904 int attempts = 0; | 3904 int attempts = 0; |
| 3905 do { | 3905 do { |
| 3906 hash = isolate()->random_number_generator()->NextInt() & Name::kHashBitMask; | 3906 hash = isolate()->random_number_generator()->NextInt() & Name::kHashBitMask; |
| 3907 attempts++; | 3907 attempts++; |
| 3908 } while (hash == 0 && attempts < 30); | 3908 } while (hash == 0 && attempts < 30); |
| 3909 if (hash == 0) hash = 1; // never return 0 | 3909 if (hash == 0) hash = 1; // never return 0 |
| 3910 | 3910 |
| 3911 Symbol::cast(result) | 3911 Symbol::cast(result) |
| 3912 ->set_hash_field(Name::kIsNotArrayIndexMask | (hash << Name::kHashShift)); | 3912 ->set_hash_field(Name::kIsNotArrayIndexMask | (hash << Name::kHashShift)); |
| 3913 Symbol::cast(result)->set_name(undefined_value()); | 3913 Symbol::cast(result)->set_name(undefined_value()); |
| 3914 Symbol::cast(result)->set_flags(Smi::FromInt(0)); | 3914 Symbol::cast(result)->set_flags(0); |
| 3915 | 3915 |
| 3916 DCHECK(!Symbol::cast(result)->is_private()); | 3916 DCHECK(!Symbol::cast(result)->is_private()); |
| 3917 return result; | 3917 return result; |
| 3918 } | 3918 } |
| 3919 | 3919 |
| 3920 | 3920 |
| 3921 AllocationResult Heap::AllocateStruct(InstanceType type) { | 3921 AllocationResult Heap::AllocateStruct(InstanceType type) { |
| 3922 Map* map; | 3922 Map* map; |
| 3923 switch (type) { | 3923 switch (type) { |
| 3924 #define MAKE_CASE(NAME, Name, name) \ | 3924 #define MAKE_CASE(NAME, Name, name) \ |
| (...skipping 2209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6134 } | 6134 } |
| 6135 | 6135 |
| 6136 | 6136 |
| 6137 // static | 6137 // static |
| 6138 int Heap::GetStaticVisitorIdForMap(Map* map) { | 6138 int Heap::GetStaticVisitorIdForMap(Map* map) { |
| 6139 return StaticVisitorBase::GetVisitorId(map); | 6139 return StaticVisitorBase::GetVisitorId(map); |
| 6140 } | 6140 } |
| 6141 | 6141 |
| 6142 } // namespace internal | 6142 } // namespace internal |
| 6143 } // namespace v8 | 6143 } // namespace v8 |
| OLD | NEW |