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

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

Issue 326703003: Simplify code disabling logic in WeakCodeReferences. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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 | « no previous file | no next file » | 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/cpu.h" 10 #include "vm/cpu.h"
(...skipping 2505 matching lines...) Expand 10 before | Expand all | Expand 10 after
2516 } else if (function.unoptimized_code() == code.raw()) { 2516 } else if (function.unoptimized_code() == code.raw()) {
2517 ReportSwitchingCode(code); 2517 ReportSwitchingCode(code);
2518 // Remove the code object from the function. The next time the 2518 // Remove the code object from the function. The next time the
2519 // function is invoked, it will be compiled again. 2519 // function is invoked, it will be compiled again.
2520 function.ClearCode(); 2520 function.ClearCode();
2521 // Invalidate the old code object so existing references to it 2521 // Invalidate the old code object so existing references to it
2522 // (from optimized code) will fail when invoked. 2522 // (from optimized code) will fail when invoked.
2523 if (!CodePatcher::IsEntryPatched(code)) { 2523 if (!CodePatcher::IsEntryPatched(code)) {
2524 CodePatcher::PatchEntry(code); 2524 CodePatcher::PatchEntry(code);
2525 } 2525 }
2526 } else if (!function.HasCode() && (code.GetEntryPatchPc() != 0)) { 2526 } else {
2527 // The code has already been disconnected, make it invalid. Do not 2527 // Make non-OSR code non-entrant.
2528 // bother with OSR compiled code that has no valid entry-patch. 2528 if (code.GetEntryPatchPc() != 0) {
2529 ReportSwitchingCode(code); 2529 if (!CodePatcher::IsEntryPatched(code)) {
2530 if (!CodePatcher::IsEntryPatched(code)) { 2530 ReportSwitchingCode(code);
2531 CodePatcher::PatchEntry(code); 2531 CodePatcher::PatchEntry(code);
2532 }
2532 } 2533 }
2533 } 2534 }
2534 } 2535 }
2535 } 2536 }
2536 2537
2537 private: 2538 private:
2538 const Array& array_; 2539 const Array& array_;
2539 DISALLOW_COPY_AND_ASSIGN(WeakCodeReferences); 2540 DISALLOW_COPY_AND_ASSIGN(WeakCodeReferences);
2540 }; 2541 };
2541 2542
(...skipping 7098 matching lines...) Expand 10 before | Expand all | Expand 10 after
9640 virtual void ReportDeoptimization(const Code& code) { 9641 virtual void ReportDeoptimization(const Code& code) {
9641 // This gets called when the code object is on the stack 9642 // This gets called when the code object is on the stack
9642 // while nuking code that depends on a prefix. We don't expect 9643 // while nuking code that depends on a prefix. We don't expect
9643 // this to happen, so make sure we die loudly if we find 9644 // this to happen, so make sure we die loudly if we find
9644 // ourselves here. 9645 // ourselves here.
9645 UNIMPLEMENTED(); 9646 UNIMPLEMENTED();
9646 } 9647 }
9647 9648
9648 virtual void ReportSwitchingCode(const Code& code) { 9649 virtual void ReportSwitchingCode(const Code& code) {
9649 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { 9650 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) {
9650 OS::PrintErr("Prefix '%s': deleting %s code for %s function '%s'\n", 9651 OS::PrintErr("Prefix '%s': disabling %s code for %s function '%s'\n",
9651 String::Handle(prefix_.name()).ToCString(), 9652 String::Handle(prefix_.name()).ToCString(),
9652 code.is_optimized() ? "optimized" : "unoptimized", 9653 code.is_optimized() ? "optimized" : "unoptimized",
9653 CodePatcher::IsEntryPatched(code) ? "patched" : "unpatched", 9654 CodePatcher::IsEntryPatched(code) ? "patched" : "unpatched",
9654 Function::Handle(code.function()).ToCString()); 9655 Function::Handle(code.function()).ToCString());
9655 } 9656 }
9656 } 9657 }
9657 9658
9658 private: 9659 private:
9659 const LibraryPrefix& prefix_; 9660 const LibraryPrefix& prefix_;
9660 DISALLOW_COPY_AND_ASSIGN(PrefixDependentArray); 9661 DISALLOW_COPY_AND_ASSIGN(PrefixDependentArray);
(...skipping 9352 matching lines...) Expand 10 before | Expand all | Expand 10 after
19013 return tag_label.ToCString(); 19014 return tag_label.ToCString();
19014 } 19015 }
19015 19016
19016 19017
19017 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 19018 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
19018 Instance::PrintJSONImpl(stream, ref); 19019 Instance::PrintJSONImpl(stream, ref);
19019 } 19020 }
19020 19021
19021 19022
19022 } // namespace dart 19023 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698