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

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

Issue 70183010: Fixes a couple problems with GC of unoptimized code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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
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 4093 matching lines...) Expand 10 before | Expand all | Expand 10 after
4104 StorePointer(&raw_ptr()->code_, value.raw()); 4104 StorePointer(&raw_ptr()->code_, value.raw());
4105 ASSERT(Function::Handle(value.function()).IsNull() || 4105 ASSERT(Function::Handle(value.function()).IsNull() ||
4106 (value.function() == this->raw())); 4106 (value.function() == this->raw()));
4107 value.set_function(*this); 4107 value.set_function(*this);
4108 } 4108 }
4109 4109
4110 4110
4111 void Function::DetachCode() const { 4111 void Function::DetachCode() const {
4112 // Set unoptimized code as non-entrant, and set code and unoptimized code 4112 // Set unoptimized code as non-entrant, and set code and unoptimized code
4113 // to null. 4113 // to null.
4114 ASSERT(!HasOptimizedCode());
4114 CodePatcher::PatchEntry(Code::Handle(unoptimized_code())); 4115 CodePatcher::PatchEntry(Code::Handle(unoptimized_code()));
4115 StorePointer(&raw_ptr()->code_, Code::null()); 4116 StorePointer(&raw_ptr()->code_, Code::null());
4116 StorePointer(&raw_ptr()->unoptimized_code_, Code::null()); 4117 StorePointer(&raw_ptr()->unoptimized_code_, Code::null());
4117 } 4118 }
4118 4119
4119 4120
4120 void Function::ReattachCode(const Code& code) const { 4121 void Function::ReattachCode(const Code& code) const {
4122 ASSERT(CurrentCode() == Code::null());
4123 ASSERT(unoptimized_code() == Code::null());
4124 ASSERT(!code.IsNull());
4125 ASSERT(!code.is_optimized());
4121 StorePointer(&raw_ptr()->code_, code.raw()); 4126 StorePointer(&raw_ptr()->code_, code.raw());
4122 StorePointer(&raw_ptr()->unoptimized_code_, code.raw()); 4127 StorePointer(&raw_ptr()->unoptimized_code_, code.raw());
4123 CodePatcher::RestoreEntry(code); 4128 CodePatcher::RestoreEntry(code);
4124 } 4129 }
4125 4130
4126 4131
4127 void Function::SwitchToUnoptimizedCode() const { 4132 void Function::SwitchToUnoptimizedCode() const {
4128 ASSERT(HasOptimizedCode()); 4133 ASSERT(HasOptimizedCode());
4129 4134
4130 const Code& current_code = Code::Handle(CurrentCode()); 4135 const Code& current_code = Code::Handle(CurrentCode());
(...skipping 11633 matching lines...) Expand 10 before | Expand all | Expand 10 after
15764 return "_MirrorReference"; 15769 return "_MirrorReference";
15765 } 15770 }
15766 15771
15767 15772
15768 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 15773 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
15769 JSONObject jsobj(stream); 15774 JSONObject jsobj(stream);
15770 } 15775 }
15771 15776
15772 15777
15773 } // namespace dart 15778 } // namespace dart
OLDNEW
« runtime/vm/gc_marker.cc ('K') | « runtime/vm/object.h ('k') | runtime/vm/pages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698