| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 #ifndef RUNTIME_VM_COMPILATION_TRACE_H_ | 5 #ifndef RUNTIME_VM_COMPILATION_TRACE_H_ |
| 6 #define RUNTIME_VM_COMPILATION_TRACE_H_ | 6 #define RUNTIME_VM_COMPILATION_TRACE_H_ |
| 7 | 7 |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/object.h" | 10 #include "vm/object.h" |
| 11 #include "vm/program_visitor.h" | 11 #include "vm/program_visitor.h" |
| 12 #include "vm/zone_text_buffer.h" | 12 #include "vm/zone_text_buffer.h" |
| 13 | 13 |
| 14 namespace dart { | 14 namespace dart { |
| 15 | 15 |
| 16 class CompilationTraceSaver : public FunctionVisitor { | 16 class CompilationTraceSaver : public FunctionVisitor { |
| 17 public: | 17 public: |
| 18 explicit CompilationTraceSaver(Zone* zone); | 18 explicit CompilationTraceSaver(Zone* zone); |
| 19 void Visit(const Function& function); | 19 void Visit(const Function& function); |
| 20 | 20 |
| 21 void StealBuffer(uint8_t** buffer, intptr_t* buffer_length) { | 21 void StealBuffer(uint8_t** buffer, intptr_t* buffer_length) { |
| 22 *buffer = reinterpret_cast<uint8_t*>(buf_.buffer()); | 22 *buffer = reinterpret_cast<uint8_t*>(buf_.buffer()); |
| 23 *buffer_length = buf_.length() + 1; // Include terminating NUL. | 23 *buffer_length = buf_.length(); |
| 24 } | 24 } |
| 25 | 25 |
| 26 private: | 26 private: |
| 27 ZoneTextBuffer buf_; | 27 ZoneTextBuffer buf_; |
| 28 String& func_name_; | 28 String& func_name_; |
| 29 Class& cls_; | 29 Class& cls_; |
| 30 String& cls_name_; | 30 String& cls_name_; |
| 31 Library& lib_; | 31 Library& lib_; |
| 32 String& uri_; | 32 String& uri_; |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 class CompilationTraceLoader : public ValueObject { | 35 class CompilationTraceLoader : public ValueObject { |
| 36 public: | 36 public: |
| 37 explicit CompilationTraceLoader(Thread* thread); | 37 explicit CompilationTraceLoader(Thread* thread); |
| 38 | 38 |
| 39 RawObject* CompileTrace(char* buffer); | 39 RawObject* CompileTrace(uint8_t* buffer, intptr_t buffer_length); |
| 40 | 40 |
| 41 private: | 41 private: |
| 42 RawObject* CompileTriple(const char* uri_cstr, | 42 RawObject* CompileTriple(const char* uri_cstr, |
| 43 const char* cls_cstr, | 43 const char* cls_cstr, |
| 44 const char* func_cstr); | 44 const char* func_cstr); |
| 45 RawObject* CompileFunction(const Function& function); | 45 RawObject* CompileFunction(const Function& function); |
| 46 RawObject* EvaluateInitializer(const Field& field); | 46 RawObject* EvaluateInitializer(const Field& field); |
| 47 | 47 |
| 48 Thread* thread_; | 48 Thread* thread_; |
| 49 Zone* zone_; | 49 Zone* zone_; |
| 50 String& uri_; | 50 String& uri_; |
| 51 String& class_name_; | 51 String& class_name_; |
| 52 String& function_name_; | 52 String& function_name_; |
| 53 String& function_name2_; | 53 String& function_name2_; |
| 54 Library& lib_; | 54 Library& lib_; |
| 55 Class& cls_; | 55 Class& cls_; |
| 56 Function& function_; | 56 Function& function_; |
| 57 Function& function2_; | 57 Function& function2_; |
| 58 Field& field_; | 58 Field& field_; |
| 59 Object& error_; | 59 Object& error_; |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 } // namespace dart | 62 } // namespace dart |
| 63 | 63 |
| 64 #endif // RUNTIME_VM_COMPILATION_TRACE_H_ | 64 #endif // RUNTIME_VM_COMPILATION_TRACE_H_ |
| OLD | NEW |