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

Side by Side Diff: runtime/vm/compiler.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 unified diff | Download patch
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/flow_graph_inliner.cc » ('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) 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/compiler.h" 5 #include "vm/compiler.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 8
9 #include "vm/ast_printer.h" 9 #include "vm/ast_printer.h"
10 #include "vm/block_scheduler.h" 10 #include "vm/block_scheduler.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 DECLARE_FLAG(bool, huge_method_cutoff_in_code_size); 108 DECLARE_FLAG(bool, huge_method_cutoff_in_code_size);
109 DECLARE_FLAG(bool, trace_failed_optimization_attempts); 109 DECLARE_FLAG(bool, trace_failed_optimization_attempts);
110 DECLARE_FLAG(bool, trace_irregexp); 110 DECLARE_FLAG(bool, trace_irregexp);
111 111
112 112
113 #ifndef DART_PRECOMPILED_RUNTIME 113 #ifndef DART_PRECOMPILED_RUNTIME
114 114
115 115
116 bool UseKernelFrontEndFor(ParsedFunction* parsed_function) { 116 bool UseKernelFrontEndFor(ParsedFunction* parsed_function) {
117 const Function& function = parsed_function->function(); 117 const Function& function = parsed_function->function();
118 return (function.kernel_offset() > 0) || 118 return (function.kernel_function() != NULL) ||
119 (function.kind() == RawFunction::kNoSuchMethodDispatcher) || 119 (function.kind() == RawFunction::kNoSuchMethodDispatcher) ||
120 (function.kind() == RawFunction::kInvokeFieldDispatcher); 120 (function.kind() == RawFunction::kInvokeFieldDispatcher);
121 } 121 }
122 122
123 123
124 void DartCompilationPipeline::ParseFunction(ParsedFunction* parsed_function) { 124 void DartCompilationPipeline::ParseFunction(ParsedFunction* parsed_function) {
125 if (!UseKernelFrontEndFor(parsed_function)) { 125 if (!UseKernelFrontEndFor(parsed_function)) {
126 Parser::ParseFunction(parsed_function); 126 Parser::ParseFunction(parsed_function);
127 parsed_function->AllocateVariables(); 127 parsed_function->AllocateVariables();
128 } 128 }
129 } 129 }
130 130
131 131
132 FlowGraph* DartCompilationPipeline::BuildFlowGraph( 132 FlowGraph* DartCompilationPipeline::BuildFlowGraph(
133 Zone* zone, 133 Zone* zone,
134 ParsedFunction* parsed_function, 134 ParsedFunction* parsed_function,
135 const ZoneGrowableArray<const ICData*>& ic_data_array, 135 const ZoneGrowableArray<const ICData*>& ic_data_array,
136 intptr_t osr_id) { 136 intptr_t osr_id) {
137 if (UseKernelFrontEndFor(parsed_function)) { 137 if (UseKernelFrontEndFor(parsed_function)) {
138 kernel::FlowGraphBuilder builder( 138 kernel::TreeNode* node = static_cast<kernel::TreeNode*>(
139 parsed_function->function().kernel_offset(), parsed_function, 139 parsed_function->function().kernel_function());
140 ic_data_array, 140 kernel::FlowGraphBuilder builder(node, parsed_function, ic_data_array,
141 /* not building var desc */ NULL, 141 /* not building var desc */ NULL,
142 /* not inlining */ NULL, osr_id); 142 /* not inlining */ NULL, osr_id);
143 FlowGraph* graph = builder.BuildGraph(); 143 FlowGraph* graph = builder.BuildGraph();
144 ASSERT(graph != NULL); 144 ASSERT(graph != NULL);
145 return graph; 145 return graph;
146 } 146 }
147 FlowGraphBuilder builder(*parsed_function, ic_data_array, 147 FlowGraphBuilder builder(*parsed_function, ic_data_array,
148 /* not building var desc */ NULL, 148 /* not building var desc */ NULL,
149 /* not inlining */ NULL, osr_id); 149 /* not inlining */ NULL, osr_id);
150 150
151 return builder.BuildGraph(); 151 return builder.BuildGraph();
152 } 152 }
(...skipping 1437 matching lines...) Expand 10 before | Expand all | Expand 10 after
1590 // if state changed while compiling in background. 1590 // if state changed while compiling in background.
1591 const intptr_t prev_deopt_id = Thread::Current()->deopt_id(); 1591 const intptr_t prev_deopt_id = Thread::Current()->deopt_id();
1592 Thread::Current()->set_deopt_id(0); 1592 Thread::Current()->set_deopt_id(0);
1593 LongJumpScope jump; 1593 LongJumpScope jump;
1594 if (setjmp(*jump.Set()) == 0) { 1594 if (setjmp(*jump.Set()) == 0) {
1595 ZoneGrowableArray<const ICData*>* ic_data_array = 1595 ZoneGrowableArray<const ICData*>* ic_data_array =
1596 new ZoneGrowableArray<const ICData*>(); 1596 new ZoneGrowableArray<const ICData*>();
1597 ZoneGrowableArray<intptr_t>* context_level_array = 1597 ZoneGrowableArray<intptr_t>* context_level_array =
1598 new ZoneGrowableArray<intptr_t>(); 1598 new ZoneGrowableArray<intptr_t>();
1599 1599
1600 if (function.kernel_offset() <= 0) { 1600 if (!UseKernelFrontEndFor(parsed_function)) {
1601 Parser::ParseFunction(parsed_function); 1601 Parser::ParseFunction(parsed_function);
1602 parsed_function->AllocateVariables(); 1602 parsed_function->AllocateVariables();
1603 FlowGraphBuilder builder( 1603 FlowGraphBuilder builder(
1604 *parsed_function, *ic_data_array, context_level_array, 1604 *parsed_function, *ic_data_array, context_level_array,
1605 /* not inlining */ NULL, Compiler::kNoOSRDeoptId); 1605 /* not inlining */ NULL, Compiler::kNoOSRDeoptId);
1606 builder.BuildGraph(); 1606 builder.BuildGraph();
1607 } else { 1607 } else {
1608 parsed_function->EnsureKernelScopes(); 1608 parsed_function->EnsureKernelScopes();
1609 kernel::TreeNode* node = static_cast<kernel::TreeNode*>(
1610 parsed_function->function().kernel_function());
1609 kernel::FlowGraphBuilder builder( 1611 kernel::FlowGraphBuilder builder(
1610 parsed_function->function().kernel_offset(), parsed_function, 1612 node, parsed_function, *ic_data_array, context_level_array,
1611 *ic_data_array, context_level_array,
1612 /* not inlining */ NULL, Compiler::kNoOSRDeoptId); 1613 /* not inlining */ NULL, Compiler::kNoOSRDeoptId);
1613 builder.BuildGraph(); 1614 builder.BuildGraph();
1614 } 1615 }
1615 1616
1616 const LocalVarDescriptors& var_descs = LocalVarDescriptors::Handle( 1617 const LocalVarDescriptors& var_descs = LocalVarDescriptors::Handle(
1617 parsed_function->node_sequence()->scope()->GetVarDescriptors( 1618 parsed_function->node_sequence()->scope()->GetVarDescriptors(
1618 function, context_level_array)); 1619 function, context_level_array));
1619 ASSERT(!var_descs.IsNull()); 1620 ASSERT(!var_descs.IsNull());
1620 code.set_var_descriptors(var_descs); 1621 code.set_var_descriptors(var_descs);
1621 } else { 1622 } else {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1724 tds.CopyArgument(0, "field", field.ToCString()); 1725 tds.CopyArgument(0, "field", field.ToCString());
1725 } 1726 }
1726 #endif // !defined(PRODUCT) 1727 #endif // !defined(PRODUCT)
1727 1728
1728 StackZone stack_zone(thread); 1729 StackZone stack_zone(thread);
1729 Zone* zone = stack_zone.GetZone(); 1730 Zone* zone = stack_zone.GetZone();
1730 ParsedFunction* parsed_function; 1731 ParsedFunction* parsed_function;
1731 1732
1732 // Create a one-time-use function to evaluate the initializer and invoke 1733 // Create a one-time-use function to evaluate the initializer and invoke
1733 // it immediately. 1734 // it immediately.
1734 if (field.kernel_offset() > 0) { 1735 if (field.kernel_field() != NULL) {
1735 parsed_function = kernel::ParseStaticFieldInitializer(zone, field); 1736 parsed_function = kernel::ParseStaticFieldInitializer(zone, field);
1736 } else { 1737 } else {
1737 parsed_function = Parser::ParseStaticFieldInitializer(field); 1738 parsed_function = Parser::ParseStaticFieldInitializer(field);
1738 parsed_function->AllocateVariables(); 1739 parsed_function->AllocateVariables();
1739 } 1740 }
1740 1741
1741 // Non-optimized code generator. 1742 // Non-optimized code generator.
1742 DartCompilationPipeline pipeline; 1743 DartCompilationPipeline pipeline;
1743 CompileParsedFunctionHelper helper(parsed_function, false, kNoOSRDeoptId); 1744 CompileParsedFunctionHelper helper(parsed_function, false, kNoOSRDeoptId);
1744 const Code& code = Code::Handle(helper.Compile(&pipeline)); 1745 const Code& code = Code::Handle(helper.Compile(&pipeline));
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
2332 2333
2333 2334
2334 bool BackgroundCompiler::IsDisabled() { 2335 bool BackgroundCompiler::IsDisabled() {
2335 UNREACHABLE(); 2336 UNREACHABLE();
2336 return true; 2337 return true;
2337 } 2338 }
2338 2339
2339 #endif // DART_PRECOMPILED_RUNTIME 2340 #endif // DART_PRECOMPILED_RUNTIME
2340 2341
2341 } // namespace dart 2342 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/flow_graph_inliner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698