| Index: runtime/vm/stub_code_arm.cc
|
| ===================================================================
|
| --- runtime/vm/stub_code_arm.cc (revision 40156)
|
| +++ runtime/vm/stub_code_arm.cc (working copy)
|
| @@ -393,6 +393,25 @@
|
| }
|
|
|
|
|
| +// Called from object allocate instruction when the allocation stub has been
|
| +// disabled.
|
| +void StubCode::GenerateFixAllocationStubTargetStub(Assembler* assembler) {
|
| + __ EnterStubFrame();
|
| + // Setup space on stack for return value.
|
| + __ LoadImmediate(R0, reinterpret_cast<intptr_t>(Object::null()));
|
| + __ Push(R0);
|
| + __ CallRuntime(kFixAllocationStubTargetRuntimeEntry, 0);
|
| + // Get Code object result.
|
| + __ Pop(R0);
|
| + // Remove the stub frame.
|
| + __ LeaveStubFrame();
|
| + // Jump to the dart function.
|
| + __ ldr(R0, FieldAddress(R0, Code::instructions_offset()));
|
| + __ AddImmediate(R0, R0, Instructions::HeaderSize() - kHeapObjectTag);
|
| + __ bx(R0);
|
| +}
|
| +
|
| +
|
| // Input parameters:
|
| // R2: smi-tagged argument count, may be zero.
|
| // FP[kParamEndSlotFromFp + 1]: last argument.
|
| @@ -1027,8 +1046,10 @@
|
| // Input parameters:
|
| // LR : return address.
|
| // SP + 0 : type arguments object (only if class is parameterized).
|
| -void StubCode::GenerateAllocationStubForClass(Assembler* assembler,
|
| - const Class& cls) {
|
| +// Returns patch_code_pc offset where patching code for disabling the stub
|
| +// has been generated (similar to regularly generated Dart code).
|
| +uword StubCode::GenerateAllocationStubForClass(Assembler* assembler,
|
| + const Class& cls) {
|
| // The generated code is different if the class is parameterized.
|
| const bool is_cls_parameterized = cls.NumTypeArguments() > 0;
|
| ASSERT(!is_cls_parameterized ||
|
| @@ -1146,6 +1167,10 @@
|
| // Restore the frame pointer.
|
| __ LeaveStubFrame();
|
| __ Ret();
|
| + uword patch_code_pc_offset = assembler->CodeSize();
|
| + StubCode* stub_code = Isolate::Current()->stub_code();
|
| + __ BranchPatchable(&stub_code->FixAllocationStubTargetLabel());
|
| + return patch_code_pc_offset;
|
| }
|
|
|
|
|
|
|