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

Side by Side Diff: runtime/vm/kernel_binary.cc

Issue 2901533002: [kernel] Stream everything. Replace .kernel_function with .kernel_offset (Closed)
Patch Set: Fixed assert issues; small refactorings. 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 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 #if !defined(DART_PRECOMPILED_RUNTIME) 4 #if !defined(DART_PRECOMPILED_RUNTIME)
5 5
6 #include "vm/kernel_binary.h" 6 #include "vm/kernel_binary.h"
7 #include "platform/globals.h" 7 #include "platform/globals.h"
8 #include "vm/flags.h" 8 #include "vm/flags.h"
9 #include "vm/growable_array.h" 9 #include "vm/growable_array.h"
10 #include "vm/kernel.h" 10 #include "vm/kernel.h"
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 type_parameters_.ReadFrom(reader); 222 type_parameters_.ReadFrom(reader);
223 type_ = DartType::ReadFrom(reader); 223 type_ = DartType::ReadFrom(reader);
224 224
225 return this; 225 return this;
226 } 226 }
227 227
228 228
229 Class* Class::ReadFrom(Reader* reader) { 229 Class* Class::ReadFrom(Reader* reader) {
230 TRACE_READ_OFFSET(); 230 TRACE_READ_OFFSET();
231 231
232 kernel_offset_ = reader->offset() - 1; // -1 to include tag byte.
232 canonical_name_ = reader->ReadCanonicalNameReference(); 233 canonical_name_ = reader->ReadCanonicalNameReference();
233 position_ = reader->ReadPosition(false); 234 position_ = reader->ReadPosition(false);
234 is_abstract_ = reader->ReadBool(); 235 is_abstract_ = reader->ReadBool();
235 name_index_ = StringIndex(reader->ReadUInt()); 236 name_index_ = StringIndex(reader->ReadUInt());
236 source_uri_index_ = reader->ReadUInt(); 237 source_uri_index_ = reader->ReadUInt();
237 reader->set_current_script_id(source_uri_index_); 238 reader->set_current_script_id(source_uri_index_);
238 reader->record_token_position(position_); 239 reader->record_token_position(position_);
239 annotations_.ReadFromStatic<Expression>(reader); 240 annotations_.ReadFromStatic<Expression>(reader);
240 241
241 can_stream_ = annotations_.CanStream(); 242 can_stream_ = annotations_.CanStream();
(...skipping 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after
1799 Tag tag = reader->ReadTag(); 1800 Tag tag = reader->ReadTag();
1800 ASSERT(tag == kFunctionNode); 1801 ASSERT(tag == kFunctionNode);
1801 function->position_ = reader->ReadPosition(); 1802 function->position_ = reader->ReadPosition();
1802 function->end_position_ = reader->ReadPosition(); 1803 function->end_position_ = reader->ReadPosition();
1803 function->async_marker_ = 1804 function->async_marker_ =
1804 static_cast<FunctionNode::AsyncMarker>(reader->ReadByte()); 1805 static_cast<FunctionNode::AsyncMarker>(reader->ReadByte());
1805 function->dart_async_marker_ = 1806 function->dart_async_marker_ =
1806 static_cast<FunctionNode::AsyncMarker>(reader->ReadByte()); 1807 static_cast<FunctionNode::AsyncMarker>(reader->ReadByte());
1807 function->type_parameters().ReadFrom(reader); 1808 function->type_parameters().ReadFrom(reader);
1808 function->required_parameter_count_ = reader->ReadUInt(); 1809 function->required_parameter_count_ = reader->ReadUInt();
1810 reader->ReadUInt(); // total parameter count.
1809 function->positional_parameters().ReadFromStatic<VariableDeclarationImpl>( 1811 function->positional_parameters().ReadFromStatic<VariableDeclarationImpl>(
1810 reader); 1812 reader);
1811 function->named_parameters().ReadFromStatic<VariableDeclarationImpl>(reader); 1813 function->named_parameters().ReadFromStatic<VariableDeclarationImpl>(reader);
1812 function->return_type_ = DartType::ReadFrom(reader); 1814 function->return_type_ = DartType::ReadFrom(reader);
1813 1815
1814 LabelScope<ReaderHelper, BlockStack<LabeledStatement> > labels( 1816 LabelScope<ReaderHelper, BlockStack<LabeledStatement> > labels(
1815 reader->helper()); 1817 reader->helper());
1816 VariableScope<ReaderHelper> vars(reader->helper()); 1818 VariableScope<ReaderHelper> vars(reader->helper());
1817 function->body_ = reader->ReadOptional<Statement>(); 1819 function->body_ = reader->ReadOptional<Statement>();
1818 1820
(...skipping 20 matching lines...) Expand all
1839 1841
1840 kernel::Program* ReadPrecompiledKernelFromBuffer(const uint8_t* buffer, 1842 kernel::Program* ReadPrecompiledKernelFromBuffer(const uint8_t* buffer,
1841 intptr_t buffer_length) { 1843 intptr_t buffer_length) {
1842 kernel::Reader reader(buffer, buffer_length); 1844 kernel::Reader reader(buffer, buffer_length);
1843 return kernel::Program::ReadFrom(&reader); 1845 return kernel::Program::ReadFrom(&reader);
1844 } 1846 }
1845 1847
1846 1848
1847 } // namespace dart 1849 } // namespace dart
1848 #endif // !defined(DART_PRECOMPILED_RUNTIME) 1850 #endif // !defined(DART_PRECOMPILED_RUNTIME)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698