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

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

Issue 10910119: Implement new optional parameters syntax in the vm (issue 4290). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/flow_graph_compiler_ia32.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/globals.h" // Needed here to get TARGET_ARCH_XXX. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_XXX.
6 6
7 #include "vm/flow_graph_compiler.h" 7 #include "vm/flow_graph_compiler.h"
8 8
9 #include "vm/dart_entry.h" 9 #include "vm/dart_entry.h"
10 #include "vm/debugger.h" 10 #include "vm/debugger.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 intptr_t slot_ix) { 43 intptr_t slot_ix) {
44 builder->AddReturnAddressBefore(function, deopt_id(), slot_ix); 44 builder->AddReturnAddressBefore(function, deopt_id(), slot_ix);
45 } 45 }
46 46
47 47
48 RawDeoptInfo* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler) { 48 RawDeoptInfo* CompilerDeoptInfo::CreateDeoptInfo(FlowGraphCompiler* compiler) {
49 if (deoptimization_env_ == NULL) return DeoptInfo::null(); 49 if (deoptimization_env_ == NULL) return DeoptInfo::null();
50 const Function& function = compiler->parsed_function().function(); 50 const Function& function = compiler->parsed_function().function();
51 // For functions with optional arguments, all incoming are copied to local 51 // For functions with optional arguments, all incoming are copied to local
52 // area below FP, deoptimization environment does not track them. 52 // area below FP, deoptimization environment does not track them.
53 const intptr_t num_args = (function.num_optional_parameters() > 0) ? 53 const intptr_t num_args =
54 0 : function.num_fixed_parameters(); 54 function.HasOptionalParameters() ? 0 : function.num_fixed_parameters();
55 const intptr_t fixed_parameter_count = 55 const intptr_t fixed_parameter_count =
56 deoptimization_env_->fixed_parameter_count(); 56 deoptimization_env_->fixed_parameter_count();
57 DeoptInfoBuilder builder(compiler->object_table(), num_args); 57 DeoptInfoBuilder builder(compiler->object_table(), num_args);
58 58
59 intptr_t slot_ix = 0; 59 intptr_t slot_ix = 0;
60 BuildReturnAddress(&builder, function, slot_ix++); 60 BuildReturnAddress(&builder, function, slot_ix++);
61 61
62 // All locals between TOS and PC-marker. 62 // All locals between TOS and PC-marker.
63 const GrowableArray<Value*>& values = deoptimization_env_->values(); 63 const GrowableArray<Value*>& values = deoptimization_env_->values();
64 64
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 for (int i = 0; i < block_info_.length(); ++i) { 121 for (int i = 0; i < block_info_.length(); ++i) {
122 ASSERT(!block_info_[i]->label.IsLinked()); 122 ASSERT(!block_info_[i]->label.IsLinked());
123 ASSERT(!block_info_[i]->label.HasNear()); 123 ASSERT(!block_info_[i]->label.HasNear());
124 } 124 }
125 } 125 }
126 126
127 127
128 bool FlowGraphCompiler::IsLeaf() const { 128 bool FlowGraphCompiler::IsLeaf() const {
129 return is_dart_leaf_ && 129 return is_dart_leaf_ &&
130 !parsed_function_.function().IsClosureFunction() && 130 !parsed_function_.function().IsClosureFunction() &&
131 (parsed_function().copied_parameter_count() == 0); 131 (parsed_function().num_copied_params() == 0);
132 } 132 }
133 133
134 134
135 bool FlowGraphCompiler::HasFinally() const { 135 bool FlowGraphCompiler::HasFinally() const {
136 return parsed_function().function().has_finally(); 136 return parsed_function().function().has_finally();
137 } 137 }
138 138
139 139
140 void FlowGraphCompiler::InitCompiler() { 140 void FlowGraphCompiler::InitCompiler() {
141 pc_descriptors_list_ = new DescriptorList(64); 141 pc_descriptors_list_ = new DescriptorList(64);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 const Error& error = Error::Handle( 189 const Error& error = Error::Handle(
190 LanguageError::New(String::Handle(String::New(chars)))); 190 LanguageError::New(String::Handle(String::New(chars))));
191 Isolate::Current()->long_jump_base()->Jump(1, error); 191 Isolate::Current()->long_jump_base()->Jump(1, error);
192 } 192 }
193 193
194 194
195 intptr_t FlowGraphCompiler::StackSize() const { 195 intptr_t FlowGraphCompiler::StackSize() const {
196 if (is_optimizing_) { 196 if (is_optimizing_) {
197 return block_order_[0]->AsGraphEntry()->spill_slot_count(); 197 return block_order_[0]->AsGraphEntry()->spill_slot_count();
198 } else { 198 } else {
199 return parsed_function_.stack_local_count() + 199 return parsed_function_.num_stack_locals() +
200 parsed_function_.copied_parameter_count(); 200 parsed_function_.num_copied_params();
201 } 201 }
202 } 202 }
203 203
204 204
205 Label* FlowGraphCompiler::GetBlockLabel( 205 Label* FlowGraphCompiler::GetBlockLabel(
206 BlockEntryInstr* block_entry) const { 206 BlockEntryInstr* block_entry) const {
207 intptr_t block_index = block_entry->postorder_number(); 207 intptr_t block_index = block_entry->postorder_number();
208 return &block_info_[block_index]->label; 208 return &block_info_[block_index]->label;
209 } 209 }
210 210
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 case ABOVE: return unsigned_left > unsigned_right; 843 case ABOVE: return unsigned_left > unsigned_right;
844 case ABOVE_EQUAL: return unsigned_left >= unsigned_right; 844 case ABOVE_EQUAL: return unsigned_left >= unsigned_right;
845 default: 845 default:
846 UNIMPLEMENTED(); 846 UNIMPLEMENTED();
847 return false; 847 return false;
848 } 848 }
849 } 849 }
850 850
851 851
852 } // namespace dart 852 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/flow_graph_compiler_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698