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/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
6 | 6 |
7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
8 #include "vm/bootstrap.h" | 8 #include "vm/bootstrap.h" |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/constant_propagator.h" | 10 #include "vm/constant_propagator.h" |
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 ASSERT(BindsToConstant()); | 597 ASSERT(BindsToConstant()); |
598 ConstantInstr* constant = definition()->AsConstant(); | 598 ConstantInstr* constant = definition()->AsConstant(); |
599 ASSERT(constant != NULL); | 599 ASSERT(constant != NULL); |
600 return constant->value(); | 600 return constant->value(); |
601 } | 601 } |
602 | 602 |
603 | 603 |
604 GraphEntryInstr::GraphEntryInstr(const ParsedFunction& parsed_function, | 604 GraphEntryInstr::GraphEntryInstr(const ParsedFunction& parsed_function, |
605 TargetEntryInstr* normal_entry, | 605 TargetEntryInstr* normal_entry, |
606 intptr_t osr_id) | 606 intptr_t osr_id) |
607 : BlockEntryInstr(0, CatchClauseNode::kInvalidTryIndex), | 607 : BlockEntryInstr(0, |
| 608 CatchClauseNode::kInvalidTryIndex, |
| 609 Thread::Current()->GetNextDeoptId()), |
608 parsed_function_(parsed_function), | 610 parsed_function_(parsed_function), |
609 normal_entry_(normal_entry), | 611 normal_entry_(normal_entry), |
610 catch_entries_(), | 612 catch_entries_(), |
611 indirect_entries_(), | 613 indirect_entries_(), |
612 initial_definitions_(), | 614 initial_definitions_(), |
613 osr_id_(osr_id), | 615 osr_id_(osr_id), |
614 entry_count_(0), | 616 entry_count_(0), |
615 spill_slot_count_(0), | 617 spill_slot_count_(0), |
616 fixed_slot_count_(0) {} | 618 fixed_slot_count_(0) {} |
617 | 619 |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1102 if (instr->GetDeoptId() == osr_id) { | 1104 if (instr->GetDeoptId() == osr_id) { |
1103 // Sanity check that we found a stack check instruction. | 1105 // Sanity check that we found a stack check instruction. |
1104 ASSERT(instr->IsCheckStackOverflow()); | 1106 ASSERT(instr->IsCheckStackOverflow()); |
1105 // Loop stack check checks are always in join blocks so that they can | 1107 // Loop stack check checks are always in join blocks so that they can |
1106 // be the target of a goto. | 1108 // be the target of a goto. |
1107 ASSERT(IsJoinEntry()); | 1109 ASSERT(IsJoinEntry()); |
1108 // The instruction should be the first instruction in the block so | 1110 // The instruction should be the first instruction in the block so |
1109 // we can simply jump to the beginning of the block. | 1111 // we can simply jump to the beginning of the block. |
1110 ASSERT(instr->previous() == this); | 1112 ASSERT(instr->previous() == this); |
1111 | 1113 |
1112 GotoInstr* goto_join = new GotoInstr(AsJoinEntry()); | 1114 GotoInstr* goto_join = |
| 1115 new GotoInstr(AsJoinEntry(), Thread::Current()->GetNextDeoptId()); |
1113 goto_join->CopyDeoptIdFrom(*parent); | 1116 goto_join->CopyDeoptIdFrom(*parent); |
1114 graph_entry->normal_entry()->LinkTo(goto_join); | 1117 graph_entry->normal_entry()->LinkTo(goto_join); |
1115 return true; | 1118 return true; |
1116 } | 1119 } |
1117 } | 1120 } |
1118 | 1121 |
1119 // Recursively search the successors. | 1122 // Recursively search the successors. |
1120 for (intptr_t i = instr->SuccessorCount() - 1; i >= 0; --i) { | 1123 for (intptr_t i = instr->SuccessorCount() - 1; i >= 0; --i) { |
1121 if (instr->SuccessorAt(i)->PruneUnreachable(graph_entry, instr, osr_id, | 1124 if (instr->SuccessorAt(i)->PruneUnreachable(graph_entry, instr, osr_id, |
1122 block_marks)) { | 1125 block_marks)) { |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1329 } | 1332 } |
1330 | 1333 |
1331 | 1334 |
1332 BlockEntryInstr* GotoInstr::SuccessorAt(intptr_t index) const { | 1335 BlockEntryInstr* GotoInstr::SuccessorAt(intptr_t index) const { |
1333 ASSERT(index == 0); | 1336 ASSERT(index == 0); |
1334 return successor(); | 1337 return successor(); |
1335 } | 1338 } |
1336 | 1339 |
1337 | 1340 |
1338 void Instruction::Goto(JoinEntryInstr* entry) { | 1341 void Instruction::Goto(JoinEntryInstr* entry) { |
1339 LinkTo(new GotoInstr(entry)); | 1342 LinkTo(new GotoInstr(entry, Thread::Current()->GetNextDeoptId())); |
1340 } | 1343 } |
1341 | 1344 |
1342 | 1345 |
1343 bool UnboxedIntConverterInstr::ComputeCanDeoptimize() const { | 1346 bool UnboxedIntConverterInstr::ComputeCanDeoptimize() const { |
1344 return (to() == kUnboxedInt32) && !is_truncating() && | 1347 return (to() == kUnboxedInt32) && !is_truncating() && |
1345 !RangeUtils::Fits(value()->definition()->range(), | 1348 !RangeUtils::Fits(value()->definition()->range(), |
1346 RangeBoundary::kRangeBoundaryInt32); | 1349 RangeBoundary::kRangeBoundaryInt32); |
1347 } | 1350 } |
1348 | 1351 |
1349 | 1352 |
(...skipping 1828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3178 ASSERT((InputCount() == 0) || (locs()->out(0).reg() == locs()->in(0).reg())); | 3181 ASSERT((InputCount() == 0) || (locs()->out(0).reg() == locs()->in(0).reg())); |
3179 __ Drop(num_temps()); | 3182 __ Drop(num_temps()); |
3180 #endif // defined(TARGET_ARCH_DBC) | 3183 #endif // defined(TARGET_ARCH_DBC) |
3181 } | 3184 } |
3182 | 3185 |
3183 | 3186 |
3184 StrictCompareInstr::StrictCompareInstr(TokenPosition token_pos, | 3187 StrictCompareInstr::StrictCompareInstr(TokenPosition token_pos, |
3185 Token::Kind kind, | 3188 Token::Kind kind, |
3186 Value* left, | 3189 Value* left, |
3187 Value* right, | 3190 Value* right, |
3188 bool needs_number_check) | 3191 bool needs_number_check, |
3189 : TemplateComparison(token_pos, kind, Thread::Current()->GetNextDeoptId()), | 3192 intptr_t deopt_id) |
| 3193 : TemplateComparison(token_pos, kind, deopt_id), |
3190 needs_number_check_(needs_number_check) { | 3194 needs_number_check_(needs_number_check) { |
3191 ASSERT((kind == Token::kEQ_STRICT) || (kind == Token::kNE_STRICT)); | 3195 ASSERT((kind == Token::kEQ_STRICT) || (kind == Token::kNE_STRICT)); |
3192 SetInputAt(0, left); | 3196 SetInputAt(0, left); |
3193 SetInputAt(1, right); | 3197 SetInputAt(1, right); |
3194 } | 3198 } |
3195 | 3199 |
3196 | 3200 |
3197 LocationSummary* InstanceCallInstr::MakeLocationSummary(Zone* zone, | 3201 LocationSummary* InstanceCallInstr::MakeLocationSummary(Zone* zone, |
3198 bool optimizing) const { | 3202 bool optimizing) const { |
3199 return MakeCallSummary(zone); | 3203 return MakeCallSummary(zone); |
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3798 ComparisonInstr* RelationalOpInstr::CopyWithNewOperands(Value* new_left, | 3802 ComparisonInstr* RelationalOpInstr::CopyWithNewOperands(Value* new_left, |
3799 Value* new_right) { | 3803 Value* new_right) { |
3800 return new RelationalOpInstr(token_pos(), kind(), new_left, new_right, | 3804 return new RelationalOpInstr(token_pos(), kind(), new_left, new_right, |
3801 operation_cid(), deopt_id()); | 3805 operation_cid(), deopt_id()); |
3802 } | 3806 } |
3803 | 3807 |
3804 | 3808 |
3805 ComparisonInstr* StrictCompareInstr::CopyWithNewOperands(Value* new_left, | 3809 ComparisonInstr* StrictCompareInstr::CopyWithNewOperands(Value* new_left, |
3806 Value* new_right) { | 3810 Value* new_right) { |
3807 return new StrictCompareInstr(token_pos(), kind(), new_left, new_right, | 3811 return new StrictCompareInstr(token_pos(), kind(), new_left, new_right, |
3808 needs_number_check()); | 3812 needs_number_check(), Thread::kNoDeoptId); |
3809 } | 3813 } |
3810 | 3814 |
3811 | 3815 |
3812 ComparisonInstr* TestSmiInstr::CopyWithNewOperands(Value* new_left, | 3816 ComparisonInstr* TestSmiInstr::CopyWithNewOperands(Value* new_left, |
3813 Value* new_right) { | 3817 Value* new_right) { |
3814 return new TestSmiInstr(token_pos(), kind(), new_left, new_right); | 3818 return new TestSmiInstr(token_pos(), kind(), new_left, new_right); |
3815 } | 3819 } |
3816 | 3820 |
3817 | 3821 |
3818 ComparisonInstr* TestCidsInstr::CopyWithNewOperands(Value* new_left, | 3822 ComparisonInstr* TestCidsInstr::CopyWithNewOperands(Value* new_left, |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4317 "native function '%s' (%" Pd " arguments) cannot be found", | 4321 "native function '%s' (%" Pd " arguments) cannot be found", |
4318 native_name().ToCString(), function().NumParameters()); | 4322 native_name().ToCString(), function().NumParameters()); |
4319 } | 4323 } |
4320 set_is_auto_scope(auto_setup_scope); | 4324 set_is_auto_scope(auto_setup_scope); |
4321 set_native_c_function(native_function); | 4325 set_native_c_function(native_function); |
4322 } | 4326 } |
4323 | 4327 |
4324 #undef __ | 4328 #undef __ |
4325 | 4329 |
4326 } // namespace dart | 4330 } // namespace dart |
OLD | NEW |