| OLD | NEW |
| 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 4090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4101 | 4101 |
| 4102 | 4102 |
| 4103 void Function::SetCode(const Code& value) const { | 4103 void Function::SetCode(const Code& value) const { |
| 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 { | |
| 4112 // Set unoptimized code as non-entrant, and set code and unoptimized code | |
| 4113 // to null. | |
| 4114 CodePatcher::PatchEntry(Code::Handle(unoptimized_code())); | |
| 4115 StorePointer(&raw_ptr()->code_, Code::null()); | |
| 4116 StorePointer(&raw_ptr()->unoptimized_code_, Code::null()); | |
| 4117 } | |
| 4118 | |
| 4119 | |
| 4120 void Function::ReattachCode(const Code& code) const { | |
| 4121 StorePointer(&raw_ptr()->code_, code.raw()); | |
| 4122 StorePointer(&raw_ptr()->unoptimized_code_, code.raw()); | |
| 4123 CodePatcher::RestoreEntry(code); | |
| 4124 } | |
| 4125 | |
| 4126 | |
| 4127 void Function::SwitchToUnoptimizedCode() const { | 4111 void Function::SwitchToUnoptimizedCode() const { |
| 4128 ASSERT(HasOptimizedCode()); | 4112 ASSERT(HasOptimizedCode()); |
| 4129 | 4113 |
| 4130 const Code& current_code = Code::Handle(CurrentCode()); | 4114 const Code& current_code = Code::Handle(CurrentCode()); |
| 4131 | 4115 |
| 4132 // Optimized code object might have been actually fully produced by the | 4116 // Optimized code object might have been actually fully produced by the |
| 4133 // intrinsifier in this case nothing has to be done. In fact an attempt to | 4117 // intrinsifier in this case nothing has to be done. In fact an attempt to |
| 4134 // patch such code will cause crash. | 4118 // patch such code will cause crash. |
| 4135 // TODO(vegorov): if intrisifier can fully intrinsify the function then we | 4119 // TODO(vegorov): if intrisifier can fully intrinsify the function then we |
| 4136 // should not later try to optimize it. | 4120 // should not later try to optimize it. |
| (...skipping 11627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15764 return "_MirrorReference"; | 15748 return "_MirrorReference"; |
| 15765 } | 15749 } |
| 15766 | 15750 |
| 15767 | 15751 |
| 15768 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { | 15752 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { |
| 15769 JSONObject jsobj(stream); | 15753 JSONObject jsobj(stream); |
| 15770 } | 15754 } |
| 15771 | 15755 |
| 15772 | 15756 |
| 15773 } // namespace dart | 15757 } // namespace dart |
| OLD | NEW |