| 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 8761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8772 } | 8772 } |
| 8773 | 8773 |
| 8774 | 8774 |
| 8775 void ContextScope::PrintToJSONStream(JSONStream* stream, bool ref) const { | 8775 void ContextScope::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 8776 stream->OpenObject(); | 8776 stream->OpenObject(); |
| 8777 stream->CloseObject(); | 8777 stream->CloseObject(); |
| 8778 } | 8778 } |
| 8779 | 8779 |
| 8780 | 8780 |
| 8781 const char* ICData::ToCString() const { | 8781 const char* ICData::ToCString() const { |
| 8782 const char* kFormat = "ICData target:'%s' num-checks: %"Pd""; | 8782 const char* kFormat = "ICData target:'%s' num-args: %"Pd" num-checks: %"Pd""; |
| 8783 const String& name = String::Handle(target_name()); | 8783 const String& name = String::Handle(target_name()); |
| 8784 const intptr_t num = NumberOfChecks(); | 8784 const intptr_t num_args = num_args_tested(); |
| 8785 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name.ToCString(), num) + 1; | 8785 const intptr_t num_checks = NumberOfChecks(); |
| 8786 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name.ToCString(), |
| 8787 num_args, num_checks) + 1; |
| 8786 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 8788 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 8787 OS::SNPrint(chars, len, kFormat, name.ToCString(), num); | 8789 OS::SNPrint(chars, len, kFormat, name.ToCString(), num_args, num_checks); |
| 8788 return chars; | 8790 return chars; |
| 8789 } | 8791 } |
| 8790 | 8792 |
| 8791 | 8793 |
| 8792 void ICData::set_function(const Function& value) const { | 8794 void ICData::set_function(const Function& value) const { |
| 8793 StorePointer(&raw_ptr()->function_, value.raw()); | 8795 StorePointer(&raw_ptr()->function_, value.raw()); |
| 8794 } | 8796 } |
| 8795 | 8797 |
| 8796 | 8798 |
| 8797 void ICData::set_target_name(const String& value) const { | 8799 void ICData::set_target_name(const String& value) const { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8869 return true; | 8871 return true; |
| 8870 } | 8872 } |
| 8871 } | 8873 } |
| 8872 return false; | 8874 return false; |
| 8873 } | 8875 } |
| 8874 #endif // DEBUG | 8876 #endif // DEBUG |
| 8875 | 8877 |
| 8876 | 8878 |
| 8877 // Used for unoptimized static calls when no class-ids are checked. | 8879 // Used for unoptimized static calls when no class-ids are checked. |
| 8878 void ICData::AddTarget(const Function& target) const { | 8880 void ICData::AddTarget(const Function& target) const { |
| 8879 ASSERT(num_args_tested() == 0); | 8881 if (num_args_tested() > 0) { |
| 8882 // Create a fake cid entry, so that we can store the target. |
| 8883 GrowableArray<intptr_t> class_ids(num_args_tested()); |
| 8884 for (intptr_t i = 0; i < num_args_tested(); i++) { |
| 8885 class_ids.Add(kObjectCid); |
| 8886 } |
| 8887 AddCheck(class_ids, target); |
| 8888 return; |
| 8889 } |
| 8890 ASSERT(num_args_tested() >= 0); |
| 8880 // Can add only once. | 8891 // Can add only once. |
| 8881 const intptr_t old_num = NumberOfChecks(); | 8892 const intptr_t old_num = NumberOfChecks(); |
| 8882 ASSERT(old_num == 0); | 8893 ASSERT(old_num == 0); |
| 8883 Array& data = Array::Handle(ic_data()); | 8894 Array& data = Array::Handle(ic_data()); |
| 8884 const intptr_t new_len = data.Length() + TestEntryLength(); | 8895 const intptr_t new_len = data.Length() + TestEntryLength(); |
| 8885 data = Array::Grow(data, new_len, Heap::kOld); | 8896 data = Array::Grow(data, new_len, Heap::kOld); |
| 8886 set_ic_data(data); | 8897 set_ic_data(data); |
| 8887 WriteSentinel(data); | 8898 WriteSentinel(data); |
| 8888 intptr_t data_pos = old_num * TestEntryLength(); | 8899 intptr_t data_pos = old_num * TestEntryLength(); |
| 8889 ASSERT(!target.IsNull()); | 8900 ASSERT(!target.IsNull()); |
| (...skipping 5340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14230 } | 14241 } |
| 14231 | 14242 |
| 14232 | 14243 |
| 14233 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 14244 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 14234 stream->OpenObject(); | 14245 stream->OpenObject(); |
| 14235 stream->CloseObject(); | 14246 stream->CloseObject(); |
| 14236 } | 14247 } |
| 14237 | 14248 |
| 14238 | 14249 |
| 14239 } // namespace dart | 14250 } // namespace dart |
| OLD | NEW |