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

Side by Side Diff: runtime/vm/precompiler.cc

Issue 1969843002: VM: Another fix for precompiling with >1 iterations. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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 | « runtime/vm/precompiler.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/precompiler.h" 5 #include "vm/precompiler.h"
6 6
7 #include "vm/aot_optimizer.h" 7 #include "vm/aot_optimizer.h"
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/ast_printer.h" 9 #include "vm/ast_printer.h"
10 #include "vm/branch_optimizer.h" 10 #include "vm/branch_optimizer.h"
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 if ((cid == kDynamicCid) || 285 if ((cid == kDynamicCid) ||
286 (cid == kVoidCid) || 286 (cid == kVoidCid) ||
287 (cid == kFreeListElement)) { 287 (cid == kFreeListElement)) {
288 continue; 288 continue;
289 } 289 }
290 cls = isolate()->class_table()->At(cid); 290 cls = isolate()->class_table()->At(cid);
291 AddInstantiatedClass(cls); 291 AddInstantiatedClass(cls);
292 } 292 }
293 293
294 Dart_QualifiedFunctionName vm_entry_points[] = { 294 Dart_QualifiedFunctionName vm_entry_points[] = {
295 // TODO(rmacnak): These types are not allocated from C++ but they are
296 // cached in the object store. Consider clearing them from the object store
297 // before snapshotting and adjusting InitKnownObjects to allow their
298 // absence.
299 { "dart:async", "Future", "Future." },
300 { "dart:async", "Completer", "Completer." },
301 { "dart:async", "StreamIterator", "StreamIterator." },
302
303 // Functions 295 // Functions
304 { "dart:async", "::", "_setScheduleImmediateClosure" }, 296 { "dart:async", "::", "_setScheduleImmediateClosure" },
305 { "dart:core", "::", "_completeDeferredLoads" }, 297 { "dart:core", "::", "_completeDeferredLoads" },
306 { "dart:core", "AbstractClassInstantiationError", 298 { "dart:core", "AbstractClassInstantiationError",
307 "AbstractClassInstantiationError._create" }, 299 "AbstractClassInstantiationError._create" },
308 { "dart:core", "ArgumentError", "ArgumentError." }, 300 { "dart:core", "ArgumentError", "ArgumentError." },
309 { "dart:core", "CyclicInitializationError", 301 { "dart:core", "CyclicInitializationError",
310 "CyclicInitializationError." }, 302 "CyclicInitializationError." },
311 { "dart:core", "FallThroughError", "FallThroughError._create" }, 303 { "dart:core", "FallThroughError", "FallThroughError._create" },
312 { "dart:core", "FormatException", "FormatException." }, 304 { "dart:core", "FormatException", "FormatException." },
313 { "dart:core", "NoSuchMethodError", "NoSuchMethodError._withType" }, 305 { "dart:core", "NoSuchMethodError", "NoSuchMethodError._withType" },
314 { "dart:core", "NullThrownError", "NullThrownError." }, 306 { "dart:core", "NullThrownError", "NullThrownError." },
315 { "dart:core", "OutOfMemoryError", "OutOfMemoryError." }, 307 { "dart:core", "OutOfMemoryError", "OutOfMemoryError." },
316 { "dart:core", "RangeError", "RangeError." }, 308 { "dart:core", "RangeError", "RangeError." },
317 { "dart:core", "RangeError", "RangeError.range" }, 309 { "dart:core", "RangeError", "RangeError.range" },
318 { "dart:core", "StackOverflowError", "StackOverflowError." }, 310 { "dart:core", "StackOverflowError", "StackOverflowError." },
319 { "dart:core", "UnsupportedError", "UnsupportedError." }, 311 { "dart:core", "UnsupportedError", "UnsupportedError." },
320 { "dart:core", "_AssertionError", "_AssertionError._create" }, 312 { "dart:core", "_AssertionError", "_AssertionError._create" },
321 { "dart:core", "_CastError", "_CastError._create" }, 313 { "dart:core", "_CastError", "_CastError._create" },
322 { "dart:core", "_InternalError", "_InternalError." }, 314 { "dart:core", "_InternalError", "_InternalError." },
323 { "dart:core", "_InvocationMirror", "_allocateInvocationMirror" }, 315 { "dart:core", "_InvocationMirror", "_allocateInvocationMirror" },
324 { "dart:core", "_TypeError", "_TypeError._create" }, 316 { "dart:core", "_TypeError", "_TypeError._create" },
325 { "dart:isolate", "IsolateSpawnException", "IsolateSpawnException." }, 317 { "dart:isolate", "IsolateSpawnException", "IsolateSpawnException." },
326 { "dart:isolate", "::", "_getIsolateScheduleImmediateClosure" }, 318 { "dart:isolate", "::", "_getIsolateScheduleImmediateClosure" },
327 { "dart:isolate", "::", "_setupHooks" }, 319 { "dart:isolate", "::", "_setupHooks" },
328 { "dart:isolate", "::", "_startMainIsolate" }, 320 { "dart:isolate", "::", "_startMainIsolate" },
321 { "dart:isolate", "::", "_startIsolate" },
329 { "dart:isolate", "_RawReceivePortImpl", "_handleMessage" }, 322 { "dart:isolate", "_RawReceivePortImpl", "_handleMessage" },
330 { "dart:isolate", "_RawReceivePortImpl", "_lookupHandler" }, 323 { "dart:isolate", "_RawReceivePortImpl", "_lookupHandler" },
331 { "dart:isolate", "_SendPortImpl", "send" }, 324 { "dart:isolate", "_SendPortImpl", "send" },
332 { "dart:typed_data", "ByteData", "ByteData." }, 325 { "dart:typed_data", "ByteData", "ByteData." },
333 { "dart:typed_data", "ByteData", "ByteData._view" }, 326 { "dart:typed_data", "ByteData", "ByteData._view" },
334 { "dart:typed_data", "ByteBuffer", "ByteBuffer._New" }, 327 { "dart:typed_data", "ByteBuffer", "ByteBuffer._New" },
335 #if !defined(PRODUCT) 328 #if !defined(PRODUCT)
336 { "dart:_vmservice", "::", "_registerIsolate" }, 329 { "dart:_vmservice", "::", "_registerIsolate" },
337 { "dart:_vmservice", "::", "boot" }, 330 { "dart:_vmservice", "::", "boot" },
338 { "dart:developer", "Metrics", "_printMetrics" }, 331 { "dart:developer", "Metrics", "_printMetrics" },
332 { "dart:developer", "::", "_runExtension" },
339 #endif // !PRODUCT 333 #endif // !PRODUCT
340 // Fields 334 // Fields
341 { "dart:core", "Error", "_stackTrace" }, 335 { "dart:core", "Error", "_stackTrace" },
342 { "dart:math", "_Random", "_state" }, 336 { "dart:math", "_Random", "_state" },
343 { NULL, NULL, NULL } // Must be terminated with NULL entries. 337 { NULL, NULL, NULL } // Must be terminated with NULL entries.
344 }; 338 };
345 339
346 AddEntryPoints(vm_entry_points); 340 AddEntryPoints(vm_entry_points);
347 AddEntryPoints(embedder_entry_points); 341 AddEntryPoints(embedder_entry_points);
348 } 342 }
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 field.SetPrecompiledInitializer(initializer); 774 field.SetPrecompiledInitializer(initializer);
781 AddCalleesOf(initializer); 775 AddCalleesOf(initializer);
782 } 776 }
783 } 777 }
784 } 778 }
785 } 779 }
786 780
787 781
788 RawFunction* Precompiler::CompileStaticInitializer(const Field& field) { 782 RawFunction* Precompiler::CompileStaticInitializer(const Field& field) {
789 ASSERT(field.is_static()); 783 ASSERT(field.is_static());
790 ASSERT(!field.HasPrecompiledInitializer());
791 Thread* thread = Thread::Current(); 784 Thread* thread = Thread::Current();
792 StackZone zone(thread); 785 StackZone zone(thread);
793 786
794 ParsedFunction* parsed_function = Parser::ParseStaticFieldInitializer(field); 787 ParsedFunction* parsed_function = Parser::ParseStaticFieldInitializer(field);
795 788
796 parsed_function->AllocateVariables(); 789 parsed_function->AllocateVariables();
797 DartCompilationPipeline pipeline; 790 DartCompilationPipeline pipeline;
798 PrecompileParsedFunctionHelper helper(parsed_function, 791 PrecompileParsedFunctionHelper helper(parsed_function,
799 /* optimized = */ true); 792 /* optimized = */ true);
800 bool success = helper.Compile(&pipeline); 793 bool success = helper.Compile(&pipeline);
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 fname = function.name(); 1116 fname = function.name();
1124 if (function.IsSetterFunction() || 1117 if (function.IsSetterFunction() ||
1125 function.IsImplicitSetterFunction()) { 1118 function.IsImplicitSetterFunction()) {
1126 AddNameToFunctionsTable(zone(), &table, fname, function); 1119 AddNameToFunctionsTable(zone(), &table, fname, function);
1127 } else if (function.IsGetterFunction() || 1120 } else if (function.IsGetterFunction() ||
1128 function.IsImplicitGetterFunction()) { 1121 function.IsImplicitGetterFunction()) {
1129 // Enter both getter and non getter name. 1122 // Enter both getter and non getter name.
1130 AddNameToFunctionsTable(zone(), &table, fname, function); 1123 AddNameToFunctionsTable(zone(), &table, fname, function);
1131 fname = Field::NameFromGetter(fname); 1124 fname = Field::NameFromGetter(fname);
1132 AddNameToFunctionsTable(zone(), &table, fname, function); 1125 AddNameToFunctionsTable(zone(), &table, fname, function);
1126 } else if (function.IsMethodExtractor()) {
1127 // Skip. We already add getter names for regular methods below.
1128 continue;
1133 } else { 1129 } else {
1134 // Regular function. Enter both getter and non getter name. 1130 // Regular function. Enter both getter and non getter name.
1135 AddNameToFunctionsTable(zone(), &table, fname, function); 1131 AddNameToFunctionsTable(zone(), &table, fname, function);
1136 fname = Field::GetterName(fname); 1132 fname = Field::GetterName(fname);
1137 AddNameToFunctionsTable(zone(), &table, fname, function); 1133 AddNameToFunctionsTable(zone(), &table, fname, function);
1138 } 1134 }
1139 } 1135 }
1140 } 1136 }
1141 } 1137 }
1142 } 1138 }
(...skipping 27 matching lines...) Expand all
1170 THR_Print("%" Pd " of %" Pd " dynamic selectors are unique\n", 1166 THR_Print("%" Pd " of %" Pd " dynamic selectors are unique\n",
1171 functions_set.NumOccupied(), table.NumOccupied()); 1167 functions_set.NumOccupied(), table.NumOccupied());
1172 } 1168 }
1173 1169
1174 isolate()->object_store()->set_unique_dynamic_targets( 1170 isolate()->object_store()->set_unique_dynamic_targets(
1175 functions_set.Release()); 1171 functions_set.Release());
1176 table.Release(); 1172 table.Release();
1177 } 1173 }
1178 1174
1179 1175
1180 void Precompiler::GetUniqueDynamicTarget(Isolate* isolate,
1181 const String& fname,
1182 Object* function) {
1183 UniqueFunctionsSet functions_set(
1184 isolate->object_store()->unique_dynamic_targets());
1185 ASSERT(fname.IsSymbol());
1186 *function = functions_set.GetOrNull(fname);
1187 ASSERT(functions_set.Release().raw() ==
1188 isolate->object_store()->unique_dynamic_targets());
1189 }
1190
1191
1192 void Precompiler::TraceConstFunctions() { 1176 void Precompiler::TraceConstFunctions() {
1193 // Compilation of const accessors happens outside of the treeshakers 1177 // Compilation of const accessors happens outside of the treeshakers
1194 // queue, so we haven't previously scanned its literal pool. 1178 // queue, so we haven't previously scanned its literal pool.
1195 1179
1196 Library& lib = Library::Handle(Z); 1180 Library& lib = Library::Handle(Z);
1197 Class& cls = Class::Handle(Z); 1181 Class& cls = Class::Handle(Z);
1198 Array& functions = Array::Handle(Z); 1182 Array& functions = Array::Handle(Z);
1199 Function& function = Function::Handle(Z); 1183 Function& function = Function::Handle(Z);
1200 1184
1201 for (intptr_t i = 0; i < libraries_.Length(); i++) { 1185 for (intptr_t i = 0; i < libraries_.Length(); i++) {
(...skipping 1561 matching lines...) Expand 10 before | Expand all | Expand 10 after
2763 CompilationPipeline::New(thread->zone(), function); 2747 CompilationPipeline::New(thread->zone(), function);
2764 2748
2765 ASSERT(FLAG_precompiled_mode); 2749 ASSERT(FLAG_precompiled_mode);
2766 const bool optimized = function.IsOptimizable(); // False for natives. 2750 const bool optimized = function.IsOptimizable(); // False for natives.
2767 return PrecompileFunctionHelper(pipeline, function, optimized); 2751 return PrecompileFunctionHelper(pipeline, function, optimized);
2768 } 2752 }
2769 2753
2770 #endif // DART_PRECOMPILER 2754 #endif // DART_PRECOMPILER
2771 2755
2772 } // namespace dart 2756 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/precompiler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698