Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(341)

Side by Side Diff: runtime/vm/object.cc

Issue 10885039: Deoptimization can occur at Dart calls (includes native calls to C) but not at runtime calls. This … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
7282 for (intptr_t i = 0; i < descriptors.Length(); i++) { 7284 for (intptr_t i = 0; i < descriptors.Length(); i++) {
7283 if (descriptors.PC(i) == pc) { 7285 if (descriptors.PC(i) == pc) {
7284 token_pos = descriptors.TokenPos(i); 7286 token_pos = descriptors.TokenPos(i);
7285 break; 7287 break;
7286 } 7288 }
7287 } 7289 }
7288 return token_pos; 7290 return token_pos;
7289 } 7291 }
7290 7292
7291 7293
7292 uword Code::GetDeoptPcAtDeoptId(intptr_t deopt_id) const { 7294 uword Code::GetPcForDeoptId(intptr_t deopt_id, PcDescriptors::Kind kind) const {
7293 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); 7295 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors());
7294 for (intptr_t i = 0; i < descriptors.Length(); i++) { 7296 for (intptr_t i = 0; i < descriptors.Length(); i++) {
7295 if ((descriptors.DeoptId(i) == deopt_id) && 7297 if ((descriptors.DeoptId(i) == deopt_id) &&
7296 (descriptors.DescriptorKind(i) == PcDescriptors::kDeopt)) { 7298 (descriptors.DescriptorKind(i) == kind)) {
7297 return descriptors.PC(i); 7299 uword pc = descriptors.PC(i);
7300 ASSERT((EntryPoint() < pc) && (pc < (EntryPoint() + Size())));
7301 return pc;
7298 } 7302 }
7299 } 7303 }
7300 return 0; 7304 return 0;
7301 } 7305 }
7302 7306
7303 7307
7308 uword Code::GetDeoptBeforePcAtDeoptId(intptr_t deopt_id) const {
7309 ASSERT(!is_optimized());
7310 return GetPcForDeoptId(deopt_id, PcDescriptors::kDeoptBefore);
7311 }
7312
7313
7314 uword Code::GetDeoptAfterPcAtDeoptId(intptr_t deopt_id) const {
7315 ASSERT(!is_optimized());
7316 return GetPcForDeoptId(deopt_id, PcDescriptors::kDeoptAfter);
7317 }
7318
7319
7304 const char* Code::ToCString() const { 7320 const char* Code::ToCString() const {
7305 const char* kFormat = "Code entry:0x%d"; 7321 const char* kFormat = "Code entry:0x%d";
7306 intptr_t len = OS::SNPrint(NULL, 0, kFormat, EntryPoint()) + 1; 7322 intptr_t len = OS::SNPrint(NULL, 0, kFormat, EntryPoint()) + 1;
7307 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); 7323 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len);
7308 OS::SNPrint(chars, len, kFormat, EntryPoint()); 7324 OS::SNPrint(chars, len, kFormat, EntryPoint());
7309 return chars; 7325 return chars;
7310 } 7326 }
7311 7327
7312 7328
7313 uword Code::GetPatchCodePc() const { 7329 uword Code::GetPatchCodePc() const {
(...skipping 3869 matching lines...) Expand 10 before | Expand all | Expand 10 after
11183 } 11199 }
11184 return result.raw(); 11200 return result.raw();
11185 } 11201 }
11186 11202
11187 11203
11188 const char* WeakProperty::ToCString() const { 11204 const char* WeakProperty::ToCString() const {
11189 return "_WeakProperty"; 11205 return "_WeakProperty";
11190 } 11206 }
11191 11207
11192 } // namespace dart 11208 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698