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

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

Issue 2931813002: [kernel] Stream kernel_reader (Closed)
Patch Set: Feedback 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
« no previous file with comments | « runtime/vm/kernel.cc ('k') | runtime/vm/kernel_binary_flowgraph.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 sources_[i].source_code_ = string_buffer; 167 sources_[i].source_code_ = string_buffer;
168 sources_[i].source_code_size_ = length; 168 sources_[i].source_code_size_ = length;
169 sources_[i].line_starts_ = line_starts; 169 sources_[i].line_starts_ = line_starts;
170 sources_[i].line_count_ = line_count; 170 sources_[i].line_count_ = line_count;
171 } 171 }
172 } 172 }
173 173
174 174
175 Library* Library::ReadFrom(Reader* reader) { 175 Library* Library::ReadFrom(Reader* reader) {
176 TRACE_READ_OFFSET(); 176 TRACE_READ_OFFSET();
177 kernel_offset_ = reader->offset(); // no tag.
177 int flags = reader->ReadFlags(); 178 int flags = reader->ReadFlags();
178 ASSERT(flags == 0); // external libraries not supported 179 ASSERT(flags == 0); // external libraries not supported
179 kernel_data_ = reader->buffer(); 180 kernel_data_ = reader->buffer();
180 kernel_data_size_ = reader->size(); 181 kernel_data_size_ = reader->size();
181 182
182 canonical_name_ = reader->ReadCanonicalNameReference(); 183 canonical_name_ = reader->ReadCanonicalNameReference();
183 name_index_ = StringIndex(reader->ReadUInt()); 184 name_index_ = StringIndex(reader->ReadUInt());
184 import_uri_index_ = reader->CanonicalNameString(canonical_name_); 185 import_uri_index_ = reader->CanonicalNameString(canonical_name_);
185 source_uri_index_ = reader->ReadUInt(); 186 source_uri_index_ = reader->ReadUInt();
186 reader->set_current_script_id(source_uri_index_); 187 reader->set_current_script_id(source_uri_index_);
(...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after
1599 type->return_type_ = DartType::ReadFrom(reader); 1600 type->return_type_ = DartType::ReadFrom(reader);
1600 return type; 1601 return type;
1601 } 1602 }
1602 1603
1603 1604
1604 TypeParameterType* TypeParameterType::ReadFrom(Reader* reader) { 1605 TypeParameterType* TypeParameterType::ReadFrom(Reader* reader) {
1605 TRACE_READ_OFFSET(); 1606 TRACE_READ_OFFSET();
1606 TypeParameterType* type = new TypeParameterType(); 1607 TypeParameterType* type = new TypeParameterType();
1607 type->parameter_ = 1608 type->parameter_ =
1608 reader->helper()->type_parameters().Lookup(reader->ReadUInt()); 1609 reader->helper()->type_parameters().Lookup(reader->ReadUInt());
1609 reader->ReadUInt(); // binary offset of parameter 1610 reader->ReadUInt(); // binary offset of parameter list
1611 reader->ReadUInt(); // index of parameter
1610 // There is an optional promoted bound, currently ignored. 1612 // There is an optional promoted bound, currently ignored.
1611 delete reader->ReadOptional<DartType>(); 1613 delete reader->ReadOptional<DartType>();
1612 return type; 1614 return type;
1613 } 1615 }
1614 1616
1615 1617
1616 VectorType* VectorType::ReadFrom(Reader* reader) { 1618 VectorType* VectorType::ReadFrom(Reader* reader) {
1617 TRACE_READ_OFFSET(); 1619 TRACE_READ_OFFSET();
1618 VectorType* type = new VectorType(); 1620 VectorType* type = new VectorType();
1619 return type; 1621 return type;
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1717 1719
1718 kernel::Program* ReadPrecompiledKernelFromBuffer(const uint8_t* buffer, 1720 kernel::Program* ReadPrecompiledKernelFromBuffer(const uint8_t* buffer,
1719 intptr_t buffer_length) { 1721 intptr_t buffer_length) {
1720 kernel::Reader reader(buffer, buffer_length); 1722 kernel::Reader reader(buffer, buffer_length);
1721 return kernel::Program::ReadFrom(&reader); 1723 return kernel::Program::ReadFrom(&reader);
1722 } 1724 }
1723 1725
1724 1726
1725 } // namespace dart 1727 } // namespace dart
1726 #endif // !defined(DART_PRECOMPILED_RUNTIME) 1728 #endif // !defined(DART_PRECOMPILED_RUNTIME)
OLDNEW
« no previous file with comments | « runtime/vm/kernel.cc ('k') | runtime/vm/kernel_binary_flowgraph.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698