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

Side by Side Diff: src/factory.cc

Issue 1643533003: Revert of Type Feedback Vector lives in the closure (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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/full-codegen/arm/full-codegen-arm.cc » ('j') | no next file with comments »
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 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1198 PretenureFlag pretenure) { 1198 PretenureFlag pretenure) {
1199 AllocationSpace space = pretenure == TENURED ? OLD_SPACE : NEW_SPACE; 1199 AllocationSpace space = pretenure == TENURED ? OLD_SPACE : NEW_SPACE;
1200 Handle<JSFunction> function = New<JSFunction>(map, space); 1200 Handle<JSFunction> function = New<JSFunction>(map, space);
1201 1201
1202 function->initialize_properties(); 1202 function->initialize_properties();
1203 function->initialize_elements(); 1203 function->initialize_elements();
1204 function->set_shared(*info); 1204 function->set_shared(*info);
1205 function->set_code(info->code()); 1205 function->set_code(info->code());
1206 function->set_context(*context); 1206 function->set_context(*context);
1207 function->set_prototype_or_initial_map(*the_hole_value()); 1207 function->set_prototype_or_initial_map(*the_hole_value());
1208 function->set_literals(LiteralsArray::cast(*empty_literals_array())); 1208 function->set_literals(LiteralsArray::cast(*empty_fixed_array()));
1209 function->set_next_function_link(*undefined_value(), SKIP_WRITE_BARRIER); 1209 function->set_next_function_link(*undefined_value(), SKIP_WRITE_BARRIER);
1210 isolate()->heap()->InitializeJSObjectBody(*function, *map, JSFunction::kSize); 1210 isolate()->heap()->InitializeJSObjectBody(*function, *map, JSFunction::kSize);
1211 return function; 1211 return function;
1212 } 1212 }
1213 1213
1214 1214
1215 Handle<JSFunction> Factory::NewFunction(Handle<Map> map, 1215 Handle<JSFunction> Factory::NewFunction(Handle<Map> map,
1216 Handle<String> name, 1216 Handle<String> name,
1217 MaybeHandle<Code> code) { 1217 MaybeHandle<Code> code) {
1218 Handle<Context> context(isolate()->native_context()); 1218 Handle<Context> context(isolate()->native_context());
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 context->native_context(), BailoutId::None()); 1364 context->native_context(), BailoutId::None());
1365 if (cached.code != nullptr) { 1365 if (cached.code != nullptr) {
1366 // Caching of optimized code enabled and optimized code found. 1366 // Caching of optimized code enabled and optimized code found.
1367 DCHECK(!cached.code->marked_for_deoptimization()); 1367 DCHECK(!cached.code->marked_for_deoptimization());
1368 DCHECK(result->shared()->is_compiled()); 1368 DCHECK(result->shared()->is_compiled());
1369 result->ReplaceCode(cached.code); 1369 result->ReplaceCode(cached.code);
1370 } 1370 }
1371 1371
1372 if (cached.literals != nullptr) { 1372 if (cached.literals != nullptr) {
1373 result->set_literals(cached.literals); 1373 result->set_literals(cached.literals);
1374 } else if (info->is_compiled()) { 1374 } else {
1375 int number_of_literals = info->num_literals(); 1375 int number_of_literals = info->num_literals();
1376 Handle<TypeFeedbackVector> vector =
1377 TypeFeedbackVector::New(isolate(), handle(info->feedback_metadata()));
1378 Handle<LiteralsArray> literals = 1376 Handle<LiteralsArray> literals =
1379 LiteralsArray::New(isolate(), vector, number_of_literals, pretenure); 1377 LiteralsArray::New(isolate(), handle(info->feedback_vector()),
1378 number_of_literals, pretenure);
1380 result->set_literals(*literals); 1379 result->set_literals(*literals);
1381 1380
1382 // Cache context-specific literals. 1381 // Cache context-specific literals.
1383 Handle<Context> native_context(context->native_context()); 1382 Handle<Context> native_context(context->native_context());
1384 SharedFunctionInfo::AddLiteralsToOptimizedCodeMap(info, native_context, 1383 SharedFunctionInfo::AddLiteralsToOptimizedCodeMap(info, native_context,
1385 literals); 1384 literals);
1386 } 1385 }
1387 1386
1388 return result; 1387 return result;
1389 } 1388 }
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
2075 object->synchronized_set_map(*map); 2074 object->synchronized_set_map(*map);
2076 2075
2077 Heap* heap = isolate()->heap(); 2076 Heap* heap = isolate()->heap();
2078 // Reinitialize the object from the constructor map. 2077 // Reinitialize the object from the constructor map.
2079 heap->InitializeJSObjectFromMap(*object, *properties, *map); 2078 heap->InitializeJSObjectFromMap(*object, *properties, *map);
2080 2079
2081 // Restore the saved hash. 2080 // Restore the saved hash.
2082 object->set_hash(*hash); 2081 object->set_hash(*hash);
2083 } 2082 }
2084 2083
2084
2085 Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo( 2085 Handle<SharedFunctionInfo> Factory::NewSharedFunctionInfo(
2086 Handle<String> name, int number_of_literals, FunctionKind kind, 2086 Handle<String> name, int number_of_literals, FunctionKind kind,
2087 Handle<Code> code, Handle<ScopeInfo> scope_info, 2087 Handle<Code> code, Handle<ScopeInfo> scope_info,
2088 Handle<TypeFeedbackMetadata> feedback_metadata) { 2088 Handle<TypeFeedbackVector> feedback_vector) {
2089 DCHECK(IsValidFunctionKind(kind)); 2089 DCHECK(IsValidFunctionKind(kind));
2090 Handle<SharedFunctionInfo> shared = NewSharedFunctionInfo( 2090 Handle<SharedFunctionInfo> shared = NewSharedFunctionInfo(
2091 name, code, IsConstructable(kind, scope_info->language_mode())); 2091 name, code, IsConstructable(kind, scope_info->language_mode()));
2092 shared->set_scope_info(*scope_info); 2092 shared->set_scope_info(*scope_info);
2093 shared->set_feedback_metadata(*feedback_metadata); 2093 shared->set_feedback_vector(*feedback_vector);
2094 shared->set_kind(kind); 2094 shared->set_kind(kind);
2095 shared->set_num_literals(number_of_literals); 2095 shared->set_num_literals(number_of_literals);
2096 if (IsGeneratorFunction(kind)) { 2096 if (IsGeneratorFunction(kind)) {
2097 shared->set_instance_class_name(isolate()->heap()->Generator_string()); 2097 shared->set_instance_class_name(isolate()->heap()->Generator_string());
2098 shared->DisableOptimization(kGenerator); 2098 shared->DisableOptimization(kGenerator);
2099 } 2099 }
2100 return shared; 2100 return shared;
2101 } 2101 }
2102 2102
2103 2103
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2139 : isolate()->builtins()->ConstructedNonConstructable(); 2139 : isolate()->builtins()->ConstructedNonConstructable();
2140 share->set_construct_stub(*construct_stub); 2140 share->set_construct_stub(*construct_stub);
2141 share->set_instance_class_name(*Object_string()); 2141 share->set_instance_class_name(*Object_string());
2142 share->set_function_data(*undefined_value(), SKIP_WRITE_BARRIER); 2142 share->set_function_data(*undefined_value(), SKIP_WRITE_BARRIER);
2143 share->set_script(*undefined_value(), SKIP_WRITE_BARRIER); 2143 share->set_script(*undefined_value(), SKIP_WRITE_BARRIER);
2144 share->set_debug_info(*undefined_value(), SKIP_WRITE_BARRIER); 2144 share->set_debug_info(*undefined_value(), SKIP_WRITE_BARRIER);
2145 share->set_inferred_name(*empty_string(), SKIP_WRITE_BARRIER); 2145 share->set_inferred_name(*empty_string(), SKIP_WRITE_BARRIER);
2146 StaticFeedbackVectorSpec empty_spec; 2146 StaticFeedbackVectorSpec empty_spec;
2147 Handle<TypeFeedbackMetadata> feedback_metadata = 2147 Handle<TypeFeedbackMetadata> feedback_metadata =
2148 TypeFeedbackMetadata::New(isolate(), &empty_spec); 2148 TypeFeedbackMetadata::New(isolate(), &empty_spec);
2149 share->set_feedback_metadata(*feedback_metadata, SKIP_WRITE_BARRIER); 2149 Handle<TypeFeedbackVector> feedback_vector =
2150 TypeFeedbackVector::New(isolate(), feedback_metadata);
2151 share->set_feedback_vector(*feedback_vector, SKIP_WRITE_BARRIER);
2150 #if TRACE_MAPS 2152 #if TRACE_MAPS
2151 share->set_unique_id(isolate()->GetNextUniqueSharedFunctionInfoId()); 2153 share->set_unique_id(isolate()->GetNextUniqueSharedFunctionInfoId());
2152 #endif 2154 #endif
2153 share->set_profiler_ticks(0); 2155 share->set_profiler_ticks(0);
2154 share->set_ast_node_count(0); 2156 share->set_ast_node_count(0);
2155 share->set_counters(0); 2157 share->set_counters(0);
2156 2158
2157 // Set integer fields (smi or int, depending on the architecture). 2159 // Set integer fields (smi or int, depending on the architecture).
2158 share->set_length(0); 2160 share->set_length(0);
2159 share->set_internal_formal_parameter_count(0); 2161 share->set_internal_formal_parameter_count(0);
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
2394 } 2396 }
2395 2397
2396 2398
2397 Handle<Object> Factory::ToBoolean(bool value) { 2399 Handle<Object> Factory::ToBoolean(bool value) {
2398 return value ? true_value() : false_value(); 2400 return value ? true_value() : false_value();
2399 } 2401 }
2400 2402
2401 2403
2402 } // namespace internal 2404 } // namespace internal
2403 } // namespace v8 2405 } // namespace v8
OLDNEW
« no previous file with comments | « src/factory.h ('k') | src/full-codegen/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698