| 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/bigint_operations.h" | 10 #include "vm/bigint_operations.h" |
| (...skipping 3891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3902 | 3902 |
| 3903 | 3903 |
| 3904 void Function::set_num_optional_parameters(intptr_t n) const { | 3904 void Function::set_num_optional_parameters(intptr_t n) const { |
| 3905 ASSERT(n >= 0); | 3905 ASSERT(n >= 0); |
| 3906 raw_ptr()->num_optional_parameters_ = n; | 3906 raw_ptr()->num_optional_parameters_ = n; |
| 3907 } | 3907 } |
| 3908 | 3908 |
| 3909 | 3909 |
| 3910 bool Function::is_optimizable() const { | 3910 bool Function::is_optimizable() const { |
| 3911 return OptimizableBit::decode(raw_ptr()->kind_tag_) && | 3911 return OptimizableBit::decode(raw_ptr()->kind_tag_) && |
| 3912 (script() != Script::null()); | 3912 (script() != Script::null()) && |
| 3913 !is_native(); |
| 3913 } | 3914 } |
| 3914 | 3915 |
| 3915 | 3916 |
| 3916 void Function::set_is_optimizable(bool value) const { | 3917 void Function::set_is_optimizable(bool value) const { |
| 3917 uword bits = raw_ptr()->kind_tag_; | 3918 uword bits = raw_ptr()->kind_tag_; |
| 3918 raw_ptr()->kind_tag_ = OptimizableBit::update(value, bits); | 3919 raw_ptr()->kind_tag_ = OptimizableBit::update(value, bits); |
| 3919 } | 3920 } |
| 3920 | 3921 |
| 3921 | 3922 |
| 3922 void Function::set_has_finally(bool value) const { | 3923 void Function::set_has_finally(bool value) const { |
| (...skipping 2724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6647 NoGCScope no_gc; | 6648 NoGCScope no_gc; |
| 6648 result ^= raw; | 6649 result ^= raw; |
| 6649 result.SetLength(num_descriptors); | 6650 result.SetLength(num_descriptors); |
| 6650 } | 6651 } |
| 6651 return result.raw(); | 6652 return result.raw(); |
| 6652 } | 6653 } |
| 6653 | 6654 |
| 6654 | 6655 |
| 6655 const char* PcDescriptors::KindAsStr(intptr_t index) const { | 6656 const char* PcDescriptors::KindAsStr(intptr_t index) const { |
| 6656 switch (DescriptorKind(index)) { | 6657 switch (DescriptorKind(index)) { |
| 6657 case PcDescriptors::kDeopt: return "deopt "; | 6658 case PcDescriptors::kDeoptBefore: return "deopt-before "; |
| 6658 case PcDescriptors::kDeoptIndex: return "deopt-ix"; | 6659 case PcDescriptors::kDeoptAfter: return "deopt-after "; |
| 6659 case PcDescriptors::kPatchCode: return "patch "; | 6660 case PcDescriptors::kDeoptIndex: return "deopt-ix "; |
| 6660 case PcDescriptors::kIcCall: return "ic-call "; | 6661 case PcDescriptors::kPatchCode: return "patch "; |
| 6661 case PcDescriptors::kFuncCall: return "fn-call "; | 6662 case PcDescriptors::kIcCall: return "ic-call "; |
| 6662 case PcDescriptors::kReturn: return "return "; | 6663 case PcDescriptors::kFuncCall: return "fn-call "; |
| 6663 case PcDescriptors::kOther: return "other "; | 6664 case PcDescriptors::kReturn: return "return "; |
| 6665 case PcDescriptors::kOther: return "other "; |
| 6664 } | 6666 } |
| 6665 UNREACHABLE(); | 6667 UNREACHABLE(); |
| 6666 return ""; | 6668 return ""; |
| 6667 } | 6669 } |
| 6668 | 6670 |
| 6669 | 6671 |
| 6670 void PcDescriptors::PrintHeaderString() { | 6672 void PcDescriptors::PrintHeaderString() { |
| 6671 // 4 bits per hex digit + 2 for "0x". | 6673 // 4 bits per hex digit + 2 for "0x". |
| 6672 const int addr_width = (kBitsPerWord / 4) + 2; | 6674 const int addr_width = (kBitsPerWord / 4) + 2; |
| 6673 // "*" in a printf format specifier tells it to read the field width from | 6675 // "*" in a printf format specifier tells it to read the field width from |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6735 OS::Print("Not checking pc decriptors, length %d\n", Length()); | 6737 OS::Print("Not checking pc decriptors, length %d\n", Length()); |
| 6736 } | 6738 } |
| 6737 return; | 6739 return; |
| 6738 } | 6740 } |
| 6739 for (intptr_t i = 0; i < Length(); i++) { | 6741 for (intptr_t i = 0; i < Length(); i++) { |
| 6740 uword pc = PC(i); | 6742 uword pc = PC(i); |
| 6741 PcDescriptors::Kind kind = DescriptorKind(i); | 6743 PcDescriptors::Kind kind = DescriptorKind(i); |
| 6742 // 'deopt_id' is set for kDeopt and kIcCall and must be unique for one kind. | 6744 // 'deopt_id' is set for kDeopt and kIcCall and must be unique for one kind. |
| 6743 intptr_t deopt_id = Isolate::kNoDeoptId; | 6745 intptr_t deopt_id = Isolate::kNoDeoptId; |
| 6744 if (check_ids) { | 6746 if (check_ids) { |
| 6745 if ((DescriptorKind(i) == PcDescriptors::kDeopt) || | 6747 if ((DescriptorKind(i) == PcDescriptors::kDeoptBefore) || |
| 6746 (DescriptorKind(i) == PcDescriptors::kIcCall)) { | 6748 (DescriptorKind(i) == PcDescriptors::kIcCall)) { |
| 6747 deopt_id = DeoptId(i); | 6749 deopt_id = DeoptId(i); |
| 6748 } | 6750 } |
| 6749 } | 6751 } |
| 6750 for (intptr_t k = i + 1; k < Length(); k++) { | 6752 for (intptr_t k = i + 1; k < Length(); k++) { |
| 6751 if (kind == DescriptorKind(k)) { | 6753 if (kind == DescriptorKind(k)) { |
| 6752 if (deopt_id != Isolate::kNoDeoptId) { | 6754 if (deopt_id != Isolate::kNoDeoptId) { |
| 6753 ASSERT(DeoptId(k) != deopt_id); | 6755 ASSERT(DeoptId(k) != deopt_id); |
| 6754 } | 6756 } |
| 6755 ASSERT(pc != PC(k)); | 6757 ASSERT(pc != PC(k)); |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7279 for (intptr_t i = 0; i < descriptors.Length(); i++) { | 7281 for (intptr_t i = 0; i < descriptors.Length(); i++) { |
| 7280 if (descriptors.PC(i) == pc) { | 7282 if (descriptors.PC(i) == pc) { |
| 7281 token_pos = descriptors.TokenPos(i); | 7283 token_pos = descriptors.TokenPos(i); |
| 7282 break; | 7284 break; |
| 7283 } | 7285 } |
| 7284 } | 7286 } |
| 7285 return token_pos; | 7287 return token_pos; |
| 7286 } | 7288 } |
| 7287 | 7289 |
| 7288 | 7290 |
| 7289 uword Code::GetDeoptPcAtDeoptId(intptr_t deopt_id) const { | 7291 uword Code::GetPcForDeoptId(intptr_t deopt_id, PcDescriptors::Kind kind) const { |
| 7290 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); | 7292 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); |
| 7291 for (intptr_t i = 0; i < descriptors.Length(); i++) { | 7293 for (intptr_t i = 0; i < descriptors.Length(); i++) { |
| 7292 if ((descriptors.DeoptId(i) == deopt_id) && | 7294 if ((descriptors.DeoptId(i) == deopt_id) && |
| 7293 (descriptors.DescriptorKind(i) == PcDescriptors::kDeopt)) { | 7295 (descriptors.DescriptorKind(i) == kind)) { |
| 7294 return descriptors.PC(i); | 7296 return descriptors.PC(i); |
| 7295 } | 7297 } |
| 7296 } | 7298 } |
| 7297 return 0; | 7299 return 0; |
| 7298 } | 7300 } |
| 7299 | 7301 |
| 7300 | 7302 |
| 7303 uword Code::GetDeoptBeforePcAtDeoptId(intptr_t deopt_id) const { |
| 7304 return GetPcForDeoptId(deopt_id, PcDescriptors::kDeoptBefore); |
| 7305 } |
| 7306 |
| 7307 |
| 7308 uword Code::GetDeoptAfterPcAtDeoptId(intptr_t deopt_id) const { |
| 7309 return GetPcForDeoptId(deopt_id, PcDescriptors::kDeoptAfter); |
| 7310 } |
| 7311 |
| 7312 |
| 7301 const char* Code::ToCString() const { | 7313 const char* Code::ToCString() const { |
| 7302 const char* kFormat = "Code entry:0x%d"; | 7314 const char* kFormat = "Code entry:0x%d"; |
| 7303 intptr_t len = OS::SNPrint(NULL, 0, kFormat, EntryPoint()) + 1; | 7315 intptr_t len = OS::SNPrint(NULL, 0, kFormat, EntryPoint()) + 1; |
| 7304 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 7316 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 7305 OS::SNPrint(chars, len, kFormat, EntryPoint()); | 7317 OS::SNPrint(chars, len, kFormat, EntryPoint()); |
| 7306 return chars; | 7318 return chars; |
| 7307 } | 7319 } |
| 7308 | 7320 |
| 7309 | 7321 |
| 7310 uword Code::GetPatchCodePc() const { | 7322 uword Code::GetPatchCodePc() const { |
| (...skipping 3869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11180 } | 11192 } |
| 11181 return result.raw(); | 11193 return result.raw(); |
| 11182 } | 11194 } |
| 11183 | 11195 |
| 11184 | 11196 |
| 11185 const char* WeakProperty::ToCString() const { | 11197 const char* WeakProperty::ToCString() const { |
| 11186 return "_WeakProperty"; | 11198 return "_WeakProperty"; |
| 11187 } | 11199 } |
| 11188 | 11200 |
| 11189 } // namespace dart | 11201 } // namespace dart |
| OLD | NEW |