| 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. |
| 11 ICData::ICData(const Array& data) : data_(&data) { | 11 ICData::ICData(const Array& data) : data_(&data) { |
| 12 // Check consistency. |
| 13 ASSERT(!String::Handle(FunctionName()).IsNull()); |
| 14 ASSERT(NumberOfArgumentsChecked() > 0); |
| 12 } | 15 } |
| 13 | 16 |
| 14 | 17 |
| 15 ICData::ICData(const String& function_name, intptr_t num_args_checked) | 18 ICData::ICData(const String& function_name, intptr_t num_args_checked) |
| 16 : data_(NULL) { | 19 : data_(NULL) { |
| 17 // Array contains: function-name, num_checked, NULL check sentinel (classes, | 20 // Array contains: function-name, num_checked, NULL check sentinel (classes, |
| 18 // target). | 21 // target). |
| 19 const intptr_t len = kChecksStartIndex + (num_args_checked + 1); | 22 const intptr_t len = kChecksStartIndex + (num_args_checked + 1); |
| 20 data_ = &Array::ZoneHandle(Array::New(len, Heap::kOld)); | 23 data_ = &Array::ZoneHandle(Array::New(len, Heap::kOld)); |
| 21 data_->SetAt(kNameIndex, function_name); | 24 data_->SetAt(kNameIndex, function_name); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 intptr_t pos = 1 + 1 + ArrayElementsPerCheck() * index; | 97 intptr_t pos = 1 + 1 + ArrayElementsPerCheck() * index; |
| 95 for (intptr_t i = 0; i < NumberOfArgumentsChecked(); i++) { | 98 for (intptr_t i = 0; i < NumberOfArgumentsChecked(); i++) { |
| 96 Class& cls = Class::ZoneHandle(); | 99 Class& cls = Class::ZoneHandle(); |
| 97 cls ^= data_->At(pos++); | 100 cls ^= data_->At(pos++); |
| 98 classes->Add(&cls); | 101 classes->Add(&cls); |
| 99 } | 102 } |
| 100 (*target) ^= data_->At(pos); | 103 (*target) ^= data_->At(pos); |
| 101 } | 104 } |
| 102 | 105 |
| 103 } // namespace dart | 106 } // namespace dart |
| OLD | NEW |