| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 void ICData::SetCheckAt(intptr_t index, | 84 void ICData::SetCheckAt(intptr_t index, |
| 85 const GrowableArray<const Class*>& classes, | 85 const GrowableArray<const Class*>& classes, |
| 86 const Function& target) { | 86 const Function& target) { |
| 87 ASSERT(!data_->IsNull()); | 87 ASSERT(!data_->IsNull()); |
| 88 ASSERT((0 <= index) && (index < NumberOfChecks())); | 88 ASSERT((0 <= index) && (index < NumberOfChecks())); |
| 89 intptr_t pos = kChecksStartIndex + ArrayElementsPerCheck() * index; | 89 intptr_t pos = kChecksStartIndex + ArrayElementsPerCheck() * index; |
| 90 ASSERT(classes.length() == NumberOfArgumentsChecked()); | 90 ASSERT(classes.length() == NumberOfArgumentsChecked()); |
| 91 for (intptr_t i = 0; i < classes.length(); i++) { | 91 for (intptr_t i = 0; i < classes.length(); i++) { |
| 92 // Null is used as terminating object, do not add it. | 92 // Null is used as terminating object, do not add it. |
| 93 ASSERT(!classes[i]->IsNull()); | 93 ASSERT(!classes[i]->IsNull()); |
| 94 // Contract says that the class of null (NullClass) cannot be added. | |
| 95 ASSERT(!classes[i]->IsNullClass()); | |
| 96 data_->SetAt(pos++, *(classes[i])); | 94 data_->SetAt(pos++, *(classes[i])); |
| 97 } | 95 } |
| 98 ASSERT(!target.IsNull()); | 96 ASSERT(!target.IsNull()); |
| 99 data_->SetAt(pos, target); | 97 data_->SetAt(pos, target); |
| 100 } | 98 } |
| 101 | 99 |
| 102 | 100 |
| 103 void ICData::GetOneClassCheckAt(intptr_t index, | 101 void ICData::GetOneClassCheckAt(intptr_t index, |
| 104 Class* cls, | 102 Class* cls, |
| 105 Function* target) const { | 103 Function* target) const { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 123 intptr_t pos = 1 + 1 + ArrayElementsPerCheck() * index; | 121 intptr_t pos = 1 + 1 + ArrayElementsPerCheck() * index; |
| 124 for (intptr_t i = 0; i < NumberOfArgumentsChecked(); i++) { | 122 for (intptr_t i = 0; i < NumberOfArgumentsChecked(); i++) { |
| 125 Class& cls = Class::ZoneHandle(); | 123 Class& cls = Class::ZoneHandle(); |
| 126 cls ^= data_->At(pos++); | 124 cls ^= data_->At(pos++); |
| 127 classes->Add(&cls); | 125 classes->Add(&cls); |
| 128 } | 126 } |
| 129 (*target) ^= data_->At(pos); | 127 (*target) ^= data_->At(pos); |
| 130 } | 128 } |
| 131 | 129 |
| 132 } // namespace dart | 130 } // namespace dart |
| OLD | NEW |