| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/ic_data.h" | 5 #include "vm/ic_data.h" |
| 6 #include "vm/object.h" | 6 #include "vm/object.h" |
| 7 | 7 |
| 8 namespace dart { | 8 namespace dart { |
| 9 | 9 |
| 10 // ICData is a ValueObject, therefore 'data' need not be a ZoneObject. | 10 // ICData is a ValueObject, therefore 'data' need not be a ZoneObject. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 ASSERT(!classes[i]->IsNull()); | 93 ASSERT(!classes[i]->IsNull()); |
| 94 // Contract says that the class of null (NullClass) cannot be added. | 94 // Contract says that the class of null (NullClass) cannot be added. |
| 95 ASSERT(!classes[i]->IsNullClass()); | 95 ASSERT(!classes[i]->IsNullClass()); |
| 96 data_->SetAt(pos++, *(classes[i])); | 96 data_->SetAt(pos++, *(classes[i])); |
| 97 } | 97 } |
| 98 ASSERT(!target.IsNull()); | 98 ASSERT(!target.IsNull()); |
| 99 data_->SetAt(pos, target); | 99 data_->SetAt(pos, target); |
| 100 } | 100 } |
| 101 | 101 |
| 102 | 102 |
| 103 void ICData::GetOneClassCheckAt(intptr_t index, |
| 104 Class* cls, |
| 105 Function* target) const { |
| 106 ASSERT(cls != NULL); |
| 107 ASSERT(target != NULL); |
| 108 ASSERT((0 <= index) && (index < NumberOfChecks())); |
| 109 ASSERT(NumberOfArgumentsChecked() == 1); |
| 110 intptr_t pos = 1 + 1 + ArrayElementsPerCheck() * index; |
| 111 *cls ^= data_->At(pos); |
| 112 (*target) ^= data_->At(pos + 1); |
| 113 } |
| 114 |
| 115 |
| 103 void ICData::GetCheckAt(intptr_t index, | 116 void ICData::GetCheckAt(intptr_t index, |
| 104 GrowableArray<const Class*>* classes, | 117 GrowableArray<const Class*>* classes, |
| 105 Function* target) const { | 118 Function* target) const { |
| 106 ASSERT(classes != NULL); | 119 ASSERT(classes != NULL); |
| 107 ASSERT(target != NULL); | 120 ASSERT(target != NULL); |
| 108 ASSERT((0 <= index) && (index < NumberOfChecks())); | 121 ASSERT((0 <= index) && (index < NumberOfChecks())); |
| 109 classes->Clear(); | 122 classes->Clear(); |
| 110 intptr_t pos = 1 + 1 + ArrayElementsPerCheck() * index; | 123 intptr_t pos = 1 + 1 + ArrayElementsPerCheck() * index; |
| 111 for (intptr_t i = 0; i < NumberOfArgumentsChecked(); i++) { | 124 for (intptr_t i = 0; i < NumberOfArgumentsChecked(); i++) { |
| 112 Class& cls = Class::ZoneHandle(); | 125 Class& cls = Class::ZoneHandle(); |
| 113 cls ^= data_->At(pos++); | 126 cls ^= data_->At(pos++); |
| 114 classes->Add(&cls); | 127 classes->Add(&cls); |
| 115 } | 128 } |
| 116 (*target) ^= data_->At(pos); | 129 (*target) ^= data_->At(pos); |
| 117 } | 130 } |
| 118 | 131 |
| 119 } // namespace dart | 132 } // namespace dart |
| OLD | NEW |