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(int slot_count, | 2017 Handle<TypeFeedbackVector> Factory::NewTypeFeedbackVector( |
2018 int ic_slot_count) { | 2018 const FeedbackVectorSpec& spec) { |
2019 return TypeFeedbackVector::Allocate(isolate(), slot_count, ic_slot_count); | 2019 return TypeFeedbackVector::Allocate(isolate(), spec); |
2020 } | 2020 } |
2021 | 2021 |
2022 | 2022 |
2023 Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo( | 2023 Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo( |
2024 Handle<String> name, int number_of_literals, FunctionKind kind, | 2024 Handle<String> name, int number_of_literals, FunctionKind kind, |
2025 Handle<Code> code, Handle<ScopeInfo> scope_info, | 2025 Handle<Code> code, Handle<ScopeInfo> scope_info, |
2026 Handle<TypeFeedbackVector> feedback_vector) { | 2026 Handle<TypeFeedbackVector> feedback_vector) { |
2027 DCHECK(IsValidFunctionKind(kind)); | 2027 DCHECK(IsValidFunctionKind(kind)); |
2028 Handle<SharedFunctionInfo> shared = NewSharedFunctionInfo(name, code); | 2028 Handle<SharedFunctionInfo> shared = NewSharedFunctionInfo(name, code); |
2029 shared->set_scope_info(*scope_info); | 2029 shared->set_scope_info(*scope_info); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2084 share->set_optimized_code_map(Smi::FromInt(0)); | 2084 share->set_optimized_code_map(Smi::FromInt(0)); |
2085 share->set_scope_info(ScopeInfo::Empty(isolate())); | 2085 share->set_scope_info(ScopeInfo::Empty(isolate())); |
2086 Code* construct_stub = | 2086 Code* construct_stub = |
2087 isolate()->builtins()->builtin(Builtins::kJSConstructStubGeneric); | 2087 isolate()->builtins()->builtin(Builtins::kJSConstructStubGeneric); |
2088 share->set_construct_stub(construct_stub); | 2088 share->set_construct_stub(construct_stub); |
2089 share->set_instance_class_name(*Object_string()); | 2089 share->set_instance_class_name(*Object_string()); |
2090 share->set_function_data(*undefined_value(), SKIP_WRITE_BARRIER); | 2090 share->set_function_data(*undefined_value(), SKIP_WRITE_BARRIER); |
2091 share->set_script(*undefined_value(), SKIP_WRITE_BARRIER); | 2091 share->set_script(*undefined_value(), SKIP_WRITE_BARRIER); |
2092 share->set_debug_info(*undefined_value(), SKIP_WRITE_BARRIER); | 2092 share->set_debug_info(*undefined_value(), SKIP_WRITE_BARRIER); |
2093 share->set_inferred_name(*empty_string(), SKIP_WRITE_BARRIER); | 2093 share->set_inferred_name(*empty_string(), SKIP_WRITE_BARRIER); |
2094 Handle<TypeFeedbackVector> feedback_vector = NewTypeFeedbackVector(0, 0); | 2094 FeedbackVectorSpec empty_spec; |
| 2095 Handle<TypeFeedbackVector> feedback_vector = |
| 2096 NewTypeFeedbackVector(empty_spec); |
2095 share->set_feedback_vector(*feedback_vector, SKIP_WRITE_BARRIER); | 2097 share->set_feedback_vector(*feedback_vector, SKIP_WRITE_BARRIER); |
2096 #if TRACE_MAPS | 2098 #if TRACE_MAPS |
2097 share->set_unique_id(isolate()->GetNextUniqueSharedFunctionInfoId()); | 2099 share->set_unique_id(isolate()->GetNextUniqueSharedFunctionInfoId()); |
2098 #endif | 2100 #endif |
2099 share->set_profiler_ticks(0); | 2101 share->set_profiler_ticks(0); |
2100 share->set_ast_node_count(0); | 2102 share->set_ast_node_count(0); |
2101 share->set_counters(0); | 2103 share->set_counters(0); |
2102 | 2104 |
2103 // Set integer fields (smi or int, depending on the architecture). | 2105 // Set integer fields (smi or int, depending on the architecture). |
2104 share->set_length(0); | 2106 share->set_length(0); |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2518 return Handle<Object>::null(); | 2520 return Handle<Object>::null(); |
2519 } | 2521 } |
2520 | 2522 |
2521 | 2523 |
2522 Handle<Object> Factory::ToBoolean(bool value) { | 2524 Handle<Object> Factory::ToBoolean(bool value) { |
2523 return value ? true_value() : false_value(); | 2525 return value ? true_value() : false_value(); |
2524 } | 2526 } |
2525 | 2527 |
2526 | 2528 |
2527 } } // namespace v8::internal | 2529 } } // namespace v8::internal |
OLD | NEW |