| Index: runtime/vm/code_generator.cc
|
| diff --git a/runtime/vm/code_generator.cc b/runtime/vm/code_generator.cc
|
| index 4485c5805227d4a233ff785db0b9a708b42021e8..3ef39bf8b04d14bdcaf5f69f6b6c3667c2f5c1e1 100644
|
| --- a/runtime/vm/code_generator.cc
|
| +++ b/runtime/vm/code_generator.cc
|
| @@ -664,14 +664,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) {
|
| @@ -702,11 +703,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);
|
| }
|
|
|
|
|
| @@ -1276,7 +1276,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.
|
| frame->set_pc(optimized_entry);
|
| + frame->set_pc_marker(reinterpret_cast<uword>(optimized_code.raw()));
|
| }
|
| }
|
| }
|
| @@ -1362,8 +1364,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) {
|
| @@ -1395,9 +1398,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());
|
| @@ -1411,7 +1413,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) {
|
| @@ -1524,7 +1526,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) {
|
| Isolate* isolate = Isolate::Current();
|
| StackZone zone(isolate);
|
| HANDLESCOPE(isolate);
|
| @@ -1549,9 +1553,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.
|
|
|