Index: runtime/vm/object.cc |
=================================================================== |
--- runtime/vm/object.cc (revision 29013) |
+++ runtime/vm/object.cc (working copy) |
@@ -4038,6 +4038,22 @@ |
} |
+void Function::DetachCode() const { |
+ // Set unoptimized code as non-entrant, and set code and unoptimized code |
+ // to null. |
+ CodePatcher::PatchEntry(Code::Handle(unoptimized_code())); |
+ StorePointer(&raw_ptr()->code_, Code::null()); |
+ StorePointer(&raw_ptr()->unoptimized_code_, Code::null()); |
+} |
+ |
+ |
+void Function::ReattachCode(const Code& code) const { |
+ set_unoptimized_code(code); |
+ SetCode(code); |
+ CodePatcher::RestoreEntry(code); |
+} |
+ |
+ |
void Function::SwitchToUnoptimizedCode() const { |
ASSERT(HasOptimizedCode()); |
@@ -4066,6 +4082,7 @@ |
void Function::set_unoptimized_code(const Code& value) const { |
+ ASSERT(!value.is_optimized()); |
StorePointer(&raw_ptr()->unoptimized_code_, value.raw()); |
} |
@@ -9272,6 +9289,19 @@ |
} |
+RawCode* Code::GetStaticCallTargetCodeAt(uword pc) const { |
+ const intptr_t i = BinarySearchInSCallTable(pc); |
+ if (i < 0) { |
+ return Code::null(); |
+ } |
+ const Array& array = |
+ Array::Handle(raw_ptr()->static_calls_target_table_); |
+ Code& code = Code::Handle(); |
+ code ^= array.At(i + kSCallTableCodeEntry); |
+ return code.raw(); |
+} |
+ |
+ |
void Code::SetStaticCallTargetCodeAt(uword pc, const Code& code) const { |
const intptr_t i = BinarySearchInSCallTable(pc); |
ASSERT(i >= 0); |