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 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1215 PretenureFlag pretenure) { | 1215 PretenureFlag pretenure) { |
1216 AllocationSpace space = pretenure == TENURED ? OLD_SPACE : NEW_SPACE; | 1216 AllocationSpace space = pretenure == TENURED ? OLD_SPACE : NEW_SPACE; |
1217 Handle<JSFunction> function = New<JSFunction>(map, space); | 1217 Handle<JSFunction> function = New<JSFunction>(map, space); |
1218 | 1218 |
1219 function->initialize_properties(); | 1219 function->initialize_properties(); |
1220 function->initialize_elements(); | 1220 function->initialize_elements(); |
1221 function->set_shared(*info); | 1221 function->set_shared(*info); |
1222 function->set_code(info->code()); | 1222 function->set_code(info->code()); |
1223 function->set_context(*context); | 1223 function->set_context(*context); |
1224 function->set_prototype_or_initial_map(*the_hole_value()); | 1224 function->set_prototype_or_initial_map(*the_hole_value()); |
1225 function->set_literals(LiteralsArray::cast(*empty_fixed_array())); | 1225 function->set_literals(LiteralsArray::cast(*empty_literals_array())); |
1226 function->set_next_function_link(*undefined_value(), SKIP_WRITE_BARRIER); | 1226 function->set_next_function_link(*undefined_value(), SKIP_WRITE_BARRIER); |
1227 isolate()->heap()->InitializeJSObjectBody(*function, *map, JSFunction::kSize); | 1227 isolate()->heap()->InitializeJSObjectBody(*function, *map, JSFunction::kSize); |
1228 return function; | 1228 return function; |
1229 } | 1229 } |
1230 | 1230 |
1231 | 1231 |
1232 Handle<JSFunction> Factory::NewFunction(Handle<Map> map, | 1232 Handle<JSFunction> Factory::NewFunction(Handle<Map> map, |
1233 Handle<String> name, | 1233 Handle<String> name, |
1234 MaybeHandle<Code> code) { | 1234 MaybeHandle<Code> code) { |
1235 Handle<Context> context(isolate()->native_context()); | 1235 Handle<Context> context(isolate()->native_context()); |
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2133 : isolate()->builtins()->ConstructedNonConstructable(); | 2133 : isolate()->builtins()->ConstructedNonConstructable(); |
2134 share->set_construct_stub(*construct_stub); | 2134 share->set_construct_stub(*construct_stub); |
2135 share->set_instance_class_name(*Object_string()); | 2135 share->set_instance_class_name(*Object_string()); |
2136 share->set_function_data(*undefined_value(), SKIP_WRITE_BARRIER); | 2136 share->set_function_data(*undefined_value(), SKIP_WRITE_BARRIER); |
2137 share->set_script(*undefined_value(), SKIP_WRITE_BARRIER); | 2137 share->set_script(*undefined_value(), SKIP_WRITE_BARRIER); |
2138 share->set_debug_info(DebugInfo::uninitialized(), SKIP_WRITE_BARRIER); | 2138 share->set_debug_info(DebugInfo::uninitialized(), SKIP_WRITE_BARRIER); |
2139 share->set_function_identifier(*undefined_value(), SKIP_WRITE_BARRIER); | 2139 share->set_function_identifier(*undefined_value(), SKIP_WRITE_BARRIER); |
2140 StaticFeedbackVectorSpec empty_spec; | 2140 StaticFeedbackVectorSpec empty_spec; |
2141 Handle<TypeFeedbackMetadata> feedback_metadata = | 2141 Handle<TypeFeedbackMetadata> feedback_metadata = |
2142 TypeFeedbackMetadata::New(isolate(), &empty_spec); | 2142 TypeFeedbackMetadata::New(isolate(), &empty_spec); |
2143 Handle<TypeFeedbackVector> feedback_vector = | 2143 share->set_feedback_metadata(*feedback_metadata, SKIP_WRITE_BARRIER); |
2144 TypeFeedbackVector::New(isolate(), feedback_metadata); | |
2145 share->set_feedback_vector(*feedback_vector, SKIP_WRITE_BARRIER); | |
2146 #if TRACE_MAPS | 2144 #if TRACE_MAPS |
2147 share->set_unique_id(isolate()->GetNextUniqueSharedFunctionInfoId()); | 2145 share->set_unique_id(isolate()->GetNextUniqueSharedFunctionInfoId()); |
2148 #endif | 2146 #endif |
2149 share->set_profiler_ticks(0); | 2147 share->set_profiler_ticks(0); |
2150 share->set_ast_node_count(0); | 2148 share->set_ast_node_count(0); |
2151 share->set_counters(0); | 2149 share->set_counters(0); |
2152 | 2150 |
2153 // Set integer fields (smi or int, depending on the architecture). | 2151 // Set integer fields (smi or int, depending on the architecture). |
2154 share->set_length(0); | 2152 share->set_length(0); |
2155 share->set_internal_formal_parameter_count(0); | 2153 share->set_internal_formal_parameter_count(0); |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2392 } | 2390 } |
2393 | 2391 |
2394 | 2392 |
2395 Handle<Object> Factory::ToBoolean(bool value) { | 2393 Handle<Object> Factory::ToBoolean(bool value) { |
2396 return value ? true_value() : false_value(); | 2394 return value ? true_value() : false_value(); |
2397 } | 2395 } |
2398 | 2396 |
2399 | 2397 |
2400 } // namespace internal | 2398 } // namespace internal |
2401 } // namespace v8 | 2399 } // namespace v8 |
OLD | NEW |