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

Unified Diff: runtime/vm/object.cc

Issue 11418046: First part of static call cleanup: store static call targets into code object, referenced by code-o… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/raw_object.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 15090)
+++ runtime/vm/object.cc (working copy)
@@ -7007,11 +7007,44 @@
}
-void Code::set_resolved_static_calls(const GrowableObjectArray& val) const {
- StorePointer(&raw_ptr()->resolved_static_calls_, val.raw());
+void Code::set_static_calls_target_table(const Array& value) const {
+ StorePointer(&raw_ptr()->static_calls_target_table_, value.raw());
}
+RawFunction* Code::GetStaticCallTargetFunctionAt(uword pc) const {
+ RawObject* raw_code_offset =
+ reinterpret_cast<RawObject*>(Smi::New(pc - EntryPoint()));
+ const Array& array =
+ Array::Handle(raw_ptr()->static_calls_target_table_);
+ for (intptr_t i = 0; i < array.Length(); i += kSCallTableEntryLength) {
+ if (array.At(i) == raw_code_offset) {
+ Function& function = Function::Handle();
+ function ^= array.At(i + kSCallTableFunctionEntry);
+ return function.raw();
+ }
+ }
+ return Function::null();
+}
+
+
+void Code::SetStaticCallTargetCodeAt(uword pc, const Code& code) const {
+ RawObject* raw_code_offset =
+ reinterpret_cast<RawObject*>(Smi::New(pc - EntryPoint()));
+ const Array& array =
+ Array::Handle(raw_ptr()->static_calls_target_table_);
+ for (intptr_t i = 0; i < array.Length(); i += kSCallTableEntryLength) {
+ if (array.At(i) == raw_code_offset) {
+ ASSERT(code.IsNull() ||
+ (code.function() == array.At(i + kSCallTableFunctionEntry)));
+ array.SetAt(i + kSCallTableCodeEntry, code);
+ return;
+ }
+ }
+ UNREACHABLE();
+}
+
+
const Code::Comments& Code::comments() const {
Comments* comments = new Code::Comments(raw_ptr()->comments_);
return *comments;
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698