| 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 5636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5647 if ((start_offset <= offset) && (offset < end_offset)) { | 5647 if ((start_offset <= offset) && (offset < end_offset)) { |
| 5648 return false; | 5648 return false; |
| 5649 } | 5649 } |
| 5650 } | 5650 } |
| 5651 return true; | 5651 return true; |
| 5652 } | 5652 } |
| 5653 | 5653 |
| 5654 | 5654 |
| 5655 void Code::ExtractIcDataArraysAtCalls( | 5655 void Code::ExtractIcDataArraysAtCalls( |
| 5656 GrowableArray<intptr_t>* node_ids, | 5656 GrowableArray<intptr_t>* node_ids, |
| 5657 GrowableArray<const ICData*>* ic_data_objs) const { | 5657 const GrowableObjectArray& ic_data_objs) const { |
| 5658 ASSERT(node_ids != NULL); | 5658 ASSERT(node_ids != NULL); |
| 5659 ASSERT(ic_data_objs != NULL); | 5659 ASSERT(!ic_data_objs.IsNull()); |
| 5660 const PcDescriptors& descriptors = | 5660 const PcDescriptors& descriptors = |
| 5661 PcDescriptors::Handle(this->pc_descriptors()); | 5661 PcDescriptors::Handle(this->pc_descriptors()); |
| 5662 ICData& ic_data_obj = ICData::Handle(); |
| 5662 for (intptr_t i = 0; i < descriptors.Length(); i++) { | 5663 for (intptr_t i = 0; i < descriptors.Length(); i++) { |
| 5663 if (descriptors.DescriptorKind(i) == PcDescriptors::kIcCall) { | 5664 if (descriptors.DescriptorKind(i) == PcDescriptors::kIcCall) { |
| 5664 node_ids->Add(descriptors.NodeId(i)); | 5665 node_ids->Add(descriptors.NodeId(i)); |
| 5665 ic_data_objs->Add(&ICData::ZoneHandle( | 5666 ic_data_obj = CodePatcher::GetInstanceCallIcDataAt(descriptors.PC(i)); |
| 5666 CodePatcher::GetInstanceCallIcDataAt(descriptors.PC(i)))); | 5667 ic_data_objs.Add(ic_data_obj); |
| 5667 } | 5668 } |
| 5668 } | 5669 } |
| 5669 } | 5670 } |
| 5670 | 5671 |
| 5671 | 5672 |
| 5672 RawContext* Context::New(intptr_t num_variables, Heap::Space space) { | 5673 RawContext* Context::New(intptr_t num_variables, Heap::Space space) { |
| 5673 ASSERT(num_variables >= 0); | 5674 ASSERT(num_variables >= 0); |
| 5674 | 5675 |
| 5675 const Class& context_class = Class::Handle(Object::context_class()); | 5676 const Class& context_class = Class::Handle(Object::context_class()); |
| 5676 Context& result = Context::Handle(); | 5677 Context& result = Context::Handle(); |
| (...skipping 3045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8722 Class& cls = Class::ZoneHandle(); | 8723 Class& cls = Class::ZoneHandle(); |
| 8723 cls ^= data.At(data_pos++); | 8724 cls ^= data.At(data_pos++); |
| 8724 classes->Add(&cls); | 8725 classes->Add(&cls); |
| 8725 } | 8726 } |
| 8726 (*target) ^= data.At(data_pos); | 8727 (*target) ^= data.At(data_pos); |
| 8727 } | 8728 } |
| 8728 | 8729 |
| 8729 | 8730 |
| 8730 void ICData::GetOneClassCheckAt( | 8731 void ICData::GetOneClassCheckAt( |
| 8731 int index, Class* cls, Function* target) const { | 8732 int index, Class* cls, Function* target) const { |
| 8733 ASSERT(cls != NULL); |
| 8734 ASSERT(target != NULL); |
| 8732 ASSERT(num_args_tested() == 1); | 8735 ASSERT(num_args_tested() == 1); |
| 8733 GrowableArray<const Class*> classes; | 8736 const Array& data = Array::Handle(ic_data()); |
| 8734 GetCheckAt(index, &classes, target); | 8737 intptr_t data_pos = index * TestEntryLength(); |
| 8735 *cls = classes[0]->raw(); | 8738 *cls ^= data.At(data_pos); |
| 8739 *target ^= data.At(data_pos + 1); |
| 8736 } | 8740 } |
| 8737 | 8741 |
| 8738 | 8742 |
| 8739 RawICData* ICData::New(const Function& function, | 8743 RawICData* ICData::New(const Function& function, |
| 8740 const String& target_name, | 8744 const String& target_name, |
| 8741 intptr_t id, | 8745 intptr_t id, |
| 8742 intptr_t num_args_tested) { | 8746 intptr_t num_args_tested) { |
| 8743 ASSERT(num_args_tested > 0); | 8747 ASSERT(num_args_tested > 0); |
| 8744 const Class& cls = Class::Handle(Object::icdata_class()); | 8748 const Class& cls = Class::Handle(Object::icdata_class()); |
| 8745 ASSERT(!cls.IsNull()); | 8749 ASSERT(!cls.IsNull()); |
| 8746 ICData& result = ICData::Handle(); | 8750 ICData& result = ICData::Handle(); |
| 8747 { | 8751 { |
| 8748 // IC data objects ar long living objects, allocate them in old generation. | 8752 // IC data objects ar long living objects, allocate them in old generation. |
| 8749 RawObject* raw = | 8753 RawObject* raw = |
| 8750 Object::Allocate(cls, ICData::InstanceSize(), Heap::kOld); | 8754 Object::Allocate(cls, ICData::InstanceSize(), Heap::kOld); |
| 8751 NoGCScope no_gc; | 8755 NoGCScope no_gc; |
| 8752 result ^= raw; | 8756 result ^= raw; |
| 8753 } | 8757 } |
| 8754 result.set_function(function); | 8758 result.set_function(function); |
| 8755 result.set_target_name(target_name); | 8759 result.set_target_name(target_name); |
| 8756 result.set_id(id); | 8760 result.set_id(id); |
| 8757 result.set_num_args_tested(num_args_tested); | 8761 result.set_num_args_tested(num_args_tested); |
| 8758 // Number of array elements in one test entry (num_args_tested + 1) | 8762 // Number of array elements in one test entry (num_args_tested + 1) |
| 8759 intptr_t len = result.TestEntryLength(); | 8763 intptr_t len = result.TestEntryLength(); |
| 8760 // IC data array must be null terminated (sentinel entry). | 8764 // IC data array must be null terminated (sentinel entry). |
| 8761 Array& ic_data = Array::Handle(Array::New(len, Heap::kOld)); | 8765 const Array& ic_data = Array::Handle(Array::New(len, Heap::kOld)); |
| 8762 result.set_ic_data(ic_data); | 8766 result.set_ic_data(ic_data); |
| 8763 return result.raw(); | 8767 return result.raw(); |
| 8764 } | 8768 } |
| 8765 | 8769 |
| 8766 } // namespace dart | 8770 } // namespace dart |
| OLD | NEW |