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

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
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/pages.h » ('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/cpu.h" 10 #include "vm/cpu.h"
(...skipping 4085 matching lines...) Expand 10 before | Expand all | Expand 10 after
4096 4096
4097 4097
4098 void Function::SetCode(const Code& value) const { 4098 void Function::SetCode(const Code& value) const {
4099 StorePointer(&raw_ptr()->code_, value.raw()); 4099 StorePointer(&raw_ptr()->code_, value.raw());
4100 ASSERT(Function::Handle(value.function()).IsNull() || 4100 ASSERT(Function::Handle(value.function()).IsNull() ||
4101 (value.function() == this->raw())); 4101 (value.function() == this->raw()));
4102 value.set_function(*this); 4102 value.set_function(*this);
4103 } 4103 }
4104 4104
4105 4105
4106 void Function::DetachCode() const {
4107 // Set unoptimized code as non-entrant, and set code and unoptimized code
4108 // to null.
4109 CodePatcher::PatchEntry(Code::Handle(unoptimized_code()));
4110 StorePointer(&raw_ptr()->code_, Code::null());
4111 StorePointer(&raw_ptr()->unoptimized_code_, Code::null());
4112 }
4113
4114
4115 void Function::ReattachCode(const Code& code) const {
4116 StorePointer(&raw_ptr()->code_, code.raw());
4117 StorePointer(&raw_ptr()->unoptimized_code_, code.raw());
4118 CodePatcher::RestoreEntry(code);
4119 }
4120
4121
4122 void Function::SwitchToUnoptimizedCode() const { 4106 void Function::SwitchToUnoptimizedCode() const {
4123 ASSERT(HasOptimizedCode()); 4107 ASSERT(HasOptimizedCode());
4124 4108
4125 const Code& current_code = Code::Handle(CurrentCode()); 4109 const Code& current_code = Code::Handle(CurrentCode());
4126 4110
4127 // Optimized code object might have been actually fully produced by the 4111 // Optimized code object might have been actually fully produced by the
4128 // intrinsifier in this case nothing has to be done. In fact an attempt to 4112 // intrinsifier in this case nothing has to be done. In fact an attempt to
4129 // patch such code will cause crash. 4113 // patch such code will cause crash.
4130 // TODO(vegorov): if intrisifier can fully intrinsify the function then we 4114 // TODO(vegorov): if intrisifier can fully intrinsify the function then we
4131 // should not later try to optimize it. 4115 // should not later try to optimize it.
(...skipping 11873 matching lines...) Expand 10 before | Expand all | Expand 10 after
16005 return "_MirrorReference"; 15989 return "_MirrorReference";
16006 } 15990 }
16007 15991
16008 15992
16009 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 15993 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
16010 Instance::PrintToJSONStream(stream, ref); 15994 Instance::PrintToJSONStream(stream, ref);
16011 } 15995 }
16012 15996
16013 15997
16014 } // namespace dart 15998 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/pages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698