Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/bit_vector.h" | 9 #include "vm/bit_vector.h" |
| 10 #include "vm/cha.h" | 10 #include "vm/cha.h" |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 418 } | 418 } |
| 419 | 419 |
| 420 | 420 |
| 421 // We collect intervals while generating code. | 421 // We collect intervals while generating code. |
| 422 struct IntervalStruct { | 422 struct IntervalStruct { |
| 423 // 'start' and 'end' are pc-offsets. | 423 // 'start' and 'end' are pc-offsets. |
| 424 intptr_t start; | 424 intptr_t start; |
| 425 intptr_t inlining_id; | 425 intptr_t inlining_id; |
| 426 IntervalStruct(intptr_t s, intptr_t id) : start(s), inlining_id(id) {} | 426 IntervalStruct(intptr_t s, intptr_t id) : start(s), inlining_id(id) {} |
| 427 void Dump() { | 427 void Dump() { |
| 428 OS::Print("start: %" Px " id: %" Pd "", start, inlining_id); | 428 ISL_Print("start: %" Px " id: %" Pd " ", start, inlining_id); |
| 429 } | 429 } |
| 430 }; | 430 }; |
| 431 | 431 |
| 432 | 432 |
| 433 void FlowGraphCompiler::VisitBlocks() { | 433 void FlowGraphCompiler::VisitBlocks() { |
| 434 CompactBlocks(); | 434 CompactBlocks(); |
| 435 const ZoneGrowableArray<BlockEntryInstr*>* loop_headers = NULL; | 435 const ZoneGrowableArray<BlockEntryInstr*>* loop_headers = NULL; |
| 436 if (Assembler::EmittingComments()) { | 436 if (Assembler::EmittingComments()) { |
| 437 // 'loop_headers' were cleared, recompute. | 437 // 'loop_headers' were cleared, recompute. |
| 438 loop_headers = flow_graph().ComputeLoops(); | 438 loop_headers = flow_graph().ComputeLoops(); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 508 #if defined(DEBUG) | 508 #if defined(DEBUG) |
| 509 ASSERT(is_optimizing() || FrameStateIsSafeToCall()); | 509 ASSERT(is_optimizing() || FrameStateIsSafeToCall()); |
| 510 #endif | 510 #endif |
| 511 } | 511 } |
| 512 | 512 |
| 513 if (inline_id_to_function_.length() > max_inlining_id + 1) { | 513 if (inline_id_to_function_.length() > max_inlining_id + 1) { |
| 514 // TODO(srdjan): Some inlined function can disappear, | 514 // TODO(srdjan): Some inlined function can disappear, |
| 515 // truncate 'inline_id_to_function_'. | 515 // truncate 'inline_id_to_function_'. |
| 516 } | 516 } |
| 517 | 517 |
| 518 LogBlock lb(Isolate::Current()); | |
| 518 if (is_optimizing()) { | 519 if (is_optimizing()) { |
| 519 intervals.Add(IntervalStruct(prev_offset, prev_inlining_id)); | 520 intervals.Add(IntervalStruct(prev_offset, prev_inlining_id)); |
| 520 inlined_code_intervals_ = | 521 inlined_code_intervals_ = |
| 521 Array::New(intervals.length() * Code::kInlIntNumEntries, Heap::kOld); | 522 Array::New(intervals.length() * Code::kInlIntNumEntries, Heap::kOld); |
| 522 Smi& start_h = Smi::Handle(); | 523 Smi& start_h = Smi::Handle(); |
| 523 Smi& caller_inline_id = Smi::Handle(); | 524 Smi& caller_inline_id = Smi::Handle(); |
| 524 Smi& inline_id = Smi::Handle(); | 525 Smi& inline_id = Smi::Handle(); |
| 525 for (intptr_t i = 0; i < intervals.length(); i++) { | 526 for (intptr_t i = 0; i < intervals.length(); i++) { |
| 526 if (FLAG_trace_inlining_intervals && is_optimizing()) { | 527 if (false && FLAG_trace_inlining_intervals && is_optimizing()) { |
|
srdjan
2015/08/03 19:03:36
remove false.
| |
| 527 const Function* function = | 528 const Function* function = |
| 528 inline_id_to_function_.At(intervals[i].inlining_id); | 529 inline_id_to_function_.At(intervals[i].inlining_id); |
| 529 intervals[i].Dump(); | 530 intervals[i].Dump(); |
| 530 OS::Print(" %s parent %" Pd "\n", | 531 ISL_Print(" %s parent %" Pd "\n", |
| 531 function->ToQualifiedCString(), | 532 function->ToQualifiedCString(), |
| 532 caller_inline_id_[intervals[i].inlining_id]); | 533 caller_inline_id_[intervals[i].inlining_id]); |
| 533 } | 534 } |
| 534 const intptr_t id = intervals[i].inlining_id; | 535 const intptr_t id = intervals[i].inlining_id; |
| 535 start_h = Smi::New(intervals[i].start); | 536 start_h = Smi::New(intervals[i].start); |
| 536 inline_id = Smi::New(id); | 537 inline_id = Smi::New(id); |
| 537 caller_inline_id = Smi::New(caller_inline_id_[intervals[i].inlining_id]); | 538 caller_inline_id = Smi::New(caller_inline_id_[intervals[i].inlining_id]); |
| 538 | 539 |
| 539 const intptr_t p = i * Code::kInlIntNumEntries; | 540 const intptr_t p = i * Code::kInlIntNumEntries; |
| 540 inlined_code_intervals_.SetAt(p + Code::kInlIntStart, start_h); | 541 inlined_code_intervals_.SetAt(p + Code::kInlIntStart, start_h); |
| 541 inlined_code_intervals_.SetAt(p + Code::kInlIntInliningId, inline_id); | 542 inlined_code_intervals_.SetAt(p + Code::kInlIntInliningId, inline_id); |
| 542 inlined_code_intervals_.SetAt( | 543 inlined_code_intervals_.SetAt( |
| 543 p + Code::kInlIntCallerId, caller_inline_id); | 544 p + Code::kInlIntCallerId, caller_inline_id); |
| 544 } | 545 } |
| 545 } | 546 } |
| 546 set_current_block(NULL); | 547 set_current_block(NULL); |
| 547 if (FLAG_trace_inlining_intervals && is_optimizing()) { | 548 if (false && FLAG_trace_inlining_intervals && is_optimizing()) { |
| 548 OS::Print("Intervals:\n"); | 549 ISL_Print("Intervals:\n"); |
| 549 Smi& temp = Smi::Handle(); | 550 Smi& temp = Smi::Handle(); |
| 550 for (intptr_t i = 0; i < inlined_code_intervals_.Length(); | 551 for (intptr_t i = 0; i < inlined_code_intervals_.Length(); |
| 551 i += Code::kInlIntNumEntries) { | 552 i += Code::kInlIntNumEntries) { |
| 552 temp ^= inlined_code_intervals_.At(i + Code::kInlIntStart); | 553 temp ^= inlined_code_intervals_.At(i + Code::kInlIntStart); |
| 553 ASSERT(!temp.IsNull()); | 554 ASSERT(!temp.IsNull()); |
| 554 OS::Print("% " Pd " start: %" Px " ", i, temp.Value()); | 555 ISL_Print("% " Pd " start: %" Px " ", i, temp.Value()); |
| 555 temp ^= inlined_code_intervals_.At(i + Code::kInlIntInliningId); | 556 temp ^= inlined_code_intervals_.At(i + Code::kInlIntInliningId); |
| 556 OS::Print("inl-id: %" Pd " ", temp.Value()); | 557 ISL_Print("inl-id: %" Pd " ", temp.Value()); |
| 557 temp ^= inlined_code_intervals_.At(i + Code::kInlIntCallerId); | 558 temp ^= inlined_code_intervals_.At(i + Code::kInlIntCallerId); |
| 558 OS::Print("caller-id: %" Pd " \n", temp.Value()); | 559 ISL_Print("caller-id: %" Pd " \n", temp.Value()); |
| 559 } | 560 } |
| 560 } | 561 } |
| 561 } | 562 } |
| 562 | 563 |
| 563 | 564 |
| 564 void FlowGraphCompiler::Bailout(const char* reason) { | 565 void FlowGraphCompiler::Bailout(const char* reason) { |
| 565 const Function& function = parsed_function_.function(); | 566 const Function& function = parsed_function_.function(); |
| 566 Report::MessageF(Report::kBailout, | 567 Report::MessageF(Report::kBailout, |
| 567 Script::Handle(function.script()), | 568 Script::Handle(function.script()), |
| 568 function.token_pos(), | 569 function.token_pos(), |
| (...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1799 | 1800 |
| 1800 | 1801 |
| 1801 void FlowGraphCompiler::FrameStateClear() { | 1802 void FlowGraphCompiler::FrameStateClear() { |
| 1802 ASSERT(!is_optimizing()); | 1803 ASSERT(!is_optimizing()); |
| 1803 frame_state_.TruncateTo(0); | 1804 frame_state_.TruncateTo(0); |
| 1804 } | 1805 } |
| 1805 #endif | 1806 #endif |
| 1806 | 1807 |
| 1807 | 1808 |
| 1808 } // namespace dart | 1809 } // namespace dart |
| OLD | NEW |