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

Side by Side Diff: runtime/vm/parser.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 #include "vm/parser.h" 5 #include "vm/parser.h"
6 #include "vm/flags.h" 6 #include "vm/flags.h"
7 7
8 #ifndef DART_PRECOMPILED_RUNTIME 8 #ifndef DART_PRECOMPILED_RUNTIME
9 9
10 #include "lib/invocation_mirror.h" 10 #include "lib/invocation_mirror.h"
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 Report::MessageF(Report::kBailout, Script::Handle(function_.script()), 228 Report::MessageF(Report::kBailout, Script::Handle(function_.script()),
229 function_.token_pos(), Report::AtLocation, 229 function_.token_pos(), Report::AtLocation,
230 "%s Bailout in %s: %s", origin, 230 "%s Bailout in %s: %s", origin,
231 String::Handle(function_.name()).ToCString(), reason); 231 String::Handle(function_.name()).ToCString(), reason);
232 UNREACHABLE(); 232 UNREACHABLE();
233 } 233 }
234 234
235 235
236 kernel::ScopeBuildingResult* ParsedFunction::EnsureKernelScopes() { 236 kernel::ScopeBuildingResult* ParsedFunction::EnsureKernelScopes() {
237 if (kernel_scopes_ == NULL) { 237 if (kernel_scopes_ == NULL) {
238 kernel::TreeNode* node = NULL; 238 intptr_t kernel_offset = function().kernel_offset();
239 if (function().kernel_function() != NULL) { 239 Script& script = Script::Handle(Z, function().script());
240 node = static_cast<kernel::TreeNode*>(function().kernel_function()); 240 kernel::StreamingScopeBuilder builder(
241 } 241 this, kernel_offset, script.kernel_data(), script.kernel_data_size());
242 242 kernel_scopes_ = builder.BuildScopes();
243 intptr_t kernel_offset = -1;
244 const uint8_t* kernel_data = NULL;
245 intptr_t kernel_data_size = 0;
246 if (node != NULL) {
247 kernel::TreeNode* library_node = node;
248 if (node != NULL) {
249 const Function* parent = &function();
250 while (true) {
251 library_node =
252 static_cast<kernel::TreeNode*>(parent->kernel_function());
253 while (library_node != NULL && !library_node->IsLibrary()) {
254 if (library_node->IsMember()) {
255 library_node = kernel::Member::Cast(library_node)->parent();
256 } else if (library_node->IsClass()) {
257 library_node = kernel::Class::Cast(library_node)->parent();
258 break;
259 } else {
260 library_node = NULL;
261 break;
262 }
263 }
264 if (library_node != NULL) break;
265 parent = &Function::Handle(parent->parent_function());
266 }
267 }
268 if (library_node != NULL && library_node->IsLibrary()) {
269 kernel::Library* library = kernel::Library::Cast(library_node);
270 kernel_offset = node->kernel_offset();
271 kernel_data = library->kernel_data();
272 kernel_data_size = library->kernel_data_size();
273 }
274 }
275
276 kernel::StreamingScopeBuilder builder2(this, kernel_offset, kernel_data,
277 kernel_data_size);
278 kernel_scopes_ = builder2.BuildScopes();
279 } 243 }
280 return kernel_scopes_; 244 return kernel_scopes_;
281 } 245 }
282 246
283 247
284 LocalVariable* ParsedFunction::EnsureExpressionTemp() { 248 LocalVariable* ParsedFunction::EnsureExpressionTemp() {
285 if (!has_expression_temp_var()) { 249 if (!has_expression_temp_var()) {
286 LocalVariable* temp = 250 LocalVariable* temp =
287 new (Z) LocalVariable(function_.token_pos(), function_.token_pos(), 251 new (Z) LocalVariable(function_.token_pos(), function_.token_pos(),
288 Symbols::ExprTemp(), Object::dynamic_type()); 252 Symbols::ExprTemp(), Object::dynamic_type());
(...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after
1616 1580
1617 const Function& parent = Function::Handle(func.parent_function()); 1581 const Function& parent = Function::Handle(func.parent_function());
1618 if (parent.IsImplicitSetterFunction()) { 1582 if (parent.IsImplicitSetterFunction()) {
1619 const TokenPosition ident_pos = func.token_pos(); 1583 const TokenPosition ident_pos = func.token_pos();
1620 ASSERT(IsIdentifier()); 1584 ASSERT(IsIdentifier());
1621 params.AddFinalParameter(ident_pos, &Symbols::Value(), 1585 params.AddFinalParameter(ident_pos, &Symbols::Value(),
1622 &Object::dynamic_type()); 1586 &Object::dynamic_type());
1623 ASSERT(func.num_fixed_parameters() == 2); // closure, value. 1587 ASSERT(func.num_fixed_parameters() == 2); // closure, value.
1624 } else if (!parent.IsGetterFunction() && !parent.IsImplicitGetterFunction()) { 1588 } else if (!parent.IsGetterFunction() && !parent.IsImplicitGetterFunction()) {
1625 // NOTE: For the `kernel -> flowgraph` we don't use the parser. 1589 // NOTE: For the `kernel -> flowgraph` we don't use the parser.
1626 if (parent.kernel_function() == NULL) { 1590 if (parent.kernel_offset() <= 0) {
1627 SkipFunctionPreamble(); 1591 SkipFunctionPreamble();
1628 const bool use_function_type_syntax = false; 1592 const bool use_function_type_syntax = false;
1629 const bool allow_explicit_default_values = true; 1593 const bool allow_explicit_default_values = true;
1630 const bool evaluate_metadata = false; 1594 const bool evaluate_metadata = false;
1631 ParseFormalParameterList(use_function_type_syntax, 1595 ParseFormalParameterList(use_function_type_syntax,
1632 allow_explicit_default_values, evaluate_metadata, 1596 allow_explicit_default_values, evaluate_metadata,
1633 &params); 1597 &params);
1634 FinalizeFormalParameterTypes(&params); 1598 FinalizeFormalParameterTypes(&params);
1635 SetupDefaultsForOptionalParams(params); 1599 SetupDefaultsForOptionalParams(params);
1636 } 1600 }
(...skipping 13595 matching lines...) Expand 10 before | Expand all | Expand 10 after
15232 const ArgumentListNode& function_args, 15196 const ArgumentListNode& function_args,
15233 const LocalVariable* temp_for_last_arg, 15197 const LocalVariable* temp_for_last_arg,
15234 bool is_super_invocation) { 15198 bool is_super_invocation) {
15235 UNREACHABLE(); 15199 UNREACHABLE();
15236 return NULL; 15200 return NULL;
15237 } 15201 }
15238 15202
15239 } // namespace dart 15203 } // namespace dart
15240 15204
15241 #endif // DART_PRECOMPILED_RUNTIME 15205 #endif // DART_PRECOMPILED_RUNTIME
OLDNEW
« runtime/vm/kernel_to_il.cc ('K') | « runtime/vm/object.cc ('k') | runtime/vm/precompiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698