Index: runtime/vm/assembler_x64.h |
=================================================================== |
--- runtime/vm/assembler_x64.h (revision 26726) |
+++ runtime/vm/assembler_x64.h (working copy) |
@@ -321,14 +321,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 +336,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 +646,32 @@ |
void Drop(intptr_t stack_elements); |
- void LoadObject(Register dst, const Object& object); |
+ enum Patchability { |
+ kPatchable, |
+ kNotPatchable, |
+ }; |
+ |
+ int32_t AddObject(const Object& obj); |
+ int32_t AddExternalLabel(const ExternalLabel* label, |
+ Patchability patchable = kPatchable); |
+ bool CanLoadFromObjectPool(const Object& object); |
Florian Schneider
2013/09/04 09:39:47
I don't see this function used anywhere outside th
zra
2013/09/04 21:00:41
Done.
|
+ void LoadWordFromPoolOffset(Register dst, Register pp, int32_t offset, |
Florian Schneider
2013/09/04 09:39:47
I don't see this function used anywhere outside th
zra
2013/09/04 21:00:41
Done.
|
+ Patchability patchable); |
+ void LoadExternalLabel(const ExternalLabel* label, |
Florian Schneider
2013/09/04 09:39:47
I don't see this function used anywhere outside th
zra
2013/09/04 21:00:41
Done.
|
+ Patchability = kPatchable, |
Florian Schneider
2013/09/04 09:39:47
Max one optional argument, and only if absolutely
zra
2013/09/04 21:00:41
Done.
|
+ Register pp = PP); |
+ |
+ // Load object into register dst. The default patchability is kPatchable |
+ // because LoadObject is used for a load of ic-data in arch independent code |
+ // that must be patchable. |
+ void LoadObject(Register dst, const Object& object, |
+ Patchability patchable = kPatchable, Register pp = PP); |
Florian Schneider
2013/09/04 09:39:47
Max one optional argument, and only if absolutely
zra
2013/09/04 21:00:41
Done.
|
+ void JumpPatchable(const ExternalLabel* label, Register pp = PP); |
+ void JumpFromPool(const ExternalLabel* label, Register pp = PP); |
+ void JumpFromPool(Condition condition, const ExternalLabel* label, |
+ Register pp = 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); |
@@ -679,7 +698,7 @@ |
} |
void EnterFrame(intptr_t frame_space); |
- void LeaveFrame(); |
+ void LeaveFrame(bool restore_pp = false); |
Florian Schneider
2013/09/04 09:39:47
This optional argument seems dangerous, too. Try t
zra
2013/09/04 21:00:41
Done.
|
void ReserveAlignedFrameSpace(intptr_t frame_space); |
// Create a frame for calling into runtime that preserves all volatile |
@@ -731,6 +750,8 @@ |
buffer_.FinalizeInstructions(region); |
} |
+ void LoadPoolPointer(Register pp = 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 +760,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 +768,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 EnterDartFrame(intptr_t frame_size, |
+ Register new_pp = PP, Register new_pc = kNoRegister); |
Florian Schneider
2013/09/04 09:39:47
Again, two optional arguments is not a good idea,
zra
2013/09/04 21:00:41
Done.
|
// 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 = PP, Register new_pc = kNoRegister); |
Florian Schneider
2013/09/04 09:39:47
Again, two optional arguments is not a good idea,
zra
2013/09/04 21:00:41
Done.
|
// Set up a stub frame so that the stack traversal code can easily identify |
// a stub frame. |
@@ -767,9 +793,9 @@ |
// movq rbp, rsp |
// pushq immediate(0) |
// ..... |
- void EnterStubFrame(); |
+ void EnterStubFrame(bool save_pp = false); |
Florian Schneider
2013/09/04 09:39:47
This optional argument seems dangerous, too. Try t
zra
2013/09/04 21:00:41
Done.
|
- // 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 +828,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 { |