| 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 2059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2070 void Factory::BecomeJSObject(Handle<JSProxy> proxy) { | 2070 void Factory::BecomeJSObject(Handle<JSProxy> proxy) { |
| 2071 ReinitializeJSProxy(proxy, JS_OBJECT_TYPE, JSObject::kHeaderSize); | 2071 ReinitializeJSProxy(proxy, JS_OBJECT_TYPE, JSObject::kHeaderSize); |
| 2072 } | 2072 } |
| 2073 | 2073 |
| 2074 | 2074 |
| 2075 void Factory::BecomeJSFunction(Handle<JSProxy> proxy) { | 2075 void Factory::BecomeJSFunction(Handle<JSProxy> proxy) { |
| 2076 ReinitializeJSProxy(proxy, JS_FUNCTION_TYPE, JSFunction::kSize); | 2076 ReinitializeJSProxy(proxy, JS_FUNCTION_TYPE, JSFunction::kSize); |
| 2077 } | 2077 } |
| 2078 | 2078 |
| 2079 | 2079 |
| 2080 template Handle<TypeFeedbackVector> Factory::NewTypeFeedbackVector( | |
| 2081 const FeedbackVectorSpec* spec); | |
| 2082 template Handle<TypeFeedbackVector> Factory::NewTypeFeedbackVector( | |
| 2083 const StaticFeedbackVectorSpec* spec); | |
| 2084 | |
| 2085 template <typename Spec> | |
| 2086 Handle<TypeFeedbackVector> Factory::NewTypeFeedbackVector(const Spec* spec) { | |
| 2087 return TypeFeedbackVector::Allocate<Spec>(isolate(), spec); | |
| 2088 } | |
| 2089 | |
| 2090 | |
| 2091 Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo( | 2080 Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo( |
| 2092 Handle<String> name, int number_of_literals, FunctionKind kind, | 2081 Handle<String> name, int number_of_literals, FunctionKind kind, |
| 2093 Handle<Code> code, Handle<ScopeInfo> scope_info, | 2082 Handle<Code> code, Handle<ScopeInfo> scope_info, |
| 2094 Handle<TypeFeedbackVector> feedback_vector) { | 2083 Handle<TypeFeedbackVector> feedback_vector) { |
| 2095 DCHECK(IsValidFunctionKind(kind)); | 2084 DCHECK(IsValidFunctionKind(kind)); |
| 2096 Handle<SharedFunctionInfo> shared = NewSharedFunctionInfo(name, code); | 2085 Handle<SharedFunctionInfo> shared = NewSharedFunctionInfo(name, code); |
| 2097 shared->set_scope_info(*scope_info); | 2086 shared->set_scope_info(*scope_info); |
| 2098 shared->set_feedback_vector(*feedback_vector); | 2087 shared->set_feedback_vector(*feedback_vector); |
| 2099 shared->set_kind(kind); | 2088 shared->set_kind(kind); |
| 2100 shared->set_num_literals(number_of_literals); | 2089 shared->set_num_literals(number_of_literals); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2143 Code* construct_stub = | 2132 Code* construct_stub = |
| 2144 isolate()->builtins()->builtin(Builtins::kJSConstructStubGeneric); | 2133 isolate()->builtins()->builtin(Builtins::kJSConstructStubGeneric); |
| 2145 share->set_construct_stub(construct_stub); | 2134 share->set_construct_stub(construct_stub); |
| 2146 share->set_instance_class_name(*Object_string()); | 2135 share->set_instance_class_name(*Object_string()); |
| 2147 share->set_function_data(*undefined_value(), SKIP_WRITE_BARRIER); | 2136 share->set_function_data(*undefined_value(), SKIP_WRITE_BARRIER); |
| 2148 share->set_script(*undefined_value(), SKIP_WRITE_BARRIER); | 2137 share->set_script(*undefined_value(), SKIP_WRITE_BARRIER); |
| 2149 share->set_debug_info(*undefined_value(), SKIP_WRITE_BARRIER); | 2138 share->set_debug_info(*undefined_value(), SKIP_WRITE_BARRIER); |
| 2150 share->set_inferred_name(*empty_string(), SKIP_WRITE_BARRIER); | 2139 share->set_inferred_name(*empty_string(), SKIP_WRITE_BARRIER); |
| 2151 StaticFeedbackVectorSpec empty_spec; | 2140 StaticFeedbackVectorSpec empty_spec; |
| 2152 Handle<TypeFeedbackVector> feedback_vector = | 2141 Handle<TypeFeedbackVector> feedback_vector = |
| 2153 NewTypeFeedbackVector(&empty_spec); | 2142 TypeFeedbackVector::New(isolate(), &empty_spec); |
| 2154 share->set_feedback_vector(*feedback_vector, SKIP_WRITE_BARRIER); | 2143 share->set_feedback_vector(*feedback_vector, SKIP_WRITE_BARRIER); |
| 2155 #if TRACE_MAPS | 2144 #if TRACE_MAPS |
| 2156 share->set_unique_id(isolate()->GetNextUniqueSharedFunctionInfoId()); | 2145 share->set_unique_id(isolate()->GetNextUniqueSharedFunctionInfoId()); |
| 2157 #endif | 2146 #endif |
| 2158 share->set_profiler_ticks(0); | 2147 share->set_profiler_ticks(0); |
| 2159 share->set_ast_node_count(0); | 2148 share->set_ast_node_count(0); |
| 2160 share->set_counters(0); | 2149 share->set_counters(0); |
| 2161 | 2150 |
| 2162 // Set integer fields (smi or int, depending on the architecture). | 2151 // Set integer fields (smi or int, depending on the architecture). |
| 2163 share->set_length(0); | 2152 share->set_length(0); |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2394 } | 2383 } |
| 2395 | 2384 |
| 2396 | 2385 |
| 2397 Handle<Object> Factory::ToBoolean(bool value) { | 2386 Handle<Object> Factory::ToBoolean(bool value) { |
| 2398 return value ? true_value() : false_value(); | 2387 return value ? true_value() : false_value(); |
| 2399 } | 2388 } |
| 2400 | 2389 |
| 2401 | 2390 |
| 2402 } // namespace internal | 2391 } // namespace internal |
| 2403 } // namespace v8 | 2392 } // namespace v8 |
| OLD | NEW |