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