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

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

Issue 296853002: Fix code invalidation of functions with references to deferred libraries (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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/code_generator.cc ('k') | 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 2496 matching lines...) Expand 10 before | Expand all | Expand 10 after
2507 continue; 2507 continue;
2508 } 2508 }
2509 2509
2510 function ^= code.function(); 2510 function ^= code.function();
2511 // If function uses dependent code switch it to unoptimized. 2511 // If function uses dependent code switch it to unoptimized.
2512 if (code.is_optimized() && (function.CurrentCode() == code.raw())) { 2512 if (code.is_optimized() && (function.CurrentCode() == code.raw())) {
2513 ReportSwitchingCode(code); 2513 ReportSwitchingCode(code);
2514 function.SwitchToUnoptimizedCode(); 2514 function.SwitchToUnoptimizedCode();
2515 } else if (function.unoptimized_code() == code.raw()) { 2515 } else if (function.unoptimized_code() == code.raw()) {
2516 ReportSwitchingCode(code); 2516 ReportSwitchingCode(code);
2517 // Remove the code object from the function. The next time the
2518 // function is invoked, it will be compiled again.
2517 function.ClearCode(); 2519 function.ClearCode();
2520 // Invalidate the old code object so existing references to it
2521 // (from optimized code) will fail when invoked.
2522 if (!CodePatcher::IsEntryPatched(code)) {
2523 CodePatcher::PatchEntry(code);
2524 }
2518 } 2525 }
2519 } 2526 }
2520 } 2527 }
2521 2528
2522 private: 2529 private:
2523 const Array& array_; 2530 const Array& array_;
2524 DISALLOW_COPY_AND_ASSIGN(WeakCodeReferences); 2531 DISALLOW_COPY_AND_ASSIGN(WeakCodeReferences);
2525 }; 2532 };
2526 2533
2527 2534
(...skipping 7024 matching lines...) Expand 10 before | Expand all | Expand 10 after
9552 virtual void ReportDeoptimization(const Code& code) { 9559 virtual void ReportDeoptimization(const Code& code) {
9553 // This gets called when the code object is on the stack 9560 // This gets called when the code object is on the stack
9554 // while nuking code that depends on a prefix. We don't expect 9561 // while nuking code that depends on a prefix. We don't expect
9555 // this to happen, so make sure we die loudly if we find 9562 // this to happen, so make sure we die loudly if we find
9556 // ourselves here. 9563 // ourselves here.
9557 UNIMPLEMENTED(); 9564 UNIMPLEMENTED();
9558 } 9565 }
9559 9566
9560 virtual void ReportSwitchingCode(const Code& code) { 9567 virtual void ReportSwitchingCode(const Code& code) {
9561 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) { 9568 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) {
9562 OS::PrintErr("Prefix '%s': deleting %s code for function '%s'\n", 9569 OS::PrintErr("Prefix '%s': deleting %s code for %s function '%s'\n",
9563 String::Handle(prefix_.name()).ToCString(), 9570 String::Handle(prefix_.name()).ToCString(),
9564 code.is_optimized() ? "optimized" : "unoptimized", 9571 code.is_optimized() ? "optimized" : "unoptimized",
9572 CodePatcher::IsEntryPatched(code) ? "patched" : "unpatched",
9565 Function::Handle(code.function()).ToCString()); 9573 Function::Handle(code.function()).ToCString());
9566 } 9574 }
9567 } 9575 }
9568 9576
9569 private: 9577 private:
9570 const LibraryPrefix& prefix_; 9578 const LibraryPrefix& prefix_;
9571 DISALLOW_COPY_AND_ASSIGN(PrefixDependentArray); 9579 DISALLOW_COPY_AND_ASSIGN(PrefixDependentArray);
9572 }; 9580 };
9573 9581
9574 9582
(...skipping 9271 matching lines...) Expand 10 before | Expand all | Expand 10 after
18846 return tag_label.ToCString(); 18854 return tag_label.ToCString();
18847 } 18855 }
18848 18856
18849 18857
18850 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 18858 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
18851 Instance::PrintJSONImpl(stream, ref); 18859 Instance::PrintJSONImpl(stream, ref);
18852 } 18860 }
18853 18861
18854 18862
18855 } // namespace dart 18863 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/code_generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698