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, | 607 : BlockEntryInstr(0, CatchClauseNode::kInvalidTryIndex), |
608 CatchClauseNode::kInvalidTryIndex, | |
609 Thread::Current()->GetNextDeoptId()), | |
610 parsed_function_(parsed_function), | 608 parsed_function_(parsed_function), |
611 normal_entry_(normal_entry), | 609 normal_entry_(normal_entry), |
612 catch_entries_(), | 610 catch_entries_(), |
613 indirect_entries_(), | 611 indirect_entries_(), |
614 initial_definitions_(), | 612 initial_definitions_(), |
615 osr_id_(osr_id), | 613 osr_id_(osr_id), |
616 entry_count_(0), | 614 entry_count_(0), |
617 spill_slot_count_(0), | 615 spill_slot_count_(0), |
618 fixed_slot_count_(0) {} | 616 fixed_slot_count_(0) {} |
619 | 617 |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1104 if (instr->GetDeoptId() == osr_id) { | 1102 if (instr->GetDeoptId() == osr_id) { |
1105 // Sanity check that we found a stack check instruction. | 1103 // Sanity check that we found a stack check instruction. |
1106 ASSERT(instr->IsCheckStackOverflow()); | 1104 ASSERT(instr->IsCheckStackOverflow()); |
1107 // Loop stack check checks are always in join blocks so that they can | 1105 // Loop stack check checks are always in join blocks so that they can |
1108 // be the target of a goto. | 1106 // be the target of a goto. |
1109 ASSERT(IsJoinEntry()); | 1107 ASSERT(IsJoinEntry()); |
1110 // The instruction should be the first instruction in the block so | 1108 // The instruction should be the first instruction in the block so |
1111 // we can simply jump to the beginning of the block. | 1109 // we can simply jump to the beginning of the block. |
1112 ASSERT(instr->previous() == this); | 1110 ASSERT(instr->previous() == this); |
1113 | 1111 |
1114 GotoInstr* goto_join = | 1112 GotoInstr* goto_join = new GotoInstr(AsJoinEntry()); |
1115 new GotoInstr(AsJoinEntry(), Thread::Current()->GetNextDeoptId()); | |
1116 goto_join->CopyDeoptIdFrom(*parent); | 1113 goto_join->CopyDeoptIdFrom(*parent); |
1117 graph_entry->normal_entry()->LinkTo(goto_join); | 1114 graph_entry->normal_entry()->LinkTo(goto_join); |
1118 return true; | 1115 return true; |
1119 } | 1116 } |
1120 } | 1117 } |
1121 | 1118 |
1122 // Recursively search the successors. | 1119 // Recursively search the successors. |
1123 for (intptr_t i = instr->SuccessorCount() - 1; i >= 0; --i) { | 1120 for (intptr_t i = instr->SuccessorCount() - 1; i >= 0; --i) { |
1124 if (instr->SuccessorAt(i)->PruneUnreachable(graph_entry, instr, osr_id, | 1121 if (instr->SuccessorAt(i)->PruneUnreachable(graph_entry, instr, osr_id, |
1125 block_marks)) { | 1122 block_marks)) { |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1332 } | 1329 } |
1333 | 1330 |
1334 | 1331 |
1335 BlockEntryInstr* GotoInstr::SuccessorAt(intptr_t index) const { | 1332 BlockEntryInstr* GotoInstr::SuccessorAt(intptr_t index) const { |
1336 ASSERT(index == 0); | 1333 ASSERT(index == 0); |
1337 return successor(); | 1334 return successor(); |
1338 } | 1335 } |
1339 | 1336 |
1340 | 1337 |
1341 void Instruction::Goto(JoinEntryInstr* entry) { | 1338 void Instruction::Goto(JoinEntryInstr* entry) { |
1342 LinkTo(new GotoInstr(entry, Thread::Current()->GetNextDeoptId())); | 1339 LinkTo(new GotoInstr(entry)); |
1343 } | 1340 } |
1344 | 1341 |
1345 | 1342 |
1346 bool UnboxedIntConverterInstr::ComputeCanDeoptimize() const { | 1343 bool UnboxedIntConverterInstr::ComputeCanDeoptimize() const { |
1347 return (to() == kUnboxedInt32) && !is_truncating() && | 1344 return (to() == kUnboxedInt32) && !is_truncating() && |
1348 !RangeUtils::Fits(value()->definition()->range(), | 1345 !RangeUtils::Fits(value()->definition()->range(), |
1349 RangeBoundary::kRangeBoundaryInt32); | 1346 RangeBoundary::kRangeBoundaryInt32); |
1350 } | 1347 } |
1351 | 1348 |
1352 | 1349 |
(...skipping 1865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3218 ASSERT((InputCount() == 0) || (locs()->out(0).reg() == locs()->in(0).reg())); | 3215 ASSERT((InputCount() == 0) || (locs()->out(0).reg() == locs()->in(0).reg())); |
3219 __ Drop(num_temps()); | 3216 __ Drop(num_temps()); |
3220 #endif // defined(TARGET_ARCH_DBC) | 3217 #endif // defined(TARGET_ARCH_DBC) |
3221 } | 3218 } |
3222 | 3219 |
3223 | 3220 |
3224 StrictCompareInstr::StrictCompareInstr(TokenPosition token_pos, | 3221 StrictCompareInstr::StrictCompareInstr(TokenPosition token_pos, |
3225 Token::Kind kind, | 3222 Token::Kind kind, |
3226 Value* left, | 3223 Value* left, |
3227 Value* right, | 3224 Value* right, |
3228 bool needs_number_check, | 3225 bool needs_number_check) |
3229 intptr_t deopt_id) | 3226 : TemplateComparison(token_pos, kind, Thread::Current()->GetNextDeoptId()), |
3230 : TemplateComparison(token_pos, kind, deopt_id), | |
3231 needs_number_check_(needs_number_check) { | 3227 needs_number_check_(needs_number_check) { |
3232 ASSERT((kind == Token::kEQ_STRICT) || (kind == Token::kNE_STRICT)); | 3228 ASSERT((kind == Token::kEQ_STRICT) || (kind == Token::kNE_STRICT)); |
3233 SetInputAt(0, left); | 3229 SetInputAt(0, left); |
3234 SetInputAt(1, right); | 3230 SetInputAt(1, right); |
3235 } | 3231 } |
3236 | 3232 |
3237 | 3233 |
3238 LocationSummary* InstanceCallInstr::MakeLocationSummary(Zone* zone, | 3234 LocationSummary* InstanceCallInstr::MakeLocationSummary(Zone* zone, |
3239 bool optimizing) const { | 3235 bool optimizing) const { |
3240 return MakeCallSummary(zone); | 3236 return MakeCallSummary(zone); |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3831 ComparisonInstr* RelationalOpInstr::CopyWithNewOperands(Value* new_left, | 3827 ComparisonInstr* RelationalOpInstr::CopyWithNewOperands(Value* new_left, |
3832 Value* new_right) { | 3828 Value* new_right) { |
3833 return new RelationalOpInstr(token_pos(), kind(), new_left, new_right, | 3829 return new RelationalOpInstr(token_pos(), kind(), new_left, new_right, |
3834 operation_cid(), deopt_id()); | 3830 operation_cid(), deopt_id()); |
3835 } | 3831 } |
3836 | 3832 |
3837 | 3833 |
3838 ComparisonInstr* StrictCompareInstr::CopyWithNewOperands(Value* new_left, | 3834 ComparisonInstr* StrictCompareInstr::CopyWithNewOperands(Value* new_left, |
3839 Value* new_right) { | 3835 Value* new_right) { |
3840 return new StrictCompareInstr(token_pos(), kind(), new_left, new_right, | 3836 return new StrictCompareInstr(token_pos(), kind(), new_left, new_right, |
3841 needs_number_check(), Thread::kNoDeoptId); | 3837 needs_number_check()); |
3842 } | 3838 } |
3843 | 3839 |
3844 | 3840 |
3845 ComparisonInstr* TestSmiInstr::CopyWithNewOperands(Value* new_left, | 3841 ComparisonInstr* TestSmiInstr::CopyWithNewOperands(Value* new_left, |
3846 Value* new_right) { | 3842 Value* new_right) { |
3847 return new TestSmiInstr(token_pos(), kind(), new_left, new_right); | 3843 return new TestSmiInstr(token_pos(), kind(), new_left, new_right); |
3848 } | 3844 } |
3849 | 3845 |
3850 | 3846 |
3851 ComparisonInstr* TestCidsInstr::CopyWithNewOperands(Value* new_left, | 3847 ComparisonInstr* TestCidsInstr::CopyWithNewOperands(Value* new_left, |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4331 "native function '%s' (%" Pd " arguments) cannot be found", | 4327 "native function '%s' (%" Pd " arguments) cannot be found", |
4332 native_name().ToCString(), function().NumParameters()); | 4328 native_name().ToCString(), function().NumParameters()); |
4333 } | 4329 } |
4334 set_is_auto_scope(auto_setup_scope); | 4330 set_is_auto_scope(auto_setup_scope); |
4335 set_native_c_function(native_function); | 4331 set_native_c_function(native_function); |
4336 } | 4332 } |
4337 | 4333 |
4338 #undef __ | 4334 #undef __ |
4339 | 4335 |
4340 } // namespace dart | 4336 } // namespace dart |
OLD | NEW |