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 "src/factory.h" | 5 #include "src/factory.h" |
6 | 6 |
7 #include "src/allocation-site-scopes.h" | 7 #include "src/allocation-site-scopes.h" |
8 #include "src/base/bits.h" | 8 #include "src/base/bits.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/conversions.h" | 10 #include "src/conversions.h" |
(...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1199 PretenureFlag pretenure) { | 1199 PretenureFlag pretenure) { |
1200 AllocationSpace space = pretenure == TENURED ? OLD_SPACE : NEW_SPACE; | 1200 AllocationSpace space = pretenure == TENURED ? OLD_SPACE : NEW_SPACE; |
1201 Handle<JSFunction> function = New<JSFunction>(map, space); | 1201 Handle<JSFunction> function = New<JSFunction>(map, space); |
1202 | 1202 |
1203 function->initialize_properties(); | 1203 function->initialize_properties(); |
1204 function->initialize_elements(); | 1204 function->initialize_elements(); |
1205 function->set_shared(*info); | 1205 function->set_shared(*info); |
1206 function->set_code(info->code()); | 1206 function->set_code(info->code()); |
1207 function->set_context(*context); | 1207 function->set_context(*context); |
1208 function->set_prototype_or_initial_map(*the_hole_value()); | 1208 function->set_prototype_or_initial_map(*the_hole_value()); |
1209 function->set_literals(LiteralsArray::cast(*empty_fixed_array())); | 1209 function->set_literals(LiteralsArray::cast(*empty_literals_array())); |
1210 function->set_next_function_link(*undefined_value(), SKIP_WRITE_BARRIER); | 1210 function->set_next_function_link(*undefined_value(), SKIP_WRITE_BARRIER); |
1211 isolate()->heap()->InitializeJSObjectBody(*function, *map, JSFunction::kSize); | 1211 isolate()->heap()->InitializeJSObjectBody(*function, *map, JSFunction::kSize); |
1212 return function; | 1212 return function; |
1213 } | 1213 } |
1214 | 1214 |
1215 | 1215 |
1216 Handle<JSFunction> Factory::NewFunction(Handle<Map> map, | 1216 Handle<JSFunction> Factory::NewFunction(Handle<Map> map, |
1217 Handle<String> name, | 1217 Handle<String> name, |
1218 MaybeHandle<Code> code) { | 1218 MaybeHandle<Code> code) { |
1219 Handle<Context> context(isolate()->native_context()); | 1219 Handle<Context> context(isolate()->native_context()); |
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2112 : isolate()->builtins()->ConstructedNonConstructable(); | 2112 : isolate()->builtins()->ConstructedNonConstructable(); |
2113 share->set_construct_stub(*construct_stub); | 2113 share->set_construct_stub(*construct_stub); |
2114 share->set_instance_class_name(*Object_string()); | 2114 share->set_instance_class_name(*Object_string()); |
2115 share->set_function_data(*undefined_value(), SKIP_WRITE_BARRIER); | 2115 share->set_function_data(*undefined_value(), SKIP_WRITE_BARRIER); |
2116 share->set_script(*undefined_value(), SKIP_WRITE_BARRIER); | 2116 share->set_script(*undefined_value(), SKIP_WRITE_BARRIER); |
2117 share->set_debug_info(DebugInfo::uninitialized(), SKIP_WRITE_BARRIER); | 2117 share->set_debug_info(DebugInfo::uninitialized(), SKIP_WRITE_BARRIER); |
2118 share->set_function_identifier(*undefined_value(), SKIP_WRITE_BARRIER); | 2118 share->set_function_identifier(*undefined_value(), SKIP_WRITE_BARRIER); |
2119 StaticFeedbackVectorSpec empty_spec; | 2119 StaticFeedbackVectorSpec empty_spec; |
2120 Handle<TypeFeedbackMetadata> feedback_metadata = | 2120 Handle<TypeFeedbackMetadata> feedback_metadata = |
2121 TypeFeedbackMetadata::New(isolate(), &empty_spec); | 2121 TypeFeedbackMetadata::New(isolate(), &empty_spec); |
2122 Handle<TypeFeedbackVector> feedback_vector = | 2122 share->set_feedback_metadata(*feedback_metadata, SKIP_WRITE_BARRIER); |
2123 TypeFeedbackVector::New(isolate(), feedback_metadata); | |
2124 share->set_feedback_vector(*feedback_vector, SKIP_WRITE_BARRIER); | |
2125 #if TRACE_MAPS | 2123 #if TRACE_MAPS |
2126 share->set_unique_id(isolate()->GetNextUniqueSharedFunctionInfoId()); | 2124 share->set_unique_id(isolate()->GetNextUniqueSharedFunctionInfoId()); |
2127 #endif | 2125 #endif |
2128 share->set_profiler_ticks(0); | 2126 share->set_profiler_ticks(0); |
2129 share->set_ast_node_count(0); | 2127 share->set_ast_node_count(0); |
2130 share->set_counters(0); | 2128 share->set_counters(0); |
2131 | 2129 |
2132 // Set integer fields (smi or int, depending on the architecture). | 2130 // Set integer fields (smi or int, depending on the architecture). |
2133 share->set_length(0); | 2131 share->set_length(0); |
2134 share->set_internal_formal_parameter_count(0); | 2132 share->set_internal_formal_parameter_count(0); |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2371 } | 2369 } |
2372 | 2370 |
2373 | 2371 |
2374 Handle<Object> Factory::ToBoolean(bool value) { | 2372 Handle<Object> Factory::ToBoolean(bool value) { |
2375 return value ? true_value() : false_value(); | 2373 return value ? true_value() : false_value(); |
2376 } | 2374 } |
2377 | 2375 |
2378 | 2376 |
2379 } // namespace internal | 2377 } // namespace internal |
2380 } // namespace v8 | 2378 } // namespace v8 |
OLD | NEW |