OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 "factory.h" | 5 #include "factory.h" |
6 | 6 |
7 #include "isolate-inl.h" | 7 #include "isolate-inl.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 | 823 |
824 Handle<PropertyCell> Factory::NewPropertyCell(Handle<Object> value) { | 824 Handle<PropertyCell> Factory::NewPropertyCell(Handle<Object> value) { |
825 AllowDeferredHandleDereference convert_to_cell; | 825 AllowDeferredHandleDereference convert_to_cell; |
826 Handle<PropertyCell> cell = NewPropertyCellWithHole(); | 826 Handle<PropertyCell> cell = NewPropertyCellWithHole(); |
827 PropertyCell::SetValueInferType(cell, value); | 827 PropertyCell::SetValueInferType(cell, value); |
828 return cell; | 828 return cell; |
829 } | 829 } |
830 | 830 |
831 | 831 |
832 Handle<AllocationSite> Factory::NewAllocationSite() { | 832 Handle<AllocationSite> Factory::NewAllocationSite() { |
833 CALL_HEAP_FUNCTION( | 833 Handle<Map> map = allocation_site_map(); |
834 isolate(), | 834 Handle<AllocationSite> site = New<AllocationSite>(map, OLD_POINTER_SPACE); |
835 isolate()->heap()->AllocateAllocationSite(), | 835 site->Initialize(); |
836 AllocationSite); | 836 |
| 837 // Link the site |
| 838 site->set_weak_next(isolate()->heap()->allocation_sites_list()); |
| 839 isolate()->heap()->set_allocation_sites_list(*site); |
| 840 return site; |
837 } | 841 } |
838 | 842 |
839 | 843 |
840 Handle<Map> Factory::NewMap(InstanceType type, | 844 Handle<Map> Factory::NewMap(InstanceType type, |
841 int instance_size, | 845 int instance_size, |
842 ElementsKind elements_kind) { | 846 ElementsKind elements_kind) { |
843 CALL_HEAP_FUNCTION( | 847 CALL_HEAP_FUNCTION( |
844 isolate(), | 848 isolate(), |
845 isolate()->heap()->AllocateMap(type, instance_size, elements_kind), | 849 isolate()->heap()->AllocateMap(type, instance_size, elements_kind), |
846 Map); | 850 Map); |
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2097 if (String::Equals(name, infinity_string())) return infinity_value(); | 2101 if (String::Equals(name, infinity_string())) return infinity_value(); |
2098 return Handle<Object>::null(); | 2102 return Handle<Object>::null(); |
2099 } | 2103 } |
2100 | 2104 |
2101 | 2105 |
2102 Handle<Object> Factory::ToBoolean(bool value) { | 2106 Handle<Object> Factory::ToBoolean(bool value) { |
2103 return value ? true_value() : false_value(); | 2107 return value ? true_value() : false_value(); |
2104 } | 2108 } |
2105 | 2109 |
2106 } } // namespace v8::internal | 2110 } } // namespace v8::internal |
OLD | NEW |