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

Unified Diff: runtime/vm/parser.cc

Issue 2941483003: Revert "[kernel] Stream everything. Replace .kernel_function with .kernel_offset" (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/precompiler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index 6f639387c126ac232945dfea4ccc80cac1915855..c3f39cc83debf3d225c75efb18ff2879ace8263d 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -235,11 +235,47 @@ void ParsedFunction::Bailout(const char* origin, const char* reason) const {
kernel::ScopeBuildingResult* ParsedFunction::EnsureKernelScopes() {
if (kernel_scopes_ == NULL) {
- intptr_t kernel_offset = function().kernel_offset();
- Script& script = Script::Handle(Z, function().script());
- kernel::StreamingScopeBuilder builder(
- this, kernel_offset, script.kernel_data(), script.kernel_data_size());
- kernel_scopes_ = builder.BuildScopes();
+ kernel::TreeNode* node = NULL;
+ if (function().kernel_function() != NULL) {
+ node = static_cast<kernel::TreeNode*>(function().kernel_function());
+ }
+
+ intptr_t kernel_offset = -1;
+ const uint8_t* kernel_data = NULL;
+ intptr_t kernel_data_size = 0;
+ if (node != NULL) {
+ kernel::TreeNode* library_node = node;
+ if (node != NULL) {
+ const Function* parent = &function();
+ while (true) {
+ library_node =
+ static_cast<kernel::TreeNode*>(parent->kernel_function());
+ while (library_node != NULL && !library_node->IsLibrary()) {
+ if (library_node->IsMember()) {
+ library_node = kernel::Member::Cast(library_node)->parent();
+ } else if (library_node->IsClass()) {
+ library_node = kernel::Class::Cast(library_node)->parent();
+ break;
+ } else {
+ library_node = NULL;
+ break;
+ }
+ }
+ if (library_node != NULL) break;
+ parent = &Function::Handle(parent->parent_function());
+ }
+ }
+ if (library_node != NULL && library_node->IsLibrary()) {
+ kernel::Library* library = kernel::Library::Cast(library_node);
+ kernel_offset = node->kernel_offset();
+ kernel_data = library->kernel_data();
+ kernel_data_size = library->kernel_data_size();
+ }
+ }
+
+ kernel::StreamingScopeBuilder builder2(this, kernel_offset, kernel_data,
+ kernel_data_size);
+ kernel_scopes_ = builder2.BuildScopes();
}
return kernel_scopes_;
}
@@ -1628,7 +1664,7 @@ SequenceNode* Parser::ParseImplicitClosure(const Function& func) {
ASSERT(func.num_fixed_parameters() == 2); // closure, value.
} else if (!parent.IsGetterFunction() && !parent.IsImplicitGetterFunction()) {
// NOTE: For the `kernel -> flowgraph` we don't use the parser.
- if (parent.kernel_offset() <= 0) {
+ if (parent.kernel_function() == NULL) {
SkipFunctionPreamble();
const bool use_function_type_syntax = false;
const bool allow_explicit_default_values = true;
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/precompiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698