Chromium Code Reviews| Index: runtime/vm/assembler_x64.h |
| =================================================================== |
| --- runtime/vm/assembler_x64.h (revision 27135) |
| +++ runtime/vm/assembler_x64.h (working copy) |
| @@ -183,6 +183,15 @@ |
| } |
| } |
| + Address(Register base, int32_t disp, bool fixed) { |
|
Florian Schneider
2013/09/05 10:57:45
Please add a test to assembler_x64_test.cc for thi
Florian Schneider
2013/09/05 10:57:45
Consider making this private and add Assembler as
zra
2013/09/05 20:29:26
Done.
zra
2013/09/05 20:29:26
Done.
|
| + ASSERT(fixed); |
| + SetModRM(2, base); |
| + if ((base & 7) == RSP) { |
| + SetSIB(TIMES_1, RSP, base); |
| + } |
| + SetDisp32(disp); |
| + } |
| + |
| Address(Register index, ScaleFactor scale, int32_t disp) { |
| ASSERT(index != RSP); // Illegal addressing mode. |
| SetModRM(0, RSP); |
| @@ -321,14 +330,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 +345,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 +655,21 @@ |
| 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); |
|
Florian Schneider
2013/09/05 10:57:45
You really only need
LoadObject(Register dst, co
zra
2013/09/05 20:29:26
LoadObject is used in arch generic code. Changing
Florian Schneider
2013/09/06 09:58:15
Ok. But here is only one arch-independent place in
zra
2013/09/06 17:53:26
Done with pool pointer argument added.
|
| + void LoadObject(Register dst, const Object& object) { |
| + LoadObjectFromPool(dst, object, PP); |
| + } |
| + void JumpPatchable(const ExternalLabel* label, Register pp); |
| + void JumpFromPool(const ExternalLabel* label, Register pp); |
| + void ConditionalJumpFromPool(Condition condition, const ExternalLabel* label, |
| + Register pp); |
| + void CallPatchable(const ExternalLabel* label); |
| + void CallFromPool(const ExternalLabel* label); |
| void StoreObject(const Address& dst, const Object& obj); |
| void PushObject(const Object& object); |
| void CompareObject(Register reg, const Object& object); |
| @@ -680,6 +697,7 @@ |
| void EnterFrame(intptr_t frame_space); |
| void LeaveFrame(); |
| + void LeaveFrameWithPP(); |
| void ReserveAlignedFrameSpace(intptr_t frame_space); |
| // Create a frame for calling into runtime that preserves all volatile |
| @@ -731,6 +749,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 +759,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 +767,15 @@ |
| // 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 EnterDartFrame(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 +791,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: |
| @@ -802,7 +826,7 @@ |
| 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 +846,15 @@ |
| GrowableArray<CodeComment*> comments_; |
| + intptr_t AddObject(const Object& obj); |
| + intptr_t AddExternalLabel(const ExternalLabel* label, Patchability patchable); |
| + void LoadExternalLabel(Register dst, |
| + const ExternalLabel* label, |
| + Patchability patchabe, |
|
Florian Schneider
2013/09/05 10:57:45
s/patchabe/patchable/
zra
2013/09/05 20:29:26
Done.
|
| + 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); |