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 9680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9691 // Frequent case. | 9691 // Frequent case. |
9692 return raw(); | 9692 return raw(); |
9693 } | 9693 } |
9694 const intptr_t kNumArgsTested = 1; | 9694 const intptr_t kNumArgsTested = 1; |
9695 ICData& result = ICData::Handle(ICData::New( | 9695 ICData& result = ICData::Handle(ICData::New( |
9696 Function::Handle(function()), | 9696 Function::Handle(function()), |
9697 String::Handle(target_name()), | 9697 String::Handle(target_name()), |
9698 Array::Handle(arguments_descriptor()), | 9698 Array::Handle(arguments_descriptor()), |
9699 deopt_id(), | 9699 deopt_id(), |
9700 kNumArgsTested)); | 9700 kNumArgsTested)); |
9701 result.set_deopt_reason(deopt_reason()); | |
9702 const intptr_t len = NumberOfChecks(); | 9701 const intptr_t len = NumberOfChecks(); |
9703 for (intptr_t i = 0; i < len; i++) { | 9702 for (intptr_t i = 0; i < len; i++) { |
9704 const intptr_t class_id = GetClassIdAt(i, arg_nr); | 9703 const intptr_t class_id = GetClassIdAt(i, arg_nr); |
9705 const intptr_t count = GetCountAt(i); | 9704 const intptr_t count = GetCountAt(i); |
9706 intptr_t duplicate_class_id = -1; | 9705 intptr_t duplicate_class_id = -1; |
9707 const intptr_t result_len = result.NumberOfChecks(); | 9706 const intptr_t result_len = result.NumberOfChecks(); |
9708 for (intptr_t k = 0; k < result_len; k++) { | 9707 for (intptr_t k = 0; k < result_len; k++) { |
9709 if (class_id == result.GetReceiverClassIdAt(k)) { | 9708 if (class_id == result.GetReceiverClassIdAt(k)) { |
9710 duplicate_class_id = k; | 9709 duplicate_class_id = k; |
9711 break; | 9710 break; |
9712 } | 9711 } |
9713 } | 9712 } |
9714 if (duplicate_class_id >= 0) { | 9713 if (duplicate_class_id >= 0) { |
9715 // This check is valid only when checking the receiver. | 9714 // This check is valid only when checking the receiver. |
9716 ASSERT((arg_nr != 0) || | 9715 ASSERT((arg_nr != 0) || |
9717 (result.GetTargetAt(duplicate_class_id) == GetTargetAt(i))); | 9716 (result.GetTargetAt(duplicate_class_id) == GetTargetAt(i))); |
9718 result.IncrementCountAt(duplicate_class_id, count); | 9717 result.IncrementCountAt(duplicate_class_id, count); |
9719 } else { | 9718 } else { |
9720 // This will make sure that Smi is first if it exists. | 9719 // This will make sure that Smi is first if it exists. |
9721 result.AddReceiverCheck(class_id, | 9720 result.AddReceiverCheck(class_id, |
9722 Function::Handle(GetTargetAt(i)), | 9721 Function::Handle(GetTargetAt(i)), |
9723 count); | 9722 count); |
9724 } | 9723 } |
9725 } | 9724 } |
9726 // Copy deoptimization reason. | 9725 // Copy deoptimization reason. |
9727 result.set_deopt_reason(this->deopt_reason()); | 9726 result.set_deopt_reason(deopt_reason()); |
9728 | 9727 |
9729 return result.raw(); | 9728 return result.raw(); |
9730 } | 9729 } |
9731 | 9730 |
9732 | 9731 |
9733 bool ICData::AllTargetsHaveSameOwner(intptr_t owner_cid) const { | 9732 bool ICData::AllTargetsHaveSameOwner(intptr_t owner_cid) const { |
9734 if (NumberOfChecks() == 0) return false; | 9733 if (NumberOfChecks() == 0) return false; |
9735 Class& cls = Class::Handle(); | 9734 Class& cls = Class::Handle(); |
9736 const intptr_t len = NumberOfChecks(); | 9735 const intptr_t len = NumberOfChecks(); |
9737 for (intptr_t i = 0; i < len; i++) { | 9736 for (intptr_t i = 0; i < len; i++) { |
(...skipping 5299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15037 return "_MirrorReference"; | 15036 return "_MirrorReference"; |
15038 } | 15037 } |
15039 | 15038 |
15040 | 15039 |
15041 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 15040 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
15042 JSONObject jsobj(stream); | 15041 JSONObject jsobj(stream); |
15043 } | 15042 } |
15044 | 15043 |
15045 | 15044 |
15046 } // namespace dart | 15045 } // namespace dart |
OLD | NEW |