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 #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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 type_parameters_.ReadFrom(reader); | 250 type_parameters_.ReadFrom(reader); |
251 type_ = DartType::ReadFrom(reader); | 251 type_ = DartType::ReadFrom(reader); |
252 | 252 |
253 return this; | 253 return this; |
254 } | 254 } |
255 | 255 |
256 | 256 |
257 Class* Class::ReadFrom(Reader* reader) { | 257 Class* Class::ReadFrom(Reader* reader) { |
258 TRACE_READ_OFFSET(); | 258 TRACE_READ_OFFSET(); |
259 | 259 |
260 kernel_offset_ = reader->offset() - 1; // -1 to include tag byte. | |
261 canonical_name_ = reader->ReadCanonicalNameReference(); | 260 canonical_name_ = reader->ReadCanonicalNameReference(); |
262 position_ = reader->ReadPosition(false); | 261 position_ = reader->ReadPosition(false); |
263 is_abstract_ = reader->ReadBool(); | 262 is_abstract_ = reader->ReadBool(); |
264 name_index_ = StringIndex(reader->ReadUInt()); | 263 name_index_ = StringIndex(reader->ReadUInt()); |
265 source_uri_index_ = reader->ReadUInt(); | 264 source_uri_index_ = reader->ReadUInt(); |
266 reader->set_current_script_id(source_uri_index_); | 265 reader->set_current_script_id(source_uri_index_); |
267 reader->record_token_position(position_); | 266 reader->record_token_position(position_); |
268 annotations_.ReadFromStatic<Expression>(reader); | 267 annotations_.ReadFromStatic<Expression>(reader); |
269 | 268 |
270 can_stream_ = annotations_.CanStream(); | 269 can_stream_ = annotations_.CanStream(); |
(...skipping 1566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1837 function->kernel_offset_ = reader->offset(); | 1836 function->kernel_offset_ = reader->offset(); |
1838 Tag tag = reader->ReadTag(); | 1837 Tag tag = reader->ReadTag(); |
1839 ASSERT(tag == kFunctionNode); | 1838 ASSERT(tag == kFunctionNode); |
1840 function->position_ = reader->ReadPosition(); | 1839 function->position_ = reader->ReadPosition(); |
1841 function->end_position_ = reader->ReadPosition(); | 1840 function->end_position_ = reader->ReadPosition(); |
1842 function->async_marker_ = | 1841 function->async_marker_ = |
1843 static_cast<FunctionNode::AsyncMarker>(reader->ReadByte()); | 1842 static_cast<FunctionNode::AsyncMarker>(reader->ReadByte()); |
1844 function->dart_async_marker_ = | 1843 function->dart_async_marker_ = |
1845 static_cast<FunctionNode::AsyncMarker>(reader->ReadByte()); | 1844 static_cast<FunctionNode::AsyncMarker>(reader->ReadByte()); |
1846 function->type_parameters().ReadFrom(reader); | 1845 function->type_parameters().ReadFrom(reader); |
1847 reader->ReadUInt(); // total parameter count. | |
1848 function->required_parameter_count_ = reader->ReadUInt(); | 1846 function->required_parameter_count_ = reader->ReadUInt(); |
1849 function->positional_parameters().ReadFromStatic<VariableDeclarationImpl>( | 1847 function->positional_parameters().ReadFromStatic<VariableDeclarationImpl>( |
1850 reader); | 1848 reader); |
1851 function->named_parameters().ReadFromStatic<VariableDeclarationImpl>(reader); | 1849 function->named_parameters().ReadFromStatic<VariableDeclarationImpl>(reader); |
1852 function->return_type_ = DartType::ReadFrom(reader); | 1850 function->return_type_ = DartType::ReadFrom(reader); |
1853 | 1851 |
1854 LabelScope<ReaderHelper, BlockStack<LabeledStatement> > labels( | 1852 LabelScope<ReaderHelper, BlockStack<LabeledStatement> > labels( |
1855 reader->helper()); | 1853 reader->helper()); |
1856 VariableScope<ReaderHelper> vars(reader->helper()); | 1854 VariableScope<ReaderHelper> vars(reader->helper()); |
1857 function->body_ = reader->ReadOptional<Statement>(); | 1855 function->body_ = reader->ReadOptional<Statement>(); |
(...skipping 21 matching lines...) Expand all Loading... |
1879 | 1877 |
1880 kernel::Program* ReadPrecompiledKernelFromBuffer(const uint8_t* buffer, | 1878 kernel::Program* ReadPrecompiledKernelFromBuffer(const uint8_t* buffer, |
1881 intptr_t buffer_length) { | 1879 intptr_t buffer_length) { |
1882 kernel::Reader reader(buffer, buffer_length); | 1880 kernel::Reader reader(buffer, buffer_length); |
1883 return kernel::Program::ReadFrom(&reader); | 1881 return kernel::Program::ReadFrom(&reader); |
1884 } | 1882 } |
1885 | 1883 |
1886 | 1884 |
1887 } // namespace dart | 1885 } // namespace dart |
1888 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 1886 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
OLD | NEW |