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 1865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3215 ASSERT((InputCount() == 0) || (locs()->out(0).reg() == locs()->in(0).reg())); | 3218 ASSERT((InputCount() == 0) || (locs()->out(0).reg() == locs()->in(0).reg())); |
3216 __ Drop(num_temps()); | 3219 __ Drop(num_temps()); |
3217 #endif // defined(TARGET_ARCH_DBC) | 3220 #endif // defined(TARGET_ARCH_DBC) |
3218 } | 3221 } |
3219 | 3222 |
3220 | 3223 |
3221 StrictCompareInstr::StrictCompareInstr(TokenPosition token_pos, | 3224 StrictCompareInstr::StrictCompareInstr(TokenPosition token_pos, |
3222 Token::Kind kind, | 3225 Token::Kind kind, |
3223 Value* left, | 3226 Value* left, |
3224 Value* right, | 3227 Value* right, |
3225 bool needs_number_check) | 3228 bool needs_number_check, |
3226 : TemplateComparison(token_pos, kind, Thread::Current()->GetNextDeoptId()), | 3229 intptr_t deopt_id) |
| 3230 : TemplateComparison(token_pos, kind, deopt_id), |
3227 needs_number_check_(needs_number_check) { | 3231 needs_number_check_(needs_number_check) { |
3228 ASSERT((kind == Token::kEQ_STRICT) || (kind == Token::kNE_STRICT)); | 3232 ASSERT((kind == Token::kEQ_STRICT) || (kind == Token::kNE_STRICT)); |
3229 SetInputAt(0, left); | 3233 SetInputAt(0, left); |
3230 SetInputAt(1, right); | 3234 SetInputAt(1, right); |
3231 } | 3235 } |
3232 | 3236 |
3233 | 3237 |
3234 LocationSummary* InstanceCallInstr::MakeLocationSummary(Zone* zone, | 3238 LocationSummary* InstanceCallInstr::MakeLocationSummary(Zone* zone, |
3235 bool optimizing) const { | 3239 bool optimizing) const { |
3236 return MakeCallSummary(zone); | 3240 return MakeCallSummary(zone); |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3827 ComparisonInstr* RelationalOpInstr::CopyWithNewOperands(Value* new_left, | 3831 ComparisonInstr* RelationalOpInstr::CopyWithNewOperands(Value* new_left, |
3828 Value* new_right) { | 3832 Value* new_right) { |
3829 return new RelationalOpInstr(token_pos(), kind(), new_left, new_right, | 3833 return new RelationalOpInstr(token_pos(), kind(), new_left, new_right, |
3830 operation_cid(), deopt_id()); | 3834 operation_cid(), deopt_id()); |
3831 } | 3835 } |
3832 | 3836 |
3833 | 3837 |
3834 ComparisonInstr* StrictCompareInstr::CopyWithNewOperands(Value* new_left, | 3838 ComparisonInstr* StrictCompareInstr::CopyWithNewOperands(Value* new_left, |
3835 Value* new_right) { | 3839 Value* new_right) { |
3836 return new StrictCompareInstr(token_pos(), kind(), new_left, new_right, | 3840 return new StrictCompareInstr(token_pos(), kind(), new_left, new_right, |
3837 needs_number_check()); | 3841 needs_number_check(), Thread::kNoDeoptId); |
3838 } | 3842 } |
3839 | 3843 |
3840 | 3844 |
3841 ComparisonInstr* TestSmiInstr::CopyWithNewOperands(Value* new_left, | 3845 ComparisonInstr* TestSmiInstr::CopyWithNewOperands(Value* new_left, |
3842 Value* new_right) { | 3846 Value* new_right) { |
3843 return new TestSmiInstr(token_pos(), kind(), new_left, new_right); | 3847 return new TestSmiInstr(token_pos(), kind(), new_left, new_right); |
3844 } | 3848 } |
3845 | 3849 |
3846 | 3850 |
3847 ComparisonInstr* TestCidsInstr::CopyWithNewOperands(Value* new_left, | 3851 ComparisonInstr* TestCidsInstr::CopyWithNewOperands(Value* new_left, |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4327 "native function '%s' (%" Pd " arguments) cannot be found", | 4331 "native function '%s' (%" Pd " arguments) cannot be found", |
4328 native_name().ToCString(), function().NumParameters()); | 4332 native_name().ToCString(), function().NumParameters()); |
4329 } | 4333 } |
4330 set_is_auto_scope(auto_setup_scope); | 4334 set_is_auto_scope(auto_setup_scope); |
4331 set_native_c_function(native_function); | 4335 set_native_c_function(native_function); |
4332 } | 4336 } |
4333 | 4337 |
4334 #undef __ | 4338 #undef __ |
4335 | 4339 |
4336 } // namespace dart | 4340 } // namespace dart |
OLD | NEW |