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

Unified Diff: runtime/vm/object.cc

Issue 27802002: Disconnects code objects from infrequently used unoptimized functions. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/pages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« 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