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 8203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8214 PcDescriptors::Handle(this->pc_descriptors()); | 8214 PcDescriptors::Handle(this->pc_descriptors()); |
8215 ICData& ic_data_obj = ICData::Handle(); | 8215 ICData& ic_data_obj = ICData::Handle(); |
8216 intptr_t max_id = -1; | 8216 intptr_t max_id = -1; |
8217 for (intptr_t i = 0; i < descriptors.Length(); i++) { | 8217 for (intptr_t i = 0; i < descriptors.Length(); i++) { |
8218 if (descriptors.DescriptorKind(i) == PcDescriptors::kIcCall) { | 8218 if (descriptors.DescriptorKind(i) == PcDescriptors::kIcCall) { |
8219 intptr_t deopt_id = descriptors.DeoptId(i); | 8219 intptr_t deopt_id = descriptors.DeoptId(i); |
8220 if (deopt_id > max_id) { | 8220 if (deopt_id > max_id) { |
8221 max_id = deopt_id; | 8221 max_id = deopt_id; |
8222 } | 8222 } |
8223 node_ids->Add(deopt_id); | 8223 node_ids->Add(deopt_id); |
8224 CodePatcher::GetInstanceCallAt(descriptors.PC(i), *this, | 8224 CodePatcher::GetInstanceCallAt(descriptors.PC(i), *this, &ic_data_obj); |
8225 &ic_data_obj, NULL); | |
8226 ic_data_objs.Add(ic_data_obj); | 8225 ic_data_objs.Add(ic_data_obj); |
8227 } | 8226 } |
8228 } | 8227 } |
8229 return max_id; | 8228 return max_id; |
8230 } | 8229 } |
8231 | 8230 |
8232 | 8231 |
8233 RawArray* Code::ExtractTypeFeedbackArray() const { | 8232 RawArray* Code::ExtractTypeFeedbackArray() const { |
8234 ASSERT(!IsNull() && !is_optimized()); | 8233 ASSERT(!IsNull() && !is_optimized()); |
8235 GrowableArray<intptr_t> deopt_ids; | 8234 GrowableArray<intptr_t> deopt_ids; |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8449 void ICData::set_function(const Function& value) const { | 8448 void ICData::set_function(const Function& value) const { |
8450 StorePointer(&raw_ptr()->function_, value.raw()); | 8449 StorePointer(&raw_ptr()->function_, value.raw()); |
8451 } | 8450 } |
8452 | 8451 |
8453 | 8452 |
8454 void ICData::set_target_name(const String& value) const { | 8453 void ICData::set_target_name(const String& value) const { |
8455 StorePointer(&raw_ptr()->target_name_, value.raw()); | 8454 StorePointer(&raw_ptr()->target_name_, value.raw()); |
8456 } | 8455 } |
8457 | 8456 |
8458 | 8457 |
| 8458 void ICData::set_arguments_descriptor(const Array& value) const { |
| 8459 StorePointer(&raw_ptr()->args_descriptor_, value.raw()); |
| 8460 } |
| 8461 |
8459 void ICData::set_deopt_id(intptr_t value) const { | 8462 void ICData::set_deopt_id(intptr_t value) const { |
8460 raw_ptr()->deopt_id_ = value; | 8463 raw_ptr()->deopt_id_ = value; |
8461 } | 8464 } |
8462 | 8465 |
8463 | 8466 |
8464 void ICData::set_num_args_tested(intptr_t value) const { | 8467 void ICData::set_num_args_tested(intptr_t value) const { |
8465 raw_ptr()->num_args_tested_ = value; | 8468 raw_ptr()->num_args_tested_ = value; |
8466 } | 8469 } |
8467 | 8470 |
8468 | 8471 |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8690 ASSERT(!IsNull()); | 8693 ASSERT(!IsNull()); |
8691 ASSERT(num_args_tested() > arg_nr); | 8694 ASSERT(num_args_tested() > arg_nr); |
8692 if ((arg_nr == 0) && (num_args_tested() == 1)) { | 8695 if ((arg_nr == 0) && (num_args_tested() == 1)) { |
8693 // Frequent case. | 8696 // Frequent case. |
8694 return raw(); | 8697 return raw(); |
8695 } | 8698 } |
8696 const intptr_t kNumArgsTested = 1; | 8699 const intptr_t kNumArgsTested = 1; |
8697 ICData& result = ICData::Handle(ICData::New( | 8700 ICData& result = ICData::Handle(ICData::New( |
8698 Function::Handle(function()), | 8701 Function::Handle(function()), |
8699 String::Handle(target_name()), | 8702 String::Handle(target_name()), |
| 8703 Array::Handle(arguments_descriptor()), |
8700 deopt_id(), | 8704 deopt_id(), |
8701 kNumArgsTested)); | 8705 kNumArgsTested)); |
8702 const intptr_t len = NumberOfChecks(); | 8706 const intptr_t len = NumberOfChecks(); |
8703 for (intptr_t i = 0; i < len; i++) { | 8707 for (intptr_t i = 0; i < len; i++) { |
8704 const intptr_t class_id = GetClassIdAt(i, arg_nr); | 8708 const intptr_t class_id = GetClassIdAt(i, arg_nr); |
8705 const intptr_t count = GetCountAt(i); | 8709 const intptr_t count = GetCountAt(i); |
8706 intptr_t duplicate_class_id = -1; | 8710 intptr_t duplicate_class_id = -1; |
8707 const intptr_t result_len = result.NumberOfChecks(); | 8711 const intptr_t result_len = result.NumberOfChecks(); |
8708 for (intptr_t k = 0; k < result_len; k++) { | 8712 for (intptr_t k = 0; k < result_len; k++) { |
8709 if (class_id == result.GetReceiverClassIdAt(k)) { | 8713 if (class_id == result.GetReceiverClassIdAt(k)) { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8785 if (GetTargetAt(i) != first_target.raw()) { | 8789 if (GetTargetAt(i) != first_target.raw()) { |
8786 return false; | 8790 return false; |
8787 } | 8791 } |
8788 } | 8792 } |
8789 return true; | 8793 return true; |
8790 } | 8794 } |
8791 | 8795 |
8792 | 8796 |
8793 RawICData* ICData::New(const Function& function, | 8797 RawICData* ICData::New(const Function& function, |
8794 const String& target_name, | 8798 const String& target_name, |
| 8799 const Array& arguments_descriptor, |
8795 intptr_t deopt_id, | 8800 intptr_t deopt_id, |
8796 intptr_t num_args_tested) { | 8801 intptr_t num_args_tested) { |
8797 ASSERT(Object::icdata_class() != Class::null()); | 8802 ASSERT(Object::icdata_class() != Class::null()); |
8798 ASSERT(num_args_tested > 0); | 8803 ASSERT(num_args_tested > 0); |
8799 ICData& result = ICData::Handle(); | 8804 ICData& result = ICData::Handle(); |
8800 { | 8805 { |
8801 // IC data objects are long living objects, allocate them in old generation. | 8806 // IC data objects are long living objects, allocate them in old generation. |
8802 RawObject* raw = Object::Allocate(ICData::kClassId, | 8807 RawObject* raw = Object::Allocate(ICData::kClassId, |
8803 ICData::InstanceSize(), | 8808 ICData::InstanceSize(), |
8804 Heap::kOld); | 8809 Heap::kOld); |
8805 NoGCScope no_gc; | 8810 NoGCScope no_gc; |
8806 result ^= raw; | 8811 result ^= raw; |
8807 } | 8812 } |
8808 result.set_function(function); | 8813 result.set_function(function); |
8809 result.set_target_name(target_name); | 8814 result.set_target_name(target_name); |
| 8815 result.set_arguments_descriptor(arguments_descriptor); |
8810 result.set_deopt_id(deopt_id); | 8816 result.set_deopt_id(deopt_id); |
8811 result.set_num_args_tested(num_args_tested); | 8817 result.set_num_args_tested(num_args_tested); |
8812 result.set_deopt_reason(kDeoptUnknown); | 8818 result.set_deopt_reason(kDeoptUnknown); |
8813 result.set_is_closure_call(false); | 8819 result.set_is_closure_call(false); |
8814 // Number of array elements in one test entry. | 8820 // Number of array elements in one test entry. |
8815 intptr_t len = result.TestEntryLength(); | 8821 intptr_t len = result.TestEntryLength(); |
8816 // IC data array must be null terminated (sentinel entry). | 8822 // IC data array must be null terminated (sentinel entry). |
8817 const Array& ic_data = Array::Handle(Array::New(len, Heap::kOld)); | 8823 const Array& ic_data = Array::Handle(Array::New(len, Heap::kOld)); |
8818 result.set_ic_data(ic_data); | 8824 result.set_ic_data(ic_data); |
8819 result.WriteSentinel(ic_data); | 8825 result.WriteSentinel(ic_data); |
(...skipping 4803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13623 space); | 13629 space); |
13624 return reinterpret_cast<RawWeakProperty*>(raw); | 13630 return reinterpret_cast<RawWeakProperty*>(raw); |
13625 } | 13631 } |
13626 | 13632 |
13627 | 13633 |
13628 const char* WeakProperty::ToCString() const { | 13634 const char* WeakProperty::ToCString() const { |
13629 return "_WeakProperty"; | 13635 return "_WeakProperty"; |
13630 } | 13636 } |
13631 | 13637 |
13632 } // namespace dart | 13638 } // namespace dart |
OLD | NEW |