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

Side by Side Diff: runtime/vm/kernel.h

Issue 2587673004: Include source in kernel. (Closed)
Patch Set: Updated kernels binary.md too. Created 4 years 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
OLDNEW
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
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 LineStartingTableAndSource {
Kevin Millikin (Google) 2016/12/20 12:03:33 I'd just go with a name like SourceTable for this.
jensj 2016/12/20 13:30:23 Done.
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 ~LineStartingTableAndSource() {
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_;
323 } 325 }
324 326
325 intptr_t size() { return size_; } 327 intptr_t size() { return size_; }
326 intptr_t* valuesFor(int i) { return values_[i]; } 328 String*& source_code_for(int i) { return source_code_[i]; }
Kevin Millikin (Google) 2016/12/20 12:03:33 SourceFor(intptr_t i). Dart VM style is to use in
jensj 2016/12/20 13:30:23 Done. I think I added the '&' because I saw Growab
329 intptr_t* line_starts_for(int i) { return line_starts_[i]; }
Kevin Millikin (Google) 2016/12/20 12:03:33 LineStartsFor(intptr_t i).
jensj 2016/12/20 13:30:23 Done.
327 330
328 private: 331 private:
329 LineStartingTable() : values_(NULL), size_(0) {} 332 LineStartingTableAndSource()
333 : source_code_(NULL), line_starts_(NULL), size_(0) {}
330 334
331 friend class Program; 335 friend class Program;
332 336
333 intptr_t** values_; 337 String** source_code_;
338 intptr_t** line_starts_;
334 intptr_t size_; 339 intptr_t size_;
335 340
336 DISALLOW_COPY_AND_ASSIGN(LineStartingTable); 341 DISALLOW_COPY_AND_ASSIGN(LineStartingTableAndSource);
337 }; 342 };
338 343
339 // Forward declare all classes. 344 // Forward declare all classes.
340 #define DO(name) class name; 345 #define DO(name) class name;
341 KERNEL_ALL_NODES_DO(DO) 346 KERNEL_ALL_NODES_DO(DO)
342 KERNEL_VISITORS_DO(DO) 347 KERNEL_VISITORS_DO(DO)
343 #undef DO 348 #undef DO
344 349
345 350
346 #define DEFINE_CASTING_OPERATIONS(klass) \ 351 #define DEFINE_CASTING_OPERATIONS(klass) \
(...skipping 2444 matching lines...) Expand 10 before | Expand all | Expand 10 after
2791 2796
2792 virtual ~Program(); 2797 virtual ~Program();
2793 2798
2794 DEFINE_CASTING_OPERATIONS(Program); 2799 DEFINE_CASTING_OPERATIONS(Program);
2795 2800
2796 virtual void AcceptTreeVisitor(TreeVisitor* visitor); 2801 virtual void AcceptTreeVisitor(TreeVisitor* visitor);
2797 virtual void VisitChildren(Visitor* visitor); 2802 virtual void VisitChildren(Visitor* visitor);
2798 2803
2799 StringTable& string_table() { return string_table_; } 2804 StringTable& string_table() { return string_table_; }
2800 StringTable& source_uri_table() { return source_uri_table_; } 2805 StringTable& source_uri_table() { return source_uri_table_; }
2801 LineStartingTable& line_starting_table() { return line_starting_table_; } 2806 LineStartingTableAndSource& line_starting_table_and_source() {
2807 return line_starting_table_and_source_;
2808 }
2802 List<Library>& libraries() { return libraries_; } 2809 List<Library>& libraries() { return libraries_; }
2803 Procedure* main_method() { return main_method_; } 2810 Procedure* main_method() { return main_method_; }
2804 2811
2805 private: 2812 private:
2806 Program() {} 2813 Program() {}
2807 2814
2808 List<Library> libraries_; 2815 List<Library> libraries_;
2809 Ref<Procedure> main_method_; 2816 Ref<Procedure> main_method_;
2810 StringTable string_table_; 2817 StringTable string_table_;
2811 StringTable source_uri_table_; 2818 StringTable source_uri_table_;
2812 LineStartingTable line_starting_table_; 2819 LineStartingTableAndSource line_starting_table_and_source_;
2813 2820
2814 DISALLOW_COPY_AND_ASSIGN(Program); 2821 DISALLOW_COPY_AND_ASSIGN(Program);
2815 }; 2822 };
2816 2823
2817 2824
2818 class Reference : public AllStatic { 2825 class Reference : public AllStatic {
2819 public: 2826 public:
2820 static Member* ReadMemberFrom(Reader* reader, bool allow_null = false); 2827 static Member* ReadMemberFrom(Reader* reader, bool allow_null = false);
2821 static void WriteMemberTo(Writer* writer, 2828 static void WriteMemberTo(Writer* writer,
2822 Member* member, 2829 Member* member,
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
3259 }; 3266 };
3260 3267
3261 3268
3262 void WritePrecompiledKernel(ByteWriter* out, kernel::Program* program); 3269 void WritePrecompiledKernel(ByteWriter* out, kernel::Program* program);
3263 3270
3264 3271
3265 } // namespace dart 3272 } // namespace dart
3266 3273
3267 #endif // !defined(DART_PRECOMPILED_RUNTIME) 3274 #endif // !defined(DART_PRECOMPILED_RUNTIME)
3268 #endif // RUNTIME_VM_KERNEL_H_ 3275 #endif // RUNTIME_VM_KERNEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698