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

Unified Diff: runtime/vm/code_generator.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 | « no previous file | runtime/vm/compiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/code_generator.cc
===================================================================
--- runtime/vm/code_generator.cc (revision 15090)
+++ runtime/vm/code_generator.cc (working copy)
@@ -770,46 +770,6 @@
}
-static bool UpdateResolvedStaticCall(const Code& code,
- intptr_t offset,
- const Code& target_code) {
- // PC offsets are mapped to the corresponding code object in the
- // resolved_static_calls array. The array grows as static calls are being
- // resolved.
- const int kOffset = 0;
- const int kCode = 1;
- const int kEntrySize = 2;
-
- GrowableObjectArray& resolved_static_calls =
- GrowableObjectArray::Handle(code.resolved_static_calls());
- intptr_t index = -1;
- if (resolved_static_calls.IsNull()) {
- resolved_static_calls = GrowableObjectArray::New(2, Heap::kOld);
- code.set_resolved_static_calls(resolved_static_calls);
- } else {
- // Search for the offset in the resolved static calls.
- const intptr_t len = resolved_static_calls.Length();
- Object& off = Object::Handle();
- for (intptr_t i = 0; i < len; i += kEntrySize) {
- off = resolved_static_calls.At(i + kOffset);
- if (Smi::Cast(off).Value() == offset) {
- index = i;
- break;
- }
- }
- }
- if (index == -1) {
- // The static call with this offset is not yet present: Add it.
- resolved_static_calls.Add(Smi::Handle(Smi::New(offset)));
- resolved_static_calls.Add(target_code);
- } else {
- // Overwrite the currently recorded target.
- resolved_static_calls.SetAt(index + kCode, target_code);
- }
- return index != -1;
-}
-
-
DEFINE_RUNTIME_ENTRY(PatchStaticCall, 0) {
// This function is called after successful resolving and compilation of
// the target method.
@@ -827,10 +787,7 @@
ASSERT(target != new_target);
CodePatcher::PatchStaticCallAt(caller_frame->pc(), new_target);
const Code& code = Code::Handle(caller_frame->LookupDartCode());
- bool found = UpdateResolvedStaticCall(code,
- caller_frame->pc() - code.EntryPoint(),
- target_code);
- ASSERT(!found);
+ code.SetStaticCallTargetCodeAt(caller_frame->pc(), target_code);
if (FLAG_trace_patching) {
OS::Print("PatchStaticCall: patching from %#"Px" to '%s' %#"Px"\n",
caller_frame->pc(),
@@ -1591,10 +1548,7 @@
ASSERT(target != new_entry_point); // Why patch otherwise.
CodePatcher::PatchStaticCallAt(frame->pc(), new_entry_point);
const Code& code = Code::Handle(frame->LookupDartCode());
- bool found = UpdateResolvedStaticCall(code,
- frame->pc() - code.EntryPoint(),
- target_code);
- ASSERT(found);
+ code.SetStaticCallTargetCodeAt(frame->pc(), target_code);
if (FLAG_trace_patching) {
OS::Print("FixCallersTarget: patching from %#"Px" to '%s' %#"Px"\n",
frame->pc(),
« no previous file with comments | « no previous file | runtime/vm/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698