| 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 "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
| 10 #include "vm/bootstrap.h" | 10 #include "vm/bootstrap.h" |
| (...skipping 6766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6777 | 6777 |
| 6778 RawFunction* ICData::GetTargetAt(intptr_t index) const { | 6778 RawFunction* ICData::GetTargetAt(intptr_t index) const { |
| 6779 const Array& data = Array::Handle(ic_data()); | 6779 const Array& data = Array::Handle(ic_data()); |
| 6780 const intptr_t data_pos = index * TestEntryLength() + num_args_tested(); | 6780 const intptr_t data_pos = index * TestEntryLength() + num_args_tested(); |
| 6781 Function& target = Function::Handle(); | 6781 Function& target = Function::Handle(); |
| 6782 target ^= data.At(data_pos); | 6782 target ^= data.At(data_pos); |
| 6783 return target.raw(); | 6783 return target.raw(); |
| 6784 } | 6784 } |
| 6785 | 6785 |
| 6786 | 6786 |
| 6787 RawFunction* ICData::GetTargetForReceiverClassId(intptr_t class_id) const { |
| 6788 for (intptr_t i = 0; i < NumberOfChecks(); i++) { |
| 6789 if (GetReceiverClassIdAt(i) == class_id) { |
| 6790 return GetTargetAt(i); |
| 6791 } |
| 6792 } |
| 6793 return Function::null(); |
| 6794 } |
| 6795 |
| 6796 |
| 6787 RawICData* ICData::New(const Function& function, | 6797 RawICData* ICData::New(const Function& function, |
| 6788 const String& target_name, | 6798 const String& target_name, |
| 6789 intptr_t id, | 6799 intptr_t id, |
| 6790 intptr_t num_args_tested) { | 6800 intptr_t num_args_tested) { |
| 6791 ASSERT(num_args_tested > 0); | 6801 ASSERT(num_args_tested > 0); |
| 6792 const Class& cls = Class::Handle(Object::icdata_class()); | 6802 const Class& cls = Class::Handle(Object::icdata_class()); |
| 6793 ASSERT(!cls.IsNull()); | 6803 ASSERT(!cls.IsNull()); |
| 6794 ICData& result = ICData::Handle(); | 6804 ICData& result = ICData::Handle(); |
| 6795 { | 6805 { |
| 6796 // IC data objects are long living objects, allocate them in old generation. | 6806 // IC data objects are long living objects, allocate them in old generation. |
| (...skipping 3409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10206 const String& str = String::Handle(pattern()); | 10216 const String& str = String::Handle(pattern()); |
| 10207 const char* format = "JSRegExp: pattern=%s flags=%s"; | 10217 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 10208 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 10218 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 10209 char* chars = reinterpret_cast<char*>( | 10219 char* chars = reinterpret_cast<char*>( |
| 10210 Isolate::Current()->current_zone()->Allocate(len + 1)); | 10220 Isolate::Current()->current_zone()->Allocate(len + 1)); |
| 10211 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 10221 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 10212 return chars; | 10222 return chars; |
| 10213 } | 10223 } |
| 10214 | 10224 |
| 10215 } // namespace dart | 10225 } // namespace dart |
| OLD | NEW |