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 7100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7111 } | 7111 } |
7112 for (intptr_t i = 1; i < saved_length; i++) { | 7112 for (intptr_t i = 1; i < saved_length; i++) { |
7113 ICData& ic_data = ICData::ZoneHandle(zone); | 7113 ICData& ic_data = ICData::ZoneHandle(zone); |
7114 ic_data ^= saved_ic_data.At(i); | 7114 ic_data ^= saved_ic_data.At(i); |
7115 (*deopt_id_to_ic_data)[ic_data.deopt_id()] = &ic_data; | 7115 (*deopt_id_to_ic_data)[ic_data.deopt_id()] = &ic_data; |
7116 } | 7116 } |
7117 } | 7117 } |
7118 } | 7118 } |
7119 | 7119 |
7120 | 7120 |
7121 void Function::CopyICDataMap( | |
7122 ZoneGrowableArray<const ICData*>* deopt_id_to_ic_data) const { | |
7123 ASSERT(deopt_id_to_ic_data->is_empty()); | |
7124 Zone* zone = Thread::Current()->zone(); | |
7125 const Array& saved_ic_data = Array::Handle(zone, ic_data_array()); | |
7126 if (saved_ic_data.IsNull()) { | |
7127 return; | |
7128 } | |
7129 const intptr_t saved_length = saved_ic_data.Length(); | |
7130 ASSERT(saved_length > 0); | |
7131 if (saved_length > 1) { | |
7132 const intptr_t restored_length = ICData::Cast(Object::Handle( | |
7133 zone, saved_ic_data.At(saved_length - 1))).deopt_id() + 1; | |
7134 deopt_id_to_ic_data->SetLength(restored_length); | |
7135 for (intptr_t i = 0; i < restored_length; i++) { | |
7136 (*deopt_id_to_ic_data)[i] = NULL; | |
7137 } | |
7138 for (intptr_t i = 1; i < saved_length; i++) { | |
7139 ICData& ic_data = ICData::ZoneHandle(zone); | |
7140 ic_data ^= saved_ic_data.At(i); | |
7141 ic_data = ICData::CloneDescriptor(ic_data); | |
7142 (*deopt_id_to_ic_data)[ic_data.deopt_id()] = &ic_data; | |
7143 } | |
7144 } | |
7145 } | |
7146 | |
7147 | |
7121 void Function::set_ic_data_array(const Array& value) const { | 7148 void Function::set_ic_data_array(const Array& value) const { |
7122 StorePointer(&raw_ptr()->ic_data_array_, value.raw()); | 7149 StorePointer(&raw_ptr()->ic_data_array_, value.raw()); |
7123 } | 7150 } |
7124 | 7151 |
7125 | 7152 |
7126 RawArray* Function::ic_data_array() const { | 7153 RawArray* Function::ic_data_array() const { |
7127 return raw_ptr()->ic_data_array_; | 7154 return raw_ptr()->ic_data_array_; |
7128 } | 7155 } |
7129 | 7156 |
7130 | 7157 |
(...skipping 5587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
12718 String::Handle(from.target_name()), | 12745 String::Handle(from.target_name()), |
12719 Array::Handle(from.arguments_descriptor()), | 12746 Array::Handle(from.arguments_descriptor()), |
12720 from.deopt_id(), | 12747 from.deopt_id(), |
12721 num_args_tested)); | 12748 num_args_tested)); |
12722 // Copy deoptimization reasons. | 12749 // Copy deoptimization reasons. |
12723 result.SetDeoptReasons(from.DeoptReasons()); | 12750 result.SetDeoptReasons(from.DeoptReasons()); |
12724 return result.raw(); | 12751 return result.raw(); |
12725 } | 12752 } |
12726 | 12753 |
12727 | 12754 |
12755 RawICData* ICData::CloneDescriptor(const ICData& from) { | |
12756 Zone* zone = Thread::Current()->zone(); | |
12757 const ICData& result = ICData::Handle(ICData::NewDescriptor( | |
12758 zone, | |
12759 Function::Handle(zone, from.owner()), | |
12760 String::Handle(zone, from.target_name()), | |
12761 Array::Handle(zone, from.arguments_descriptor()), | |
12762 from.deopt_id(), | |
12763 from.NumArgsTested())); | |
12764 // Preserve entry array. | |
12765 result.set_ic_data_array(Array::Handle(zone, from.ic_data())); | |
siva
2015/10/27 23:36:45
The ic_data array doesn't have to be cloned?
srdjan
2015/10/28 16:54:43
No. Added the following comment in .h:
// Gener
| |
12766 // Copy deoptimization reasons. | |
12767 result.SetDeoptReasons(from.DeoptReasons()); | |
12768 return result.raw(); | |
12769 } | |
12770 | |
12771 | |
12728 void ICData::PrintJSONImpl(JSONStream* stream, bool ref) const { | 12772 void ICData::PrintJSONImpl(JSONStream* stream, bool ref) const { |
12729 JSONObject jsobj(stream); | 12773 JSONObject jsobj(stream); |
12730 AddCommonObjectProperties(&jsobj, "Object", ref); | 12774 AddCommonObjectProperties(&jsobj, "Object", ref); |
12731 jsobj.AddServiceId(*this); | 12775 jsobj.AddServiceId(*this); |
12732 jsobj.AddProperty("_owner", Object::Handle(owner())); | 12776 jsobj.AddProperty("_owner", Object::Handle(owner())); |
12733 jsobj.AddProperty("_selector", String::Handle(target_name()).ToCString()); | 12777 jsobj.AddProperty("_selector", String::Handle(target_name()).ToCString()); |
12734 if (ref) { | 12778 if (ref) { |
12735 return; | 12779 return; |
12736 } | 12780 } |
12737 jsobj.AddProperty("_argumentsDescriptor", | 12781 jsobj.AddProperty("_argumentsDescriptor", |
(...skipping 9089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
21827 return tag_label.ToCString(); | 21871 return tag_label.ToCString(); |
21828 } | 21872 } |
21829 | 21873 |
21830 | 21874 |
21831 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 21875 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
21832 Instance::PrintJSONImpl(stream, ref); | 21876 Instance::PrintJSONImpl(stream, ref); |
21833 } | 21877 } |
21834 | 21878 |
21835 | 21879 |
21836 } // namespace dart | 21880 } // namespace dart |
OLD | NEW |