Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/object.h" | 5 #include "vm/object.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 8893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8904 } | 8904 } |
| 8905 | 8905 |
| 8906 | 8906 |
| 8907 void ICData::AddCheck(const GrowableArray<intptr_t>& class_ids, | 8907 void ICData::AddCheck(const GrowableArray<intptr_t>& class_ids, |
| 8908 const Function& target) const { | 8908 const Function& target) const { |
| 8909 DEBUG_ASSERT(!HasCheck(class_ids)); | 8909 DEBUG_ASSERT(!HasCheck(class_ids)); |
| 8910 ASSERT(num_args_tested() > 1); // Otherwise use 'AddReceiverCheck'. | 8910 ASSERT(num_args_tested() > 1); // Otherwise use 'AddReceiverCheck'. |
| 8911 ASSERT(class_ids.length() == num_args_tested()); | 8911 ASSERT(class_ids.length() == num_args_tested()); |
| 8912 const intptr_t old_num = NumberOfChecks(); | 8912 const intptr_t old_num = NumberOfChecks(); |
| 8913 Array& data = Array::Handle(ic_data()); | 8913 Array& data = Array::Handle(ic_data()); |
| 8914 // ICData of static calls with nume_args_tested() > 0 have initially a | |
|
zra
2013/07/22 16:21:02
num_args_tested?
srdjan
2013/07/22 16:42:48
Done.
| |
| 8915 // dummy set of cids entered (see ICData::AddTarget). That entry is | |
| 8916 // overwritten by first real type feedback data. | |
| 8917 if (old_num == 1) { | |
| 8918 bool has_dummy_entry = true; | |
| 8919 for (intptr_t i = 0; i < num_args_tested(); i++) { | |
| 8920 if (Smi::Value(Smi::RawCast(data.At(i))) != kObjectCid) { | |
| 8921 has_dummy_entry = false; | |
| 8922 break; | |
| 8923 } | |
| 8924 } | |
| 8925 if (has_dummy_entry) { | |
| 8926 ASSERT(target.raw() == data.At(num_args_tested())); | |
| 8927 // Replace dummy entry. | |
| 8928 Smi& value = Smi::Handle(); | |
| 8929 for (intptr_t i = 0; i < num_args_tested(); i++) { | |
| 8930 ASSERT(class_ids[i] != kIllegalCid); | |
| 8931 value = Smi::New(class_ids[i]); | |
| 8932 data.SetAt(i, value); | |
| 8933 } | |
| 8934 return; | |
| 8935 } | |
| 8936 } | |
| 8914 const intptr_t new_len = data.Length() + TestEntryLength(); | 8937 const intptr_t new_len = data.Length() + TestEntryLength(); |
| 8915 data = Array::Grow(data, new_len, Heap::kOld); | 8938 data = Array::Grow(data, new_len, Heap::kOld); |
| 8916 set_ic_data(data); | 8939 set_ic_data(data); |
| 8917 WriteSentinel(data); | 8940 WriteSentinel(data); |
| 8918 intptr_t data_pos = old_num * TestEntryLength(); | 8941 intptr_t data_pos = old_num * TestEntryLength(); |
| 8919 Smi& value = Smi::Handle(); | 8942 Smi& value = Smi::Handle(); |
| 8920 for (intptr_t i = 0; i < class_ids.length(); i++) { | 8943 for (intptr_t i = 0; i < class_ids.length(); i++) { |
| 8921 // kIllegalCid is used as terminating value, do not add it. | 8944 // kIllegalCid is used as terminating value, do not add it. |
| 8922 ASSERT(class_ids[i] != kIllegalCid); | 8945 ASSERT(class_ids[i] != kIllegalCid); |
| 8923 value = Smi::New(class_ids[i]); | 8946 value = Smi::New(class_ids[i]); |
| (...skipping 5317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 14241 } | 14264 } |
| 14242 | 14265 |
| 14243 | 14266 |
| 14244 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 14267 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 14245 stream->OpenObject(); | 14268 stream->OpenObject(); |
| 14246 stream->CloseObject(); | 14269 stream->CloseObject(); |
| 14247 } | 14270 } |
| 14248 | 14271 |
| 14249 | 14272 |
| 14250 } // namespace dart | 14273 } // namespace dart |
| OLD | NEW |