Chromium Code Reviews| 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 11416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11427 } | 11427 } |
| 11428 | 11428 |
| 11429 | 11429 |
| 11430 void ICData::SetDeoptReasons(uint32_t reasons) const { | 11430 void ICData::SetDeoptReasons(uint32_t reasons) const { |
| 11431 StoreNonPointer(&raw_ptr()->state_bits_, | 11431 StoreNonPointer(&raw_ptr()->state_bits_, |
| 11432 DeoptReasonBits::update(reasons, raw_ptr()->state_bits_)); | 11432 DeoptReasonBits::update(reasons, raw_ptr()->state_bits_)); |
| 11433 } | 11433 } |
| 11434 | 11434 |
| 11435 | 11435 |
| 11436 bool ICData::HasDeoptReason(DeoptReasonId reason) const { | 11436 bool ICData::HasDeoptReason(DeoptReasonId reason) const { |
| 11437 ASSERT(reason <= kLastRecordedDeoptReason); | |
| 11437 return (DeoptReasons() & (1 << reason)) != 0; | 11438 return (DeoptReasons() & (1 << reason)) != 0; |
| 11438 } | 11439 } |
| 11439 | 11440 |
| 11440 | 11441 |
| 11441 void ICData::AddDeoptReason(DeoptReasonId reason) const { | 11442 void ICData::AddDeoptReason(DeoptReasonId reason) const { |
| 11442 SetDeoptReasons(DeoptReasons() | (1 << reason)); | 11443 if (reason <= kLastRecordedDeoptReason) { |
|
zra
2014/12/15 20:57:38
Why is this not an assert?
Vyacheslav Egorov (Google)
2014/12/15 21:02:21
Caller (deoptimizer) can try to add deopt reason w
zra
2014/12/15 21:04:58
Makes sense. I think it's fine as-is. Thanks!
| |
| 11444 SetDeoptReasons(DeoptReasons() | (1 << reason)); | |
| 11445 } | |
| 11443 } | 11446 } |
| 11444 | 11447 |
| 11445 | 11448 |
| 11446 bool ICData::IssuedJSWarning() const { | 11449 bool ICData::IssuedJSWarning() const { |
| 11447 return IssuedJSWarningBit::decode(raw_ptr()->state_bits_); | 11450 return IssuedJSWarningBit::decode(raw_ptr()->state_bits_); |
| 11448 } | 11451 } |
| 11449 | 11452 |
| 11450 | 11453 |
| 11451 void ICData::SetIssuedJSWarning() const { | 11454 void ICData::SetIssuedJSWarning() const { |
| 11452 StoreNonPointer(&raw_ptr()->state_bits_, | 11455 StoreNonPointer(&raw_ptr()->state_bits_, |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 11465 } | 11468 } |
| 11466 // Warning issued in ic miss handler. | 11469 // Warning issued in ic miss handler. |
| 11467 // No decoding necessary, so allow optimization if warning already issued. | 11470 // No decoding necessary, so allow optimization if warning already issued. |
| 11468 if (name.Equals(Symbols::toString()) && !IssuedJSWarning()) { | 11471 if (name.Equals(Symbols::toString()) && !IssuedJSWarning()) { |
| 11469 return true; | 11472 return true; |
| 11470 } | 11473 } |
| 11471 return false; | 11474 return false; |
| 11472 } | 11475 } |
| 11473 | 11476 |
| 11474 | 11477 |
| 11475 void ICData::set_range_feedback(uint32_t feedback) { | |
| 11476 StoreNonPointer(&raw_ptr()->range_feedback_, feedback); | |
| 11477 } | |
| 11478 | |
| 11479 | |
| 11480 void ICData::set_state_bits(uint32_t bits) const { | 11478 void ICData::set_state_bits(uint32_t bits) const { |
| 11481 StoreNonPointer(&raw_ptr()->state_bits_, bits); | 11479 StoreNonPointer(&raw_ptr()->state_bits_, bits); |
| 11482 } | 11480 } |
| 11483 | 11481 |
| 11484 | 11482 |
| 11485 intptr_t ICData::TestEntryLengthFor(intptr_t num_args) { | 11483 intptr_t ICData::TestEntryLengthFor(intptr_t num_args) { |
| 11486 return num_args + 1 /* target function*/ + 1 /* frequency */; | 11484 return num_args + 1 /* target function*/ + 1 /* frequency */; |
| 11487 } | 11485 } |
| 11488 | 11486 |
| 11489 | 11487 |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11925 ICData::InstanceSize(), | 11923 ICData::InstanceSize(), |
| 11926 Heap::kOld); | 11924 Heap::kOld); |
| 11927 NoGCScope no_gc; | 11925 NoGCScope no_gc; |
| 11928 result ^= raw; | 11926 result ^= raw; |
| 11929 } | 11927 } |
| 11930 result.set_owner(owner); | 11928 result.set_owner(owner); |
| 11931 result.set_target_name(target_name); | 11929 result.set_target_name(target_name); |
| 11932 result.set_arguments_descriptor(arguments_descriptor); | 11930 result.set_arguments_descriptor(arguments_descriptor); |
| 11933 result.set_deopt_id(deopt_id); | 11931 result.set_deopt_id(deopt_id); |
| 11934 result.set_state_bits(0); | 11932 result.set_state_bits(0); |
| 11935 result.set_range_feedback(0); | |
| 11936 result.SetNumArgsTested(num_args_tested); | 11933 result.SetNumArgsTested(num_args_tested); |
| 11937 // Number of array elements in one test entry. | 11934 // Number of array elements in one test entry. |
| 11938 intptr_t len = result.TestEntryLength(); | 11935 intptr_t len = result.TestEntryLength(); |
| 11939 // IC data array must be null terminated (sentinel entry). | 11936 // IC data array must be null terminated (sentinel entry). |
| 11940 const Array& ic_data = Array::Handle(Array::New(len, Heap::kOld)); | 11937 const Array& ic_data = Array::Handle(Array::New(len, Heap::kOld)); |
| 11941 result.set_ic_data(ic_data); | 11938 result.set_ic_data(ic_data); |
| 11942 result.WriteSentinel(ic_data); | 11939 result.WriteSentinel(ic_data); |
| 11943 return result.raw(); | 11940 return result.raw(); |
| 11944 } | 11941 } |
| 11945 | 11942 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12006 } | 12003 } |
| 12007 } | 12004 } |
| 12008 } | 12005 } |
| 12009 | 12006 |
| 12010 return initialized; | 12007 return initialized; |
| 12011 } | 12008 } |
| 12012 | 12009 |
| 12013 | 12010 |
| 12014 ICData::RangeFeedback ICData::DecodeRangeFeedbackAt(intptr_t idx) const { | 12011 ICData::RangeFeedback ICData::DecodeRangeFeedbackAt(intptr_t idx) const { |
| 12015 ASSERT((0 <= idx) && (idx < 3)); | 12012 ASSERT((0 <= idx) && (idx < 3)); |
| 12013 const uint32_t raw_feedback = | |
| 12014 RangeFeedbackBits::decode(raw_ptr()->state_bits_); | |
| 12016 const uint32_t feedback = | 12015 const uint32_t feedback = |
| 12017 (range_feedback() >> (idx * kBitsPerRangeFeedback)) & kRangeFeedbackMask; | 12016 (raw_feedback >> (idx * kBitsPerRangeFeedback)) & kRangeFeedbackMask; |
| 12018 if ((feedback & kInt64RangeBit) != 0) { | 12017 if ((feedback & kInt64RangeBit) != 0) { |
| 12019 return kInt64Range; | 12018 return kInt64Range; |
| 12020 } | 12019 } |
| 12021 | 12020 |
| 12022 if ((feedback & kUint32RangeBit) != 0) { | 12021 if ((feedback & kUint32RangeBit) != 0) { |
| 12023 if ((feedback & kSignedRangeBit) == 0) { | 12022 if ((feedback & kSignedRangeBit) == 0) { |
| 12024 return kUint32Range; | 12023 return kUint32Range; |
| 12025 } | 12024 } |
| 12026 | 12025 |
| 12027 // Check if Smi is large enough to accomodate Int33: a mixture of Uint32 | 12026 // Check if Smi is large enough to accomodate Int33: a mixture of Uint32 |
| (...skipping 8557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 20585 return tag_label.ToCString(); | 20584 return tag_label.ToCString(); |
| 20586 } | 20585 } |
| 20587 | 20586 |
| 20588 | 20587 |
| 20589 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20588 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 20590 Instance::PrintJSONImpl(stream, ref); | 20589 Instance::PrintJSONImpl(stream, ref); |
| 20591 } | 20590 } |
| 20592 | 20591 |
| 20593 | 20592 |
| 20594 } // namespace dart | 20593 } // namespace dart |
| OLD | NEW |