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

Unified Diff: runtime/vm/code_generator.cc

Issue 1192103004: VM: New calling convention for generated code. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: ARM working, x64 cleanup Created 5 years, 3 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
Index: runtime/vm/code_generator.cc
diff --git a/runtime/vm/code_generator.cc b/runtime/vm/code_generator.cc
index daa15fdb8b1097727a7ab3f0428ed2abfc849546..4a6a1a7aa0cefe0711dad44a9042b2716b7bed63 100644
--- a/runtime/vm/code_generator.cc
+++ b/runtime/vm/code_generator.cc
@@ -674,14 +674,15 @@ DEFINE_RUNTIME_ENTRY(PatchStaticCall, 0) {
const Code& target_code = Code::Handle(target_function.CurrentCode());
// Before patching verify that we are not repeatedly patching to the same
// target.
- ASSERT(target_code.EntryPoint() !=
+ ASSERT(target_code.raw() !=
CodePatcher::GetStaticCallTargetAt(caller_frame->pc(), caller_code));
const Instructions& instrs =
Instructions::Handle(caller_code.instructions());
{
WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size());
- CodePatcher::PatchStaticCallAt(caller_frame->pc(), caller_code,
- target_code.EntryPoint());
+ CodePatcher::PatchStaticCallAt(caller_frame->pc(),
+ caller_code,
+ target_code);
caller_code.SetStaticCallTargetCodeAt(caller_frame->pc(), target_code);
}
if (FLAG_trace_patching) {
@@ -711,11 +712,10 @@ DEFINE_RUNTIME_ENTRY(BreakpointRuntimeHandler, 0) {
DartFrameIterator iterator;
StackFrame* caller_frame = iterator.NextFrame();
ASSERT(caller_frame != NULL);
- uword orig_stub =
- isolate->debugger()->GetPatchedStubAddress(caller_frame->pc());
+ const Code& orig_stub = Code::Handle(
+ isolate->debugger()->GetPatchedStubAddress(caller_frame->pc()));
isolate->debugger()->SignalBpReached();
- ASSERT((orig_stub & kSmiTagMask) == kSmiTag);
- arguments.SetReturn(Smi::Handle(reinterpret_cast<RawSmi*>(orig_stub)));
+ arguments.SetReturn(orig_stub);
}
@@ -1439,7 +1439,9 @@ DEFINE_RUNTIME_ENTRY(StackOverflow, 0) {
uword optimized_entry =
Instructions::Handle(optimized_code.instructions()).EntryPoint();
function.AttachCode(original_code);
+ // TODO(vegorov) figure out if it is GC safe.
rmacnak 2015/09/09 01:37:48 The change to kFirstObjectSlotFromFp makes it safe
Florian Schneider 2015/09/09 13:19:49 I think so too. We do now visit the code object po
frame->set_pc(optimized_entry);
+ frame->set_pc_marker(reinterpret_cast<uword>(optimized_code.raw()));
}
}
}
@@ -1531,8 +1533,9 @@ DEFINE_RUNTIME_ENTRY(FixCallersTarget, 0) {
isolate, caller_code.instructions());
{
WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size());
- CodePatcher::PatchStaticCallAt(frame->pc(), caller_code,
- current_target_code.EntryPoint());
+ CodePatcher::PatchStaticCallAt(frame->pc(),
+ caller_code,
+ current_target_code);
caller_code.SetStaticCallTargetCodeAt(frame->pc(), current_target_code);
}
if (FLAG_trace_patching) {
@@ -1564,9 +1567,8 @@ DEFINE_RUNTIME_ENTRY(FixAllocationStubTarget, 0) {
ASSERT(frame->IsDartFrame());
const Code& caller_code = Code::Handle(isolate, frame->LookupDartCode());
ASSERT(!caller_code.IsNull());
- const uword target =
- CodePatcher::GetStaticCallTargetAt(frame->pc(), caller_code);
- const Code& stub = Code::Handle(isolate, Code::LookupCode(target));
+ const Code& stub = Code::Handle(
+ CodePatcher::GetStaticCallTargetAt(frame->pc(), caller_code));
Class& alloc_class = Class::ZoneHandle(zone);
alloc_class ^= stub.owner();
Code& alloc_stub = Code::Handle(isolate, alloc_class.allocation_stub());
@@ -1580,7 +1582,7 @@ DEFINE_RUNTIME_ENTRY(FixAllocationStubTarget, 0) {
WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size());
CodePatcher::PatchStaticCallAt(frame->pc(),
caller_code,
- alloc_stub.EntryPoint());
+ alloc_stub);
caller_code.SetStubCallTargetCodeAt(frame->pc(), alloc_stub);
}
if (FLAG_trace_patching) {
@@ -1636,11 +1638,11 @@ void DeoptimizeAt(const Code& optimized_code, uword pc) {
Instructions::Handle(zone, optimized_code.instructions());
{
WritableInstructionsScope writable(instrs.EntryPoint(), instrs.size());
- CodePatcher::InsertCallAt(pc, lazy_deopt_jump);
+ CodePatcher::InsertDeoptimizationCallAt(pc, lazy_deopt_jump);
}
if (FLAG_trace_patching) {
const String& name = String::Handle(function.name());
- OS::PrintErr("InsertCallAt: %" Px " to %" Px " for %s\n", pc,
+ OS::PrintErr("InsertDeoptimizationCallAt: %" Px " to %" Px " for %s\n", pc,
lazy_deopt_jump, name.ToCString());
}
// Mark code as dead (do not GC its embedded objects).
@@ -1693,7 +1695,9 @@ static void CopySavedRegisters(uword saved_registers_address,
// Copies saved registers and caller's frame into temporary buffers.
// Returns the stack size of unoptimized frame.
DEFINE_LEAF_RUNTIME_ENTRY(intptr_t, DeoptimizeCopyFrame,
- 1, uword saved_registers_address) {
+ 2,
+ uword saved_registers_address,
+ uword is_lazy_deopt) {
Thread* thread = Thread::Current();
Isolate* isolate = thread->isolate();
StackZone zone(thread);
@@ -1719,9 +1723,12 @@ DEFINE_LEAF_RUNTIME_ENTRY(intptr_t, DeoptimizeCopyFrame,
// Create the DeoptContext.
DeoptContext* deopt_context =
- new DeoptContext(caller_frame, optimized_code,
+ new DeoptContext(caller_frame,
+ optimized_code,
DeoptContext::kDestIsOriginalFrame,
- fpu_registers, cpu_registers);
+ fpu_registers,
+ cpu_registers,
+ is_lazy_deopt != 0);
isolate->set_deopt_context(deopt_context);
// Stack size (FP - SP) in bytes.

Powered by Google App Engine
This is Rietveld 408576698