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

Unified Diff: runtime/vm/object.cc

Issue 2327693002: Add --parse-all option in order to benchmark and measure the scanner/parser performance. (Closed)
Patch Set: Address review comments. Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 2456ed6b1defb6ad7f97bc4650d3a575828b11ee..927ad6e8ba73c7c00c380e63cef6737a0b1b64a8 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -11414,6 +11414,51 @@ RawError* Library::CompileAll() {
}
+RawError* Library::ParseAll(Thread* thread) {
+ Zone* zone = thread->zone();
+ Error& error = Error::Handle(zone);
+ Isolate* isolate = thread->isolate();
+ const GrowableObjectArray& libs = GrowableObjectArray::Handle(
+ isolate->object_store()->libraries());
+ Library& lib = Library::Handle(zone);
+ Class& cls = Class::Handle(zone);
+ for (int i = 0; i < libs.Length(); i++) {
+ lib ^= libs.At(i);
+ ClassDictionaryIterator it(lib, ClassDictionaryIterator::kIteratePrivate);
+ while (it.HasNext()) {
+ cls = it.GetNextClass();
+ error = cls.EnsureIsFinalized(thread);
+ if (!error.IsNull()) {
+ return error.raw();
+ }
+ error = Compiler::ParseAllFunctions(cls);
+ if (!error.IsNull()) {
+ return error.raw();
+ }
+ }
+ }
+
+ // Inner functions get added to the closures array. As part of compilation
+ // more closures can be added to the end of the array. Compile all the
+ // closures until we have reached the end of the "worklist".
+ const GrowableObjectArray& closures = GrowableObjectArray::Handle(zone,
+ Isolate::Current()->object_store()->closure_functions());
+ Function& func = Function::Handle(zone);
+ for (int i = 0; i < closures.Length(); i++) {
+ func ^= closures.At(i);
+ if (!func.HasCode()) {
+ error = Compiler::ParseFunction(thread, func);
+ if (!error.IsNull()) {
+ return error.raw();
+ }
+ func.ClearICDataArray();
+ func.ClearCode();
+ }
+ }
+ return error.raw();
+}
+
+
// Return Function::null() if function does not exist in libs.
RawFunction* Library::GetFunction(const GrowableArray<Library*>& libs,
const char* class_name,
« runtime/vm/compiler.cc ('K') | « runtime/vm/object.h ('k') | runtime/vm/parser_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698