diff options
Diffstat (limited to 'deps/v8/src/x64/macro-assembler-x64.h')
-rw-r--r-- | deps/v8/src/x64/macro-assembler-x64.h | 118 |
1 files changed, 90 insertions, 28 deletions
diff --git a/deps/v8/src/x64/macro-assembler-x64.h b/deps/v8/src/x64/macro-assembler-x64.h index d9893d621..2ab05cf1a 100644 --- a/deps/v8/src/x64/macro-assembler-x64.h +++ b/deps/v8/src/x64/macro-assembler-x64.h @@ -5,9 +5,9 @@ #ifndef V8_X64_MACRO_ASSEMBLER_X64_H_ #define V8_X64_MACRO_ASSEMBLER_X64_H_ -#include "assembler.h" -#include "frames.h" -#include "v8globals.h" +#include "src/assembler.h" +#include "src/frames.h" +#include "src/globals.h" namespace v8 { namespace internal { @@ -29,6 +29,10 @@ typedef Operand MemOperand; enum RememberedSetAction { EMIT_REMEMBERED_SET, OMIT_REMEMBERED_SET }; enum SmiCheck { INLINE_SMI_CHECK, OMIT_SMI_CHECK }; +enum PointersToHereCheck { + kPointersToHereMaybeInteresting, + kPointersToHereAreAlwaysInteresting +}; enum SmiOperationConstraint { PRESERVE_SOURCE_REGISTER, @@ -46,7 +50,16 @@ class SmiOperationExecutionMode : public EnumSet<SmiOperationConstraint, byte> { : EnumSet<SmiOperationConstraint, byte>(bits) { } }; -bool AreAliased(Register r1, Register r2, Register r3, Register r4); +#ifdef DEBUG +bool AreAliased(Register reg1, + Register reg2, + Register reg3 = no_reg, + Register reg4 = no_reg, + Register reg5 = no_reg, + Register reg6 = no_reg, + Register reg7 = no_reg, + Register reg8 = no_reg); +#endif // Forward declaration. class JumpTarget; @@ -220,7 +233,9 @@ class MacroAssembler: public Assembler { Register scratch, SaveFPRegsMode save_fp, RememberedSetAction remembered_set_action = EMIT_REMEMBERED_SET, - SmiCheck smi_check = INLINE_SMI_CHECK); + SmiCheck smi_check = INLINE_SMI_CHECK, + PointersToHereCheck pointers_to_here_check_for_value = + kPointersToHereMaybeInteresting); // As above, but the offset has the tag presubtracted. For use with // Operand(reg, off). @@ -231,14 +246,17 @@ class MacroAssembler: public Assembler { Register scratch, SaveFPRegsMode save_fp, RememberedSetAction remembered_set_action = EMIT_REMEMBERED_SET, - SmiCheck smi_check = INLINE_SMI_CHECK) { + SmiCheck smi_check = INLINE_SMI_CHECK, + PointersToHereCheck pointers_to_here_check_for_value = + kPointersToHereMaybeInteresting) { RecordWriteField(context, offset + kHeapObjectTag, value, scratch, save_fp, remembered_set_action, - smi_check); + smi_check, + pointers_to_here_check_for_value); } // Notify the garbage collector that we wrote a pointer into a fixed array. @@ -253,7 +271,15 @@ class MacroAssembler: public Assembler { Register index, SaveFPRegsMode save_fp, RememberedSetAction remembered_set_action = EMIT_REMEMBERED_SET, - SmiCheck smi_check = INLINE_SMI_CHECK); + SmiCheck smi_check = INLINE_SMI_CHECK, + PointersToHereCheck pointers_to_here_check_for_value = + kPointersToHereMaybeInteresting); + + void RecordWriteForMap( + Register object, + Register map, + Register dst, + SaveFPRegsMode save_fp); // For page containing |object| mark region covering |address| // dirty. |object| is the object being stored into, |value| is the @@ -266,7 +292,9 @@ class MacroAssembler: public Assembler { Register value, SaveFPRegsMode save_fp, RememberedSetAction remembered_set_action = EMIT_REMEMBERED_SET, - SmiCheck smi_check = INLINE_SMI_CHECK); + SmiCheck smi_check = INLINE_SMI_CHECK, + PointersToHereCheck pointers_to_here_check_for_value = + kPointersToHereMaybeInteresting); // --------------------------------------------------------------------------- // Debugger Support @@ -274,7 +302,8 @@ class MacroAssembler: public Assembler { void DebugBreak(); // Generates function and stub prologue code. - void Prologue(PrologueFrameMode frame_mode); + void StubPrologue(); + void Prologue(bool code_pre_aging); // Enter specific kind of exit frame; either in normal or // debug mode. Expects the number of arguments in register rax and @@ -469,10 +498,18 @@ class MacroAssembler: public Assembler { // Test-and-jump functions. Typically combines a check function // above with a conditional jump. + // Jump if the value can be represented by a smi. + void JumpIfValidSmiValue(Register src, Label* on_valid, + Label::Distance near_jump = Label::kFar); + // Jump if the value cannot be represented by a smi. void JumpIfNotValidSmiValue(Register src, Label* on_invalid, Label::Distance near_jump = Label::kFar); + // Jump if the unsigned integer value can be represented by a smi. + void JumpIfUIntValidSmiValue(Register src, Label* on_valid, + Label::Distance near_jump = Label::kFar); + // Jump if the unsigned integer value cannot be represented by a smi. void JumpIfUIntNotValidSmiValue(Register src, Label* on_invalid, Label::Distance near_jump = Label::kFar); @@ -630,7 +667,9 @@ class MacroAssembler: public Assembler { void SmiShiftLeftConstant(Register dst, Register src, - int shift_value); + int shift_value, + Label* on_not_smi_result = NULL, + Label::Distance near_jump = Label::kFar); void SmiShiftLogicalRightConstant(Register dst, Register src, int shift_value, @@ -644,7 +683,9 @@ class MacroAssembler: public Assembler { // Uses and clobbers rcx, so dst may not be rcx. void SmiShiftLeft(Register dst, Register src1, - Register src2); + Register src2, + Label* on_not_smi_result = NULL, + Label::Distance near_jump = Label::kFar); // Shifts a smi value to the right, shifting in zero bits at the top, and // returns the unsigned intepretation of the result if that is a smi. // Uses and clobbers rcx, so dst may not be rcx. @@ -841,15 +882,15 @@ class MacroAssembler: public Assembler { void Move(Register dst, void* ptr, RelocInfo::Mode rmode) { // This method must not be used with heap object references. The stored // address is not GC safe. Use the handle version instead. - ASSERT(rmode > RelocInfo::LAST_GCED_ENUM); + DCHECK(rmode > RelocInfo::LAST_GCED_ENUM); movp(dst, ptr, rmode); } void Move(Register dst, Handle<Object> value, RelocInfo::Mode rmode) { AllowDeferredHandleDereference using_raw_address; - ASSERT(!RelocInfo::IsNone(rmode)); - ASSERT(value->IsHeapObject()); - ASSERT(!isolate()->heap()->InNewSpace(*value)); + DCHECK(!RelocInfo::IsNone(rmode)); + DCHECK(value->IsHeapObject()); + DCHECK(!isolate()->heap()->InNewSpace(*value)); movp(dst, reinterpret_cast<void*>(value.location()), rmode); } @@ -1003,7 +1044,7 @@ class MacroAssembler: public Assembler { MinusZeroMode minus_zero_mode, Label* lost_precision, Label::Distance dst = Label::kFar); - void LoadUint32(XMMRegister dst, Register src, XMMRegister scratch); + void LoadUint32(XMMRegister dst, Register src); void LoadInstanceDescriptors(Register map, Register descriptors); void EnumLength(Register dst, Register map); @@ -1011,11 +1052,32 @@ class MacroAssembler: public Assembler { template<typename Field> void DecodeField(Register reg) { - static const int shift = Field::kShift + kSmiShift; + static const int shift = Field::kShift; static const int mask = Field::kMask >> Field::kShift; - shrp(reg, Immediate(shift)); + if (shift != 0) { + shrp(reg, Immediate(shift)); + } andp(reg, Immediate(mask)); - shlp(reg, Immediate(kSmiShift)); + } + + template<typename Field> + void DecodeFieldToSmi(Register reg) { + if (SmiValuesAre32Bits()) { + andp(reg, Immediate(Field::kMask)); + shlp(reg, Immediate(kSmiShift - Field::kShift)); + } else { + static const int shift = Field::kShift; + static const int mask = (Field::kMask >> Field::kShift) << kSmiTagSize; + DCHECK(SmiValuesAre31Bits()); + DCHECK(kSmiShift == kSmiTagSize); + DCHECK((mask & 0x80000000u) == 0); + if (shift < kSmiShift) { + shlp(reg, Immediate(kSmiShift - shift)); + } else if (shift > kSmiShift) { + sarp(reg, Immediate(shift - kSmiShift)); + } + andp(reg, Immediate(mask)); + } } // Abort execution if argument is not a number, enabled via --debug-code. @@ -1064,12 +1126,6 @@ class MacroAssembler: public Assembler { // Propagate an uncatchable exception out of the current JS stack. void ThrowUncatchable(Register value); - // Throw a message string as an exception. - void Throw(BailoutReason reason); - - // Throw a message string as an exception if a condition is not true. - void ThrowIf(Condition cc, BailoutReason reason); - // --------------------------------------------------------------------------- // Inline caching support @@ -1139,7 +1195,8 @@ class MacroAssembler: public Assembler { // space is full. void AllocateHeapNumber(Register result, Register scratch, - Label* gc_required); + Label* gc_required, + MutableMode mode = IMMUTABLE); // Allocate a sequential string. All the header fields of the string object // are initialized. @@ -1330,7 +1387,7 @@ class MacroAssembler: public Assembler { void Ret(int bytes_dropped, Register scratch); Handle<Object> CodeObject() { - ASSERT(!code_object_.is_null()); + DCHECK(!code_object_.is_null()); return code_object_; } @@ -1478,6 +1535,11 @@ class MacroAssembler: public Assembler { Register scratch, AllocationFlags flags); + void MakeSureDoubleAlignedHelper(Register result, + Register scratch, + Label* gc_required, + AllocationFlags flags); + // Update allocation top with value in result_end register. // If scratch is valid, it contains the address of the allocation top. void UpdateAllocationTopHelper(Register result_end, |