| 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/cpu.h" | 8 #include "vm/cpu.h" |
| 9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/flow_graph_allocator.h" | 10 #include "vm/flow_graph_allocator.h" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 return true; | 184 return true; |
| 185 } | 185 } |
| 186 return false; | 186 return false; |
| 187 } | 187 } |
| 188 | 188 |
| 189 | 189 |
| 190 intptr_t CheckClassInstr::ComputeCidMask() const { | 190 intptr_t CheckClassInstr::ComputeCidMask() const { |
| 191 ASSERT(IsDenseSwitch()); | 191 ASSERT(IsDenseSwitch()); |
| 192 intptr_t mask = 0; | 192 intptr_t mask = 0; |
| 193 for (intptr_t i = 0; i < cids_.length(); ++i) { | 193 for (intptr_t i = 0; i < cids_.length(); ++i) { |
| 194 mask |= 1 << (cids_[i] - cids_[0]); | 194 mask |= static_cast<intptr_t>(1) << (cids_[i] - cids_[0]); |
| 195 } | 195 } |
| 196 return mask; | 196 return mask; |
| 197 } | 197 } |
| 198 | 198 |
| 199 | 199 |
| 200 bool CheckClassInstr::IsDenseMask(intptr_t mask) { | 200 bool CheckClassInstr::IsDenseMask(intptr_t mask) { |
| 201 // Returns true if the mask is a continuos sequence of ones in its binary | 201 // Returns true if the mask is a continuos sequence of ones in its binary |
| 202 // representation (i.e. no holes) | 202 // representation (i.e. no holes) |
| 203 return mask == -1 || Utils::IsPowerOfTwo(mask + 1); | 203 return mask == -1 || Utils::IsPowerOfTwo(mask + 1); |
| 204 } | 204 } |
| (...skipping 2420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2625 } | 2625 } |
| 2626 | 2626 |
| 2627 | 2627 |
| 2628 void MaterializeObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2628 void MaterializeObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2629 UNREACHABLE(); | 2629 UNREACHABLE(); |
| 2630 } | 2630 } |
| 2631 | 2631 |
| 2632 | 2632 |
| 2633 // This function should be kept in sync with | 2633 // This function should be kept in sync with |
| 2634 // FlowGraphCompiler::SlowPathEnvironmentFor(). | 2634 // FlowGraphCompiler::SlowPathEnvironmentFor(). |
| 2635 void MaterializeObjectInstr::RemapRegisters(intptr_t* fpu_reg_slots, | 2635 void MaterializeObjectInstr::RemapRegisters(intptr_t* cpu_reg_slots, |
| 2636 intptr_t* cpu_reg_slots) { | 2636 intptr_t* fpu_reg_slots) { |
| 2637 if (registers_remapped_) { | 2637 if (registers_remapped_) { |
| 2638 return; | 2638 return; |
| 2639 } | 2639 } |
| 2640 registers_remapped_ = true; | 2640 registers_remapped_ = true; |
| 2641 | 2641 |
| 2642 for (intptr_t i = 0; i < InputCount(); i++) { | 2642 for (intptr_t i = 0; i < InputCount(); i++) { |
| 2643 Location loc = LocationAt(i); | 2643 locations_[i] = LocationAt(i).RemapForSlowPath( |
| 2644 if (loc.IsRegister()) { | 2644 InputAt(i)->definition(), cpu_reg_slots, fpu_reg_slots); |
| 2645 intptr_t index = cpu_reg_slots[loc.reg()]; | |
| 2646 ASSERT(index >= 0); | |
| 2647 locations_[i] = Location::StackSlot(index); | |
| 2648 } else if (loc.IsFpuRegister()) { | |
| 2649 intptr_t index = fpu_reg_slots[loc.fpu_reg()]; | |
| 2650 ASSERT(index >= 0); | |
| 2651 Value* value = InputAt(i); | |
| 2652 switch (value->definition()->representation()) { | |
| 2653 case kUnboxedDouble: | |
| 2654 locations_[i] = Location::DoubleStackSlot(index); | |
| 2655 break; | |
| 2656 case kUnboxedFloat32x4: | |
| 2657 case kUnboxedInt32x4: | |
| 2658 case kUnboxedFloat64x2: | |
| 2659 locations_[i] = Location::QuadStackSlot(index); | |
| 2660 break; | |
| 2661 default: | |
| 2662 UNREACHABLE(); | |
| 2663 } | |
| 2664 } else if (loc.IsPairLocation()) { | |
| 2665 UNREACHABLE(); | |
| 2666 } else if (loc.IsInvalid() && | |
| 2667 InputAt(i)->definition()->IsMaterializeObject()) { | |
| 2668 InputAt(i)->definition()->AsMaterializeObject()->RemapRegisters( | |
| 2669 fpu_reg_slots, cpu_reg_slots); | |
| 2670 } | |
| 2671 } | 2645 } |
| 2672 } | 2646 } |
| 2673 | 2647 |
| 2674 | 2648 |
| 2675 LocationSummary* CurrentContextInstr::MakeLocationSummary(Isolate* isolate, | 2649 LocationSummary* CurrentContextInstr::MakeLocationSummary(Isolate* isolate, |
| 2676 bool opt) const { | 2650 bool opt) const { |
| 2677 // Only appears in initial definitions, never in normal code. | 2651 // Only appears in initial definitions, never in normal code. |
| 2678 UNREACHABLE(); | 2652 UNREACHABLE(); |
| 2679 return NULL; | 2653 return NULL; |
| 2680 } | 2654 } |
| (...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3369 case Token::kTRUNCDIV: return 0; | 3343 case Token::kTRUNCDIV: return 0; |
| 3370 case Token::kMOD: return 1; | 3344 case Token::kMOD: return 1; |
| 3371 default: UNIMPLEMENTED(); return -1; | 3345 default: UNIMPLEMENTED(); return -1; |
| 3372 } | 3346 } |
| 3373 } | 3347 } |
| 3374 | 3348 |
| 3375 | 3349 |
| 3376 #undef __ | 3350 #undef __ |
| 3377 | 3351 |
| 3378 } // namespace dart | 3352 } // namespace dart |
| OLD | NEW |