| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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_KERNEL_H_ | 5 #ifndef RUNTIME_VM_KERNEL_H_ |
| 6 #define RUNTIME_VM_KERNEL_H_ | 6 #define RUNTIME_VM_KERNEL_H_ |
| 7 | 7 |
| 8 #if !defined(DART_PRECOMPILED_RUNTIME) | 8 #if !defined(DART_PRECOMPILED_RUNTIME) |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 StringTable() {} | 304 StringTable() {} |
| 305 | 305 |
| 306 friend class Program; | 306 friend class Program; |
| 307 | 307 |
| 308 List<String> strings_; | 308 List<String> strings_; |
| 309 | 309 |
| 310 DISALLOW_COPY_AND_ASSIGN(StringTable); | 310 DISALLOW_COPY_AND_ASSIGN(StringTable); |
| 311 }; | 311 }; |
| 312 | 312 |
| 313 | 313 |
| 314 class LineStartingTable { | 314 class SourceTable { |
| 315 public: | 315 public: |
| 316 void ReadFrom(Reader* reader); | 316 void ReadFrom(Reader* reader); |
| 317 void WriteTo(Writer* writer); | 317 void WriteTo(Writer* writer); |
| 318 ~LineStartingTable() { | 318 ~SourceTable() { |
| 319 for (intptr_t i = 0; i < size_; ++i) { | 319 for (intptr_t i = 0; i < size_; ++i) { |
| 320 delete[] values_[i]; | 320 delete source_code_[i]; |
| 321 delete[] line_starts_[i]; |
| 321 } | 322 } |
| 322 delete[] values_; | 323 delete[] source_code_; |
| 324 delete[] line_starts_; |
| 325 delete[] line_count_; |
| 323 } | 326 } |
| 324 | 327 |
| 325 intptr_t size() { return size_; } | 328 intptr_t size() { return size_; } |
| 326 intptr_t* valuesFor(int i) { return values_[i]; } | 329 String* SourceFor(intptr_t i) { return source_code_[i]; } |
| 330 intptr_t* LineStartsFor(intptr_t i) { return line_starts_[i]; } |
| 331 intptr_t LineCountFor(intptr_t i) { return line_count_[i]; } |
| 327 | 332 |
| 328 private: | 333 private: |
| 329 LineStartingTable() : values_(NULL), size_(0) {} | 334 SourceTable() |
| 335 : source_code_(NULL), line_starts_(NULL), line_count_(NULL), size_(0) {} |
| 330 | 336 |
| 331 friend class Program; | 337 friend class Program; |
| 332 | 338 |
| 333 intptr_t** values_; | 339 String** source_code_; |
| 340 intptr_t** line_starts_; |
| 341 intptr_t* line_count_; |
| 334 intptr_t size_; | 342 intptr_t size_; |
| 335 | 343 |
| 336 DISALLOW_COPY_AND_ASSIGN(LineStartingTable); | 344 DISALLOW_COPY_AND_ASSIGN(SourceTable); |
| 337 }; | 345 }; |
| 338 | 346 |
| 339 // Forward declare all classes. | 347 // Forward declare all classes. |
| 340 #define DO(name) class name; | 348 #define DO(name) class name; |
| 341 KERNEL_ALL_NODES_DO(DO) | 349 KERNEL_ALL_NODES_DO(DO) |
| 342 KERNEL_VISITORS_DO(DO) | 350 KERNEL_VISITORS_DO(DO) |
| 343 #undef DO | 351 #undef DO |
| 344 | 352 |
| 345 | 353 |
| 346 #define DEFINE_CASTING_OPERATIONS(klass) \ | 354 #define DEFINE_CASTING_OPERATIONS(klass) \ |
| (...skipping 2444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2791 | 2799 |
| 2792 virtual ~Program(); | 2800 virtual ~Program(); |
| 2793 | 2801 |
| 2794 DEFINE_CASTING_OPERATIONS(Program); | 2802 DEFINE_CASTING_OPERATIONS(Program); |
| 2795 | 2803 |
| 2796 virtual void AcceptTreeVisitor(TreeVisitor* visitor); | 2804 virtual void AcceptTreeVisitor(TreeVisitor* visitor); |
| 2797 virtual void VisitChildren(Visitor* visitor); | 2805 virtual void VisitChildren(Visitor* visitor); |
| 2798 | 2806 |
| 2799 StringTable& string_table() { return string_table_; } | 2807 StringTable& string_table() { return string_table_; } |
| 2800 StringTable& source_uri_table() { return source_uri_table_; } | 2808 StringTable& source_uri_table() { return source_uri_table_; } |
| 2801 LineStartingTable& line_starting_table() { return line_starting_table_; } | 2809 SourceTable& source_table() { return source_table_; } |
| 2802 List<Library>& libraries() { return libraries_; } | 2810 List<Library>& libraries() { return libraries_; } |
| 2803 Procedure* main_method() { return main_method_; } | 2811 Procedure* main_method() { return main_method_; } |
| 2804 | 2812 |
| 2805 private: | 2813 private: |
| 2806 Program() {} | 2814 Program() {} |
| 2807 | 2815 |
| 2808 List<Library> libraries_; | 2816 List<Library> libraries_; |
| 2809 Ref<Procedure> main_method_; | 2817 Ref<Procedure> main_method_; |
| 2810 StringTable string_table_; | 2818 StringTable string_table_; |
| 2811 StringTable source_uri_table_; | 2819 StringTable source_uri_table_; |
| 2812 LineStartingTable line_starting_table_; | 2820 SourceTable source_table_; |
| 2813 | 2821 |
| 2814 DISALLOW_COPY_AND_ASSIGN(Program); | 2822 DISALLOW_COPY_AND_ASSIGN(Program); |
| 2815 }; | 2823 }; |
| 2816 | 2824 |
| 2817 | 2825 |
| 2818 class Reference : public AllStatic { | 2826 class Reference : public AllStatic { |
| 2819 public: | 2827 public: |
| 2820 static Member* ReadMemberFrom(Reader* reader, bool allow_null = false); | 2828 static Member* ReadMemberFrom(Reader* reader, bool allow_null = false); |
| 2821 static void WriteMemberTo(Writer* writer, | 2829 static void WriteMemberTo(Writer* writer, |
| 2822 Member* member, | 2830 Member* member, |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3259 }; | 3267 }; |
| 3260 | 3268 |
| 3261 | 3269 |
| 3262 void WritePrecompiledKernel(ByteWriter* out, kernel::Program* program); | 3270 void WritePrecompiledKernel(ByteWriter* out, kernel::Program* program); |
| 3263 | 3271 |
| 3264 | 3272 |
| 3265 } // namespace dart | 3273 } // namespace dart |
| 3266 | 3274 |
| 3267 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 3275 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| 3268 #endif // RUNTIME_VM_KERNEL_H_ | 3276 #endif // RUNTIME_VM_KERNEL_H_ |
| OLD | NEW |