| 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 1964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1975 void Factory::BecomeJSObject(Handle<JSProxy> proxy) { | 1975 void Factory::BecomeJSObject(Handle<JSProxy> proxy) { |
| 1976 ReinitializeJSProxy(proxy, JS_OBJECT_TYPE, JSObject::kHeaderSize); | 1976 ReinitializeJSProxy(proxy, JS_OBJECT_TYPE, JSObject::kHeaderSize); |
| 1977 } | 1977 } |
| 1978 | 1978 |
| 1979 | 1979 |
| 1980 void Factory::BecomeJSFunction(Handle<JSProxy> proxy) { | 1980 void Factory::BecomeJSFunction(Handle<JSProxy> proxy) { |
| 1981 ReinitializeJSProxy(proxy, JS_FUNCTION_TYPE, JSFunction::kSize); | 1981 ReinitializeJSProxy(proxy, JS_FUNCTION_TYPE, JSFunction::kSize); |
| 1982 } | 1982 } |
| 1983 | 1983 |
| 1984 | 1984 |
| 1985 Handle<TypeFeedbackVector> Factory::NewTypeFeedbackVector(int slot_count) { | 1985 Handle<TypeFeedbackVector> Factory::NewTypeFeedbackVector(int slot_count, |
| 1986 // Ensure we can skip the write barrier | 1986 int ic_slot_count) { |
| 1987 DCHECK_EQ(isolate()->heap()->uninitialized_symbol(), | 1987 return TypeFeedbackVector::Allocate(isolate(), slot_count, ic_slot_count); |
| 1988 *TypeFeedbackVector::UninitializedSentinel(isolate())); | |
| 1989 | |
| 1990 if (slot_count == 0) { | |
| 1991 return Handle<TypeFeedbackVector>::cast(empty_fixed_array()); | |
| 1992 } | |
| 1993 | |
| 1994 CALL_HEAP_FUNCTION(isolate(), | |
| 1995 isolate()->heap()->AllocateFixedArrayWithFiller( | |
| 1996 slot_count, TENURED, | |
| 1997 *TypeFeedbackVector::UninitializedSentinel(isolate())), | |
| 1998 TypeFeedbackVector); | |
| 1999 } | 1988 } |
| 2000 | 1989 |
| 2001 | 1990 |
| 2002 Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo( | 1991 Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo( |
| 2003 Handle<String> name, int number_of_literals, FunctionKind kind, | 1992 Handle<String> name, int number_of_literals, FunctionKind kind, |
| 2004 Handle<Code> code, Handle<ScopeInfo> scope_info, | 1993 Handle<Code> code, Handle<ScopeInfo> scope_info, |
| 2005 Handle<TypeFeedbackVector> feedback_vector) { | 1994 Handle<TypeFeedbackVector> feedback_vector) { |
| 2006 DCHECK(IsValidFunctionKind(kind)); | 1995 DCHECK(IsValidFunctionKind(kind)); |
| 2007 Handle<SharedFunctionInfo> shared = NewSharedFunctionInfo(name, code); | 1996 Handle<SharedFunctionInfo> shared = NewSharedFunctionInfo(name, code); |
| 2008 shared->set_scope_info(*scope_info); | 1997 shared->set_scope_info(*scope_info); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2063 share->set_optimized_code_map(Smi::FromInt(0)); | 2052 share->set_optimized_code_map(Smi::FromInt(0)); |
| 2064 share->set_scope_info(ScopeInfo::Empty(isolate())); | 2053 share->set_scope_info(ScopeInfo::Empty(isolate())); |
| 2065 Code* construct_stub = | 2054 Code* construct_stub = |
| 2066 isolate()->builtins()->builtin(Builtins::kJSConstructStubGeneric); | 2055 isolate()->builtins()->builtin(Builtins::kJSConstructStubGeneric); |
| 2067 share->set_construct_stub(construct_stub); | 2056 share->set_construct_stub(construct_stub); |
| 2068 share->set_instance_class_name(*Object_string()); | 2057 share->set_instance_class_name(*Object_string()); |
| 2069 share->set_function_data(*undefined_value(), SKIP_WRITE_BARRIER); | 2058 share->set_function_data(*undefined_value(), SKIP_WRITE_BARRIER); |
| 2070 share->set_script(*undefined_value(), SKIP_WRITE_BARRIER); | 2059 share->set_script(*undefined_value(), SKIP_WRITE_BARRIER); |
| 2071 share->set_debug_info(*undefined_value(), SKIP_WRITE_BARRIER); | 2060 share->set_debug_info(*undefined_value(), SKIP_WRITE_BARRIER); |
| 2072 share->set_inferred_name(*empty_string(), SKIP_WRITE_BARRIER); | 2061 share->set_inferred_name(*empty_string(), SKIP_WRITE_BARRIER); |
| 2073 Handle<TypeFeedbackVector> feedback_vector = NewTypeFeedbackVector(0); | 2062 Handle<TypeFeedbackVector> feedback_vector = NewTypeFeedbackVector(0, 0); |
| 2074 share->set_feedback_vector(*feedback_vector, SKIP_WRITE_BARRIER); | 2063 share->set_feedback_vector(*feedback_vector, SKIP_WRITE_BARRIER); |
| 2075 share->set_profiler_ticks(0); | 2064 share->set_profiler_ticks(0); |
| 2076 share->set_ast_node_count(0); | 2065 share->set_ast_node_count(0); |
| 2077 share->set_counters(0); | 2066 share->set_counters(0); |
| 2078 | 2067 |
| 2079 // Set integer fields (smi or int, depending on the architecture). | 2068 // Set integer fields (smi or int, depending on the architecture). |
| 2080 share->set_length(0); | 2069 share->set_length(0); |
| 2081 share->set_formal_parameter_count(0); | 2070 share->set_formal_parameter_count(0); |
| 2082 share->set_expected_nof_properties(0); | 2071 share->set_expected_nof_properties(0); |
| 2083 share->set_num_literals(0); | 2072 share->set_num_literals(0); |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2493 return Handle<Object>::null(); | 2482 return Handle<Object>::null(); |
| 2494 } | 2483 } |
| 2495 | 2484 |
| 2496 | 2485 |
| 2497 Handle<Object> Factory::ToBoolean(bool value) { | 2486 Handle<Object> Factory::ToBoolean(bool value) { |
| 2498 return value ? true_value() : false_value(); | 2487 return value ? true_value() : false_value(); |
| 2499 } | 2488 } |
| 2500 | 2489 |
| 2501 | 2490 |
| 2502 } } // namespace v8::internal | 2491 } } // namespace v8::internal |
| OLD | NEW |