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 "conversions.h" | 7 #include "conversions.h" |
8 #include "isolate-inl.h" | 8 #include "isolate-inl.h" |
9 #include "macro-assembler.h" | 9 #include "macro-assembler.h" |
10 | 10 |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 Handle<OrderedHashSet> Factory::NewOrderedHashSet() { | 134 Handle<OrderedHashSet> Factory::NewOrderedHashSet() { |
135 return OrderedHashSet::Allocate(isolate(), 4); | 135 return OrderedHashSet::Allocate(isolate(), 4); |
136 } | 136 } |
137 | 137 |
138 | 138 |
139 Handle<OrderedHashMap> Factory::NewOrderedHashMap() { | 139 Handle<OrderedHashMap> Factory::NewOrderedHashMap() { |
140 return OrderedHashMap::Allocate(isolate(), 4); | 140 return OrderedHashMap::Allocate(isolate(), 4); |
141 } | 141 } |
142 | 142 |
143 | 143 |
144 Handle<DeoptimizationInputData> Factory::NewDeoptimizationInputData( | |
145 int deopt_entry_count, | |
146 PretenureFlag pretenure) { | |
147 ASSERT(deopt_entry_count > 0); | |
148 CALL_HEAP_FUNCTION(isolate(), | |
149 DeoptimizationInputData::Allocate(isolate(), | |
150 deopt_entry_count, | |
151 pretenure), | |
152 DeoptimizationInputData); | |
153 } | |
154 | |
155 | |
156 Handle<DeoptimizationOutputData> Factory::NewDeoptimizationOutputData( | |
157 int deopt_entry_count, | |
158 PretenureFlag pretenure) { | |
159 ASSERT(deopt_entry_count > 0); | |
160 CALL_HEAP_FUNCTION(isolate(), | |
161 DeoptimizationOutputData::Allocate(isolate(), | |
162 deopt_entry_count, | |
163 pretenure), | |
164 DeoptimizationOutputData); | |
165 } | |
166 | |
167 | |
168 Handle<AccessorPair> Factory::NewAccessorPair() { | 144 Handle<AccessorPair> Factory::NewAccessorPair() { |
169 Handle<AccessorPair> accessors = | 145 Handle<AccessorPair> accessors = |
170 Handle<AccessorPair>::cast(NewStruct(ACCESSOR_PAIR_TYPE)); | 146 Handle<AccessorPair>::cast(NewStruct(ACCESSOR_PAIR_TYPE)); |
171 accessors->set_getter(*the_hole_value(), SKIP_WRITE_BARRIER); | 147 accessors->set_getter(*the_hole_value(), SKIP_WRITE_BARRIER); |
172 accessors->set_setter(*the_hole_value(), SKIP_WRITE_BARRIER); | 148 accessors->set_setter(*the_hole_value(), SKIP_WRITE_BARRIER); |
173 accessors->set_access_flags(Smi::FromInt(0), SKIP_WRITE_BARRIER); | 149 accessors->set_access_flags(Smi::FromInt(0), SKIP_WRITE_BARRIER); |
174 return accessors; | 150 return accessors; |
175 } | 151 } |
176 | 152 |
177 | 153 |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 JSObject::SetLocalPropertyIgnoreAttributes(prototype, | 946 JSObject::SetLocalPropertyIgnoreAttributes(prototype, |
971 constructor_string(), | 947 constructor_string(), |
972 function, | 948 function, |
973 DONT_ENUM).Assert(); | 949 DONT_ENUM).Assert(); |
974 } | 950 } |
975 | 951 |
976 return prototype; | 952 return prototype; |
977 } | 953 } |
978 | 954 |
979 | 955 |
| 956 Handle<FixedArray> Factory::CopyFixedArrayWithMap(Handle<FixedArray> array, |
| 957 Handle<Map> map) { |
| 958 CALL_HEAP_FUNCTION(isolate(), |
| 959 isolate()->heap()->CopyFixedArrayWithMap(*array, *map), |
| 960 FixedArray); |
| 961 } |
| 962 |
| 963 |
980 Handle<FixedArray> Factory::CopyFixedArray(Handle<FixedArray> array) { | 964 Handle<FixedArray> Factory::CopyFixedArray(Handle<FixedArray> array) { |
981 CALL_HEAP_FUNCTION(isolate(), array->Copy(), FixedArray); | 965 CALL_HEAP_FUNCTION(isolate(), |
| 966 isolate()->heap()->CopyFixedArray(*array), |
| 967 FixedArray); |
982 } | 968 } |
983 | 969 |
984 | 970 |
985 Handle<FixedArray> Factory::CopyAndTenureFixedCOWArray( | 971 Handle<FixedArray> Factory::CopyAndTenureFixedCOWArray( |
986 Handle<FixedArray> array) { | 972 Handle<FixedArray> array) { |
987 ASSERT(isolate()->heap()->InNewSpace(*array)); | 973 ASSERT(isolate()->heap()->InNewSpace(*array)); |
988 CALL_HEAP_FUNCTION(isolate(), | 974 CALL_HEAP_FUNCTION(isolate(), |
989 isolate()->heap()->CopyAndTenureFixedCOWArray(*array), | 975 isolate()->heap()->CopyAndTenureFixedCOWArray(*array), |
990 FixedArray); | 976 FixedArray); |
991 } | 977 } |
992 | 978 |
993 | 979 |
994 Handle<FixedArray> Factory::CopySizeFixedArray(Handle<FixedArray> array, | |
995 int new_length, | |
996 PretenureFlag pretenure) { | |
997 CALL_HEAP_FUNCTION(isolate(), | |
998 array->CopySize(new_length, pretenure), | |
999 FixedArray); | |
1000 } | |
1001 | |
1002 | |
1003 Handle<FixedDoubleArray> Factory::CopyFixedDoubleArray( | 980 Handle<FixedDoubleArray> Factory::CopyFixedDoubleArray( |
1004 Handle<FixedDoubleArray> array) { | 981 Handle<FixedDoubleArray> array) { |
1005 CALL_HEAP_FUNCTION(isolate(), array->Copy(), FixedDoubleArray); | 982 CALL_HEAP_FUNCTION(isolate(), |
| 983 isolate()->heap()->CopyFixedDoubleArray(*array), |
| 984 FixedDoubleArray); |
1006 } | 985 } |
1007 | 986 |
1008 | 987 |
1009 Handle<ConstantPoolArray> Factory::CopyConstantPoolArray( | 988 Handle<ConstantPoolArray> Factory::CopyConstantPoolArray( |
1010 Handle<ConstantPoolArray> array) { | 989 Handle<ConstantPoolArray> array) { |
1011 CALL_HEAP_FUNCTION(isolate(), array->Copy(), ConstantPoolArray); | 990 CALL_HEAP_FUNCTION(isolate(), |
| 991 isolate()->heap()->CopyConstantPoolArray(*array), |
| 992 ConstantPoolArray); |
1012 } | 993 } |
1013 | 994 |
1014 | 995 |
1015 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( | 996 Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo( |
1016 Handle<SharedFunctionInfo> info, | 997 Handle<SharedFunctionInfo> info, |
1017 Handle<Context> context, | 998 Handle<Context> context, |
1018 PretenureFlag pretenure) { | 999 PretenureFlag pretenure) { |
1019 Handle<JSFunction> result = NewFunction( | 1000 Handle<JSFunction> result = NewFunction( |
1020 info, context, the_hole_value(), pretenure); | 1001 info, context, the_hole_value(), pretenure); |
1021 | 1002 |
(...skipping 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2328 return Handle<Object>::null(); | 2309 return Handle<Object>::null(); |
2329 } | 2310 } |
2330 | 2311 |
2331 | 2312 |
2332 Handle<Object> Factory::ToBoolean(bool value) { | 2313 Handle<Object> Factory::ToBoolean(bool value) { |
2333 return value ? true_value() : false_value(); | 2314 return value ? true_value() : false_value(); |
2334 } | 2315 } |
2335 | 2316 |
2336 | 2317 |
2337 } } // namespace v8::internal | 2318 } } // namespace v8::internal |
OLD | NEW |