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/conversions.h" | 9 #include "src/conversions.h" |
10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
(...skipping 1996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2007 void Factory::BecomeJSObject(Handle<JSProxy> proxy) { | 2007 void Factory::BecomeJSObject(Handle<JSProxy> proxy) { |
2008 ReinitializeJSProxy(proxy, JS_OBJECT_TYPE, JSObject::kHeaderSize); | 2008 ReinitializeJSProxy(proxy, JS_OBJECT_TYPE, JSObject::kHeaderSize); |
2009 } | 2009 } |
2010 | 2010 |
2011 | 2011 |
2012 void Factory::BecomeJSFunction(Handle<JSProxy> proxy) { | 2012 void Factory::BecomeJSFunction(Handle<JSProxy> proxy) { |
2013 ReinitializeJSProxy(proxy, JS_FUNCTION_TYPE, JSFunction::kSize); | 2013 ReinitializeJSProxy(proxy, JS_FUNCTION_TYPE, JSFunction::kSize); |
2014 } | 2014 } |
2015 | 2015 |
2016 | 2016 |
2017 Handle<TypeFeedbackVector> Factory::NewTypeFeedbackVector( | 2017 template Handle<TypeFeedbackVector> Factory::NewTypeFeedbackVector( |
2018 const FeedbackVectorSpec& spec) { | 2018 const ZoneFeedbackVectorSpec* spec); |
2019 return TypeFeedbackVector::Allocate(isolate(), spec); | 2019 template Handle<TypeFeedbackVector> Factory::NewTypeFeedbackVector( |
| 2020 const FeedbackVectorSpec* spec); |
| 2021 |
| 2022 template <typename Spec> |
| 2023 Handle<TypeFeedbackVector> Factory::NewTypeFeedbackVector(const Spec* spec) { |
| 2024 return TypeFeedbackVector::Allocate<Spec>(isolate(), spec); |
2020 } | 2025 } |
2021 | 2026 |
2022 | 2027 |
2023 Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo( | 2028 Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo( |
2024 Handle<String> name, int number_of_literals, FunctionKind kind, | 2029 Handle<String> name, int number_of_literals, FunctionKind kind, |
2025 Handle<Code> code, Handle<ScopeInfo> scope_info, | 2030 Handle<Code> code, Handle<ScopeInfo> scope_info, |
2026 Handle<TypeFeedbackVector> feedback_vector) { | 2031 Handle<TypeFeedbackVector> feedback_vector) { |
2027 DCHECK(IsValidFunctionKind(kind)); | 2032 DCHECK(IsValidFunctionKind(kind)); |
2028 Handle<SharedFunctionInfo> shared = NewSharedFunctionInfo(name, code); | 2033 Handle<SharedFunctionInfo> shared = NewSharedFunctionInfo(name, code); |
2029 shared->set_scope_info(*scope_info); | 2034 shared->set_scope_info(*scope_info); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2077 share->set_optimized_code_map(Smi::FromInt(0)); | 2082 share->set_optimized_code_map(Smi::FromInt(0)); |
2078 share->set_scope_info(ScopeInfo::Empty(isolate())); | 2083 share->set_scope_info(ScopeInfo::Empty(isolate())); |
2079 Code* construct_stub = | 2084 Code* construct_stub = |
2080 isolate()->builtins()->builtin(Builtins::kJSConstructStubGeneric); | 2085 isolate()->builtins()->builtin(Builtins::kJSConstructStubGeneric); |
2081 share->set_construct_stub(construct_stub); | 2086 share->set_construct_stub(construct_stub); |
2082 share->set_instance_class_name(*Object_string()); | 2087 share->set_instance_class_name(*Object_string()); |
2083 share->set_function_data(*undefined_value(), SKIP_WRITE_BARRIER); | 2088 share->set_function_data(*undefined_value(), SKIP_WRITE_BARRIER); |
2084 share->set_script(*undefined_value(), SKIP_WRITE_BARRIER); | 2089 share->set_script(*undefined_value(), SKIP_WRITE_BARRIER); |
2085 share->set_debug_info(*undefined_value(), SKIP_WRITE_BARRIER); | 2090 share->set_debug_info(*undefined_value(), SKIP_WRITE_BARRIER); |
2086 share->set_inferred_name(*empty_string(), SKIP_WRITE_BARRIER); | 2091 share->set_inferred_name(*empty_string(), SKIP_WRITE_BARRIER); |
2087 FeedbackVectorSpec empty_spec; | 2092 FeedbackVectorSpec empty_spec(0); |
2088 Handle<TypeFeedbackVector> feedback_vector = | 2093 Handle<TypeFeedbackVector> feedback_vector = |
2089 NewTypeFeedbackVector(empty_spec); | 2094 NewTypeFeedbackVector(&empty_spec); |
2090 share->set_feedback_vector(*feedback_vector, SKIP_WRITE_BARRIER); | 2095 share->set_feedback_vector(*feedback_vector, SKIP_WRITE_BARRIER); |
2091 #if TRACE_MAPS | 2096 #if TRACE_MAPS |
2092 share->set_unique_id(isolate()->GetNextUniqueSharedFunctionInfoId()); | 2097 share->set_unique_id(isolate()->GetNextUniqueSharedFunctionInfoId()); |
2093 #endif | 2098 #endif |
2094 share->set_profiler_ticks(0); | 2099 share->set_profiler_ticks(0); |
2095 share->set_ast_node_count(0); | 2100 share->set_ast_node_count(0); |
2096 share->set_counters(0); | 2101 share->set_counters(0); |
2097 | 2102 |
2098 // Set integer fields (smi or int, depending on the architecture). | 2103 // Set integer fields (smi or int, depending on the architecture). |
2099 share->set_length(0); | 2104 share->set_length(0); |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2323 return Handle<Object>::null(); | 2328 return Handle<Object>::null(); |
2324 } | 2329 } |
2325 | 2330 |
2326 | 2331 |
2327 Handle<Object> Factory::ToBoolean(bool value) { | 2332 Handle<Object> Factory::ToBoolean(bool value) { |
2328 return value ? true_value() : false_value(); | 2333 return value ? true_value() : false_value(); |
2329 } | 2334 } |
2330 | 2335 |
2331 | 2336 |
2332 } } // namespace v8::internal | 2337 } } // namespace v8::internal |
OLD | NEW |