Chromium Code Reviews| Index: runtime/vm/assembler_x64.h |
| =================================================================== |
| --- runtime/vm/assembler_x64.h (revision 27208) |
| +++ runtime/vm/assembler_x64.h (working copy) |
| @@ -212,6 +212,18 @@ |
| Operand::operator=(other); |
| return *this; |
| } |
| + |
| + private: |
| + Address(Register base, int32_t disp, bool fixed) { |
| + ASSERT(fixed); |
| + SetModRM(2, base); |
| + if ((base & 7) == RSP) { |
| + SetSIB(TIMES_1, RSP, base); |
| + } |
| + SetDisp32(disp); |
| + } |
| + |
| + friend class Assembler; |
| }; |
| @@ -321,14 +333,8 @@ |
| class Assembler : public ValueObject { |
| public: |
| - explicit Assembler(bool use_far_branches = false) |
| - : buffer_(), |
| - object_pool_(GrowableObjectArray::Handle()), |
| - prologue_offset_(-1), |
| - comments_() { |
| - // This mode is only needed and implemented for MIPS and ARM. |
| - ASSERT(!use_far_branches); |
| - } |
| + explicit Assembler(bool use_far_branches = false); |
| + |
| ~Assembler() { } |
| static const bool kNearJump = true; |
| @@ -342,7 +348,7 @@ |
| void call(Label* label); |
| void call(const ExternalLabel* label); |
| - static const intptr_t kCallExternalLabelSize = 13; |
| + static const intptr_t kCallExternalLabelSize = 10; |
| void pushq(Register reg); |
| void pushq(const Address& address); |
| @@ -652,7 +658,20 @@ |
| void Drop(intptr_t stack_elements); |
| - void LoadObject(Register dst, const Object& object); |
| + enum Patchability { |
| + kPatchable, |
| + kNotPatchable, |
| + }; |
| + |
| + void LoadObjectFromPool(Register dst, const Object& obj, Register pp); |
| + void LoadObject(Register dst, const Object& object) { |
| + LoadObjectFromPool(dst, object, PP); |
| + } |
| + void JmpPatchable(const ExternalLabel* label, Register pp); |
| + void Jmp(const ExternalLabel* label, Register pp); |
| + void J(Condition condition, const ExternalLabel* label, Register pp); |
| + void CallPatchable(const ExternalLabel* label); |
| + void Call(const ExternalLabel* label, Register pp); |
| void StoreObject(const Address& dst, const Object& obj); |
| void PushObject(const Object& object); |
| void CompareObject(Register reg, const Object& object); |
| @@ -680,6 +699,8 @@ |
| void EnterFrame(intptr_t frame_space); |
| void LeaveFrame(); |
| + void LeaveFrameWithPP(); |
| + void ReturnPatchable(); |
| void ReserveAlignedFrameSpace(intptr_t frame_space); |
| // Create a frame for calling into runtime that preserves all volatile |
| @@ -731,6 +752,8 @@ |
| buffer_.FinalizeInstructions(region); |
| } |
| + void LoadPoolPointer(Register pp); |
| + |
| // Set up a Dart frame on entry with a frame pointer and PC information to |
| // enable easy access to the RawInstruction object of code corresponding |
| // to this frame. |
| @@ -739,6 +762,7 @@ |
| // ret PC |
| // saved RBP <=== RBP |
| // pc (used to derive the RawInstruction Object of the dart code) |
| + // saved PP |
| // locals space <=== RSP |
| // ..... |
| // This code sets this up with the sequence: |
| @@ -746,13 +770,17 @@ |
| // movq rbp, rsp |
| // call L |
| // L: <code to adjust saved pc if there is any intrinsification code> |
| + // ... |
| + // pushq r15 |
| // ..... |
| void EnterDartFrame(intptr_t frame_size); |
| + void EnterDartFrameWithInfo(intptr_t frame_size, |
| + Register new_pp, Register new_pc); |
| // Set up a Dart frame for a function compiled for on-stack replacement. |
| // The frame layout is a normal Dart frame, but the frame is partially set |
| // up on entry (it is the frame of the unoptimized code). |
| - void EnterOsrFrame(intptr_t extra_size); |
| + void EnterOsrFrame(intptr_t extra_size, Register new_pp, Register new_pc); |
| // Set up a stub frame so that the stack traversal code can easily identify |
| // a stub frame. |
| @@ -768,8 +796,9 @@ |
| // pushq immediate(0) |
| // ..... |
| void EnterStubFrame(); |
| + void EnterStubFrameWithPP(); |
| - // Instruction pattern from entrypoint is used in dart frame prologs |
| + // Instruction pattern from entrypoint is used in dart frame prologues |
| // to set up the frame and save a PC which can be used to figure out the |
| // RawInstruction object corresponding to the code running in the frame. |
| // entrypoint: |
| @@ -800,9 +829,11 @@ |
| static const char* FpuRegisterName(FpuRegister reg); |
| + void FixedSizeAddressOffsetTest(); |
|
Florian Schneider
2013/09/06 09:58:15
I see - Let me suggest to add a static factory met
zra
2013/09/06 17:53:26
Done.
|
| + |
| private: |
| AssemblerBuffer buffer_; |
| - GrowableObjectArray& object_pool_; // Object pool is not used on x64. |
| + GrowableObjectArray& object_pool_; // Objects and patchable jump targets. |
| int prologue_offset_; |
| class CodeComment : public ZoneAllocated { |
| @@ -822,6 +853,16 @@ |
| GrowableArray<CodeComment*> comments_; |
| + intptr_t FindObject(const Object& obj); |
| + intptr_t FindExternalLabel(const ExternalLabel* label, |
| + Patchability patchable); |
| + void LoadExternalLabel(Register dst, |
| + const ExternalLabel* label, |
| + Patchability patchable, |
| + Register pp); |
| + bool CanLoadFromObjectPool(const Object& object); |
| + void LoadWordFromPoolOffset(Register dst, Register pp, int32_t offset); |
| + |
| inline void EmitUint8(uint8_t value); |
| inline void EmitInt32(int32_t value); |
| inline void EmitInt64(int64_t value); |