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