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

Unified Diff: runtime/vm/compilation_trace.h

Issue 2922913004: Add Dart_Save/LoadCompilationTrace. (Closed)
Patch Set: . Created 3 years, 6 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
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/vm/compilation_trace.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/compilation_trace.h
diff --git a/runtime/vm/compilation_trace.h b/runtime/vm/compilation_trace.h
new file mode 100644
index 0000000000000000000000000000000000000000..cf7530cc74e20361ae23e15752e0ea9eade8d642
--- /dev/null
+++ b/runtime/vm/compilation_trace.h
@@ -0,0 +1,64 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+#ifndef RUNTIME_VM_COMPILATION_TRACE_H_
+#define RUNTIME_VM_COMPILATION_TRACE_H_
+
+#include "platform/assert.h"
+#include "vm/compiler.h"
+#include "vm/object.h"
+#include "vm/program_visitor.h"
+#include "vm/zone_text_buffer.h"
+
+namespace dart {
+
+class CompilationTraceSaver : public FunctionVisitor {
+ public:
+ explicit CompilationTraceSaver(Zone* zone);
+ void Visit(const Function& function);
+
+ void StealBuffer(uint8_t** buffer, intptr_t* buffer_length) {
+ *buffer = reinterpret_cast<uint8_t*>(buf_.buffer());
+ *buffer_length = buf_.length() + 1; // Include terminating NUL.
+ }
+
+ private:
+ ZoneTextBuffer buf_;
+ String& func_name_;
+ Class& cls_;
+ String& cls_name_;
+ Library& lib_;
+ String& uri_;
+};
+
+class CompilationTraceLoader : public ValueObject {
+ public:
+ explicit CompilationTraceLoader(Thread* thread);
+
+ RawObject* CompileTrace(char* buffer);
+
+ private:
+ RawObject* CompileTriple(const char* uri_cstr,
+ const char* cls_cstr,
+ const char* func_cstr);
+ RawObject* CompileFunction(const Function& function);
+ RawObject* EvaluateInitializer(const Field& field);
+
+ Thread* thread_;
+ Zone* zone_;
+ String& uri_;
+ String& class_name_;
+ String& function_name_;
+ String& function_name2_;
+ Library& lib_;
+ Class& cls_;
+ Function& function_;
+ Function& function2_;
+ Field& field_;
+ Object& error_;
+};
+
+} // namespace dart
+
+#endif // RUNTIME_VM_COMPILATION_TRACE_H_
« no previous file with comments | « runtime/include/dart_api.h ('k') | runtime/vm/compilation_trace.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698