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

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

Issue 11418046: First part of static call cleanup: store static call targets into code object, referenced by code-o… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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/debugger.cc ('k') | runtime/vm/flow_graph_compiler_ia32.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) 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 : assembler_(assembler), 137 : assembler_(assembler),
138 parsed_function_(flow_graph.parsed_function()), 138 parsed_function_(flow_graph.parsed_function()),
139 block_order_(flow_graph.reverse_postorder()), 139 block_order_(flow_graph.reverse_postorder()),
140 current_block_(NULL), 140 current_block_(NULL),
141 exception_handlers_list_(NULL), 141 exception_handlers_list_(NULL),
142 pc_descriptors_list_(NULL), 142 pc_descriptors_list_(NULL),
143 stackmap_table_builder_( 143 stackmap_table_builder_(
144 is_optimizing ? new StackmapTableBuilder() : NULL), 144 is_optimizing ? new StackmapTableBuilder() : NULL),
145 block_info_(block_order_.length()), 145 block_info_(block_order_.length()),
146 deopt_infos_(), 146 deopt_infos_(),
147 static_calls_target_table_(GrowableObjectArray::ZoneHandle(
148 GrowableObjectArray::New())),
147 is_optimizing_(is_optimizing), 149 is_optimizing_(is_optimizing),
148 may_reoptimize_(false), 150 may_reoptimize_(false),
149 bool_true_(Bool::ZoneHandle(Bool::True())), 151 bool_true_(Bool::ZoneHandle(Bool::True())),
150 bool_false_(Bool::ZoneHandle(Bool::False())), 152 bool_false_(Bool::ZoneHandle(Bool::False())),
151 double_class_(Class::ZoneHandle( 153 double_class_(Class::ZoneHandle(
152 Isolate::Current()->object_store()->double_class())), 154 Isolate::Current()->object_store()->double_class())),
153 parallel_move_resolver_(this) { 155 parallel_move_resolver_(this) {
154 ASSERT(assembler != NULL); 156 ASSERT(assembler != NULL);
155 } 157 }
156 158
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 intptr_t deopt_id, 277 intptr_t deopt_id,
276 intptr_t token_pos) { 278 intptr_t token_pos) {
277 pc_descriptors_list()->AddDescriptor(kind, 279 pc_descriptors_list()->AddDescriptor(kind,
278 assembler()->CodeSize(), 280 assembler()->CodeSize(),
279 deopt_id, 281 deopt_id,
280 token_pos, 282 token_pos,
281 CurrentTryIndex()); 283 CurrentTryIndex());
282 } 284 }
283 285
284 286
287 void FlowGraphCompiler::AddStaticCallTarget(const Function& func) {
288 ASSERT(Code::kSCallTableEntryLength == 3);
289 ASSERT(Code::kSCallTableOffsetEntry == 0);
290 static_calls_target_table_.Add(
291 Smi::Handle(Smi::New(assembler()->CodeSize())));
292 ASSERT(Code::kSCallTableFunctionEntry == 1);
293 static_calls_target_table_.Add(func);
294 ASSERT(Code::kSCallTableCodeEntry == 2);
295 static_calls_target_table_.Add(Code::Handle());
296 }
297
298
285 void FlowGraphCompiler::AddDeoptIndexAtCall(intptr_t deopt_id, 299 void FlowGraphCompiler::AddDeoptIndexAtCall(intptr_t deopt_id,
286 intptr_t token_pos) { 300 intptr_t token_pos) {
287 ASSERT(is_optimizing()); 301 ASSERT(is_optimizing());
288 CompilerDeoptInfo* info = new CompilerDeoptInfo(deopt_id, kDeoptAtCall); 302 CompilerDeoptInfo* info = new CompilerDeoptInfo(deopt_id, kDeoptAtCall);
289 ASSERT(pending_deoptimization_env_ != NULL); 303 ASSERT(pending_deoptimization_env_ != NULL);
290 info->set_deoptimization_env(pending_deoptimization_env_); 304 info->set_deoptimization_env(pending_deoptimization_env_);
291 info->set_pc_offset(assembler()->CodeSize()); 305 info->set_pc_offset(assembler()->CodeSize());
292 deopt_infos_.Add(info); 306 deopt_infos_.Add(info);
293 } 307 }
294 308
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 Smi& reason = Smi::Handle(); 403 Smi& reason = Smi::Handle();
390 for (intptr_t i = 0; i < deopt_infos_.length(); i++) { 404 for (intptr_t i = 0; i < deopt_infos_.length(); i++) {
391 offset = Smi::New(deopt_infos_[i]->pc_offset()); 405 offset = Smi::New(deopt_infos_[i]->pc_offset());
392 info = deopt_infos_[i]->CreateDeoptInfo(this, &builder); 406 info = deopt_infos_[i]->CreateDeoptInfo(this, &builder);
393 reason = Smi::New(deopt_infos_[i]->reason()); 407 reason = Smi::New(deopt_infos_[i]->reason());
394 DeoptTable::SetEntry(array, i, offset, info, reason); 408 DeoptTable::SetEntry(array, i, offset, info, reason);
395 } 409 }
396 code.set_deopt_info_array(array); 410 code.set_deopt_info_array(array);
397 const Array& object_array = 411 const Array& object_array =
398 Array::Handle(Array::MakeArray(builder.object_table())); 412 Array::Handle(Array::MakeArray(builder.object_table()));
413 ASSERT(code.object_table() == Array::null());
399 code.set_object_table(object_array); 414 code.set_object_table(object_array);
400 } 415 }
401 416
402 417
403 void FlowGraphCompiler::FinalizeStackmaps(const Code& code) { 418 void FlowGraphCompiler::FinalizeStackmaps(const Code& code) {
404 if (stackmap_table_builder_ == NULL) { 419 if (stackmap_table_builder_ == NULL) {
405 // The unoptimizing compiler has no stack maps. 420 // The unoptimizing compiler has no stack maps.
406 code.set_stackmaps(Array::Handle()); 421 code.set_stackmaps(Array::Handle());
407 } else { 422 } else {
408 // Finalize the stack map array and add it to the code object. 423 // Finalize the stack map array and add it to the code object.
(...skipping 10 matching lines...) Expand all
419 parsed_function_.function())); 434 parsed_function_.function()));
420 code.set_var_descriptors(var_descs); 435 code.set_var_descriptors(var_descs);
421 } 436 }
422 437
423 438
424 void FlowGraphCompiler::FinalizeComments(const Code& code) { 439 void FlowGraphCompiler::FinalizeComments(const Code& code) {
425 code.set_comments(assembler()->GetCodeComments()); 440 code.set_comments(assembler()->GetCodeComments());
426 } 441 }
427 442
428 443
444 void FlowGraphCompiler::FinalizeStaticCallTargetsTable(const Code& code) {
445 ASSERT(code.static_calls_target_table() == Array::null());
446 code.set_static_calls_target_table(
447 Array::Handle(Array::MakeArray(static_calls_target_table_)));
448 }
449
450
429 // Returns 'true' if code generation for this function is complete, i.e., 451 // Returns 'true' if code generation for this function is complete, i.e.,
430 // no fall-through to regular code is needed. 452 // no fall-through to regular code is needed.
431 bool FlowGraphCompiler::TryIntrinsify() { 453 bool FlowGraphCompiler::TryIntrinsify() {
432 if (!CanOptimize()) return false; 454 if (!CanOptimize()) return false;
433 // Intrinsification skips arguments checks, therefore disable if in checked 455 // Intrinsification skips arguments checks, therefore disable if in checked
434 // mode. 456 // mode.
435 if (FLAG_intrinsify && !FLAG_enable_type_checks) { 457 if (FLAG_intrinsify && !FLAG_enable_type_checks) {
436 if (parsed_function().function().kind() == RawFunction::kImplicitGetter) { 458 if (parsed_function().function().kind() == RawFunction::kImplicitGetter) {
437 // An implicit getter must have a specific AST structure. 459 // An implicit getter must have a specific AST structure.
438 const SequenceNode& sequence_node = *parsed_function().node_sequence(); 460 const SequenceNode& sequence_node = *parsed_function().node_sequence();
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 ASSERT(Utils::IsInt(31, disp)); 972 ASSERT(Utils::IsInt(31, disp));
951 return FieldAddress(array, disp); 973 return FieldAddress(array, disp);
952 } 974 }
953 default: 975 default:
954 UNIMPLEMENTED(); 976 UNIMPLEMENTED();
955 return FieldAddress(SPREG, 0); 977 return FieldAddress(SPREG, 0);
956 } 978 }
957 } 979 }
958 980
959 } // namespace dart 981 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/debugger.cc ('k') | runtime/vm/flow_graph_compiler_ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698