Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(187)

Side by Side Diff: src/factory.cc

Issue 1217943004: Vector ICs: Introduce an InstanceType for the type feedback vector. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Improved printer. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/factory.h ('k') | src/heap/heap.h » ('j') | src/heap/heap.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 960 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 } 971 }
972 972
973 973
974 Handle<FixedArray> Factory::CopyFixedArray(Handle<FixedArray> array) { 974 Handle<FixedArray> Factory::CopyFixedArray(Handle<FixedArray> array) {
975 CALL_HEAP_FUNCTION(isolate(), 975 CALL_HEAP_FUNCTION(isolate(),
976 isolate()->heap()->CopyFixedArray(*array), 976 isolate()->heap()->CopyFixedArray(*array),
977 FixedArray); 977 FixedArray);
978 } 978 }
979 979
980 980
981 Handle<TypeFeedbackVector> Factory::CopyTypeFeedbackVector(
982 Handle<TypeFeedbackVector> vector) {
983 CALL_HEAP_FUNCTION(isolate(),
984 isolate()->heap()->CopyTypeFeedbackVector(*vector),
985 TypeFeedbackVector);
986 }
987
988
981 Handle<FixedArray> Factory::CopyAndTenureFixedCOWArray( 989 Handle<FixedArray> Factory::CopyAndTenureFixedCOWArray(
982 Handle<FixedArray> array) { 990 Handle<FixedArray> array) {
983 DCHECK(isolate()->heap()->InNewSpace(*array)); 991 DCHECK(isolate()->heap()->InNewSpace(*array));
984 CALL_HEAP_FUNCTION(isolate(), 992 CALL_HEAP_FUNCTION(isolate(),
985 isolate()->heap()->CopyAndTenureFixedCOWArray(*array), 993 isolate()->heap()->CopyAndTenureFixedCOWArray(*array),
986 FixedArray); 994 FixedArray);
987 } 995 }
988 996
989 997
990 Handle<FixedDoubleArray> Factory::CopyFixedDoubleArray( 998 Handle<FixedDoubleArray> Factory::CopyFixedDoubleArray(
(...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after
2102 void Factory::BecomeJSFunction(Handle<JSProxy> proxy) { 2110 void Factory::BecomeJSFunction(Handle<JSProxy> proxy) {
2103 ReinitializeJSProxy(proxy, JS_FUNCTION_TYPE, JSFunction::kSize); 2111 ReinitializeJSProxy(proxy, JS_FUNCTION_TYPE, JSFunction::kSize);
2104 } 2112 }
2105 2113
2106 2114
2107 template Handle<TypeFeedbackVector> Factory::NewTypeFeedbackVector( 2115 template Handle<TypeFeedbackVector> Factory::NewTypeFeedbackVector(
2108 const ZoneFeedbackVectorSpec* spec); 2116 const ZoneFeedbackVectorSpec* spec);
2109 template Handle<TypeFeedbackVector> Factory::NewTypeFeedbackVector( 2117 template Handle<TypeFeedbackVector> Factory::NewTypeFeedbackVector(
2110 const FeedbackVectorSpec* spec); 2118 const FeedbackVectorSpec* spec);
2111 2119
2120
2112 template <typename Spec> 2121 template <typename Spec>
2113 Handle<TypeFeedbackVector> Factory::NewTypeFeedbackVector(const Spec* spec) { 2122 Handle<TypeFeedbackVector> Factory::NewTypeFeedbackVector(const Spec* spec) {
2114 return TypeFeedbackVector::Allocate<Spec>(isolate(), spec); 2123 CALL_HEAP_FUNCTION(isolate(),
2124 isolate()->heap()->AllocateTypeFeedbackVector(spec),
2125 TypeFeedbackVector);
2115 } 2126 }
2116 2127
2117 2128
2118 Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo( 2129 Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo(
2119 Handle<String> name, int number_of_literals, FunctionKind kind, 2130 Handle<String> name, int number_of_literals, FunctionKind kind,
2120 Handle<Code> code, Handle<ScopeInfo> scope_info, 2131 Handle<Code> code, Handle<ScopeInfo> scope_info,
2121 Handle<TypeFeedbackVector> feedback_vector) { 2132 Handle<TypeFeedbackVector> feedback_vector) {
2122 DCHECK(IsValidFunctionKind(kind)); 2133 DCHECK(IsValidFunctionKind(kind));
2123 Handle<SharedFunctionInfo> shared = NewSharedFunctionInfo(name, code); 2134 Handle<SharedFunctionInfo> shared = NewSharedFunctionInfo(name, code);
2124 shared->set_scope_info(*scope_info); 2135 shared->set_scope_info(*scope_info);
(...skipping 24 matching lines...) Expand all
2149 message_obj->set_script(*script); 2160 message_obj->set_script(*script);
2150 message_obj->set_stack_frames(*stack_frames); 2161 message_obj->set_stack_frames(*stack_frames);
2151 return message_obj; 2162 return message_obj;
2152 } 2163 }
2153 2164
2154 2165
2155 Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo( 2166 Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo(
2156 Handle<String> name, 2167 Handle<String> name,
2157 MaybeHandle<Code> maybe_code) { 2168 MaybeHandle<Code> maybe_code) {
2158 Handle<Map> map = shared_function_info_map(); 2169 Handle<Map> map = shared_function_info_map();
2170 FeedbackVectorSpec empty_spec;
2171 Handle<TypeFeedbackVector> feedback_vector =
2172 NewTypeFeedbackVector(&empty_spec);
2159 Handle<SharedFunctionInfo> share = New<SharedFunctionInfo>(map, OLD_SPACE); 2173 Handle<SharedFunctionInfo> share = New<SharedFunctionInfo>(map, OLD_SPACE);
2160 2174
2161 // Set pointer fields. 2175 // Set pointer fields.
2162 share->set_name(*name); 2176 share->set_name(*name);
2163 Handle<Code> code; 2177 Handle<Code> code;
2164 if (!maybe_code.ToHandle(&code)) { 2178 if (!maybe_code.ToHandle(&code)) {
2165 code = handle(isolate()->builtins()->builtin(Builtins::kIllegal)); 2179 code = handle(isolate()->builtins()->builtin(Builtins::kIllegal));
2166 } 2180 }
2167 share->set_code(*code); 2181 share->set_code(*code);
2168 share->set_optimized_code_map(Smi::FromInt(0)); 2182 share->set_optimized_code_map(Smi::FromInt(0));
2169 share->set_scope_info(ScopeInfo::Empty(isolate())); 2183 share->set_scope_info(ScopeInfo::Empty(isolate()));
2170 Code* construct_stub = 2184 Code* construct_stub =
2171 isolate()->builtins()->builtin(Builtins::kJSConstructStubGeneric); 2185 isolate()->builtins()->builtin(Builtins::kJSConstructStubGeneric);
2172 share->set_construct_stub(construct_stub); 2186 share->set_construct_stub(construct_stub);
2173 share->set_instance_class_name(*Object_string()); 2187 share->set_instance_class_name(*Object_string());
2174 share->set_function_data(*undefined_value(), SKIP_WRITE_BARRIER); 2188 share->set_function_data(*undefined_value(), SKIP_WRITE_BARRIER);
2175 share->set_script(*undefined_value(), SKIP_WRITE_BARRIER); 2189 share->set_script(*undefined_value(), SKIP_WRITE_BARRIER);
2176 share->set_debug_info(*undefined_value(), SKIP_WRITE_BARRIER); 2190 share->set_debug_info(*undefined_value(), SKIP_WRITE_BARRIER);
2177 share->set_inferred_name(*empty_string(), SKIP_WRITE_BARRIER); 2191 share->set_inferred_name(*empty_string(), SKIP_WRITE_BARRIER);
2178 FeedbackVectorSpec empty_spec(0);
2179 Handle<TypeFeedbackVector> feedback_vector =
2180 NewTypeFeedbackVector(&empty_spec);
2181 share->set_feedback_vector(*feedback_vector, SKIP_WRITE_BARRIER); 2192 share->set_feedback_vector(*feedback_vector, SKIP_WRITE_BARRIER);
2182 #if TRACE_MAPS 2193 #if TRACE_MAPS
2183 share->set_unique_id(isolate()->GetNextUniqueSharedFunctionInfoId()); 2194 share->set_unique_id(isolate()->GetNextUniqueSharedFunctionInfoId());
2184 #endif 2195 #endif
2185 share->set_profiler_ticks(0); 2196 share->set_profiler_ticks(0);
2186 share->set_ast_node_count(0); 2197 share->set_ast_node_count(0);
2187 share->set_counters(0); 2198 share->set_counters(0);
2188 2199
2189 // Set integer fields (smi or int, depending on the architecture). 2200 // Set integer fields (smi or int, depending on the architecture).
2190 share->set_length(0); 2201 share->set_length(0);
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
2430 } 2441 }
2431 2442
2432 2443
2433 Handle<Object> Factory::ToBoolean(bool value) { 2444 Handle<Object> Factory::ToBoolean(bool value) {
2434 return value ? true_value() : false_value(); 2445 return value ? true_value() : false_value();
2435 } 2446 }
2436 2447
2437 2448
2438 } // namespace internal 2449 } // namespace internal
2439 } // namespace v8 2450 } // namespace v8
OLDNEW
« no previous file with comments | « src/factory.h ('k') | src/heap/heap.h » ('j') | src/heap/heap.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698