diff options
Diffstat (limited to 'deps/v8/src/assembler.h')
-rw-r--r-- | deps/v8/src/assembler.h | 87 |
1 files changed, 54 insertions, 33 deletions
diff --git a/deps/v8/src/assembler.h b/deps/v8/src/assembler.h index ce7d9f5b7..0349b0658 100644 --- a/deps/v8/src/assembler.h +++ b/deps/v8/src/assembler.h @@ -82,6 +82,10 @@ class AssemblerBase: public Malloced { int pc_offset() const { return static_cast<int>(pc_ - buffer_); } + // This function is called when code generation is aborted, so that + // the assembler could clean up internal data structures. + virtual void AbortedCodeGeneration() { } + static const int kMinimalBufferSize = 4*KB; protected: @@ -210,6 +214,12 @@ class Label BASE_EMBEDDED { friend class Assembler; friend class Displacement; friend class RegExpMacroAssemblerIrregexp; + +#if V8_TARGET_ARCH_ARM64 + // On ARM64, the Assembler keeps track of pointers to Labels to resolve + // branches to distant targets. Copying labels would confuse the Assembler. + DISALLOW_COPY_AND_ASSIGN(Label); // NOLINT +#endif }; @@ -276,9 +286,10 @@ class RelocInfo BASE_EMBEDDED { EXTERNAL_REFERENCE, // The address of an external C++ function. INTERNAL_REFERENCE, // An address inside the same function. - // Marks a constant pool. Only used on ARM. - // It uses a custom noncompact encoding. + // Marks constant and veneer pools. Only used on ARM and ARM64. + // They use a custom noncompact encoding. CONST_POOL, + VENEER_POOL, // add more as needed // Pseudo-types @@ -288,7 +299,7 @@ class RelocInfo BASE_EMBEDDED { CODE_AGE_SEQUENCE, // Not stored in RelocInfo array, used explictly by // code aging. FIRST_REAL_RELOC_MODE = CODE_TARGET, - LAST_REAL_RELOC_MODE = CONST_POOL, + LAST_REAL_RELOC_MODE = VENEER_POOL, FIRST_PSEUDO_RELOC_MODE = CODE_AGE_SEQUENCE, LAST_PSEUDO_RELOC_MODE = CODE_AGE_SEQUENCE, LAST_CODE_ENUM = DEBUG_BREAK, @@ -342,6 +353,9 @@ class RelocInfo BASE_EMBEDDED { static inline bool IsConstPool(Mode mode) { return mode == CONST_POOL; } + static inline bool IsVeneerPool(Mode mode) { + return mode == VENEER_POOL; + } static inline bool IsPosition(Mode mode) { return mode == POSITION || mode == STATEMENT_POSITION; } @@ -365,6 +379,15 @@ class RelocInfo BASE_EMBEDDED { } static inline int ModeMask(Mode mode) { return 1 << mode; } + // Returns true if the first RelocInfo has the same mode and raw data as the + // second one. + static inline bool IsEqual(RelocInfo first, RelocInfo second) { + return first.rmode() == second.rmode() && + (first.rmode() == RelocInfo::NONE64 ? + first.raw_data64() == second.raw_data64() : + first.data() == second.data()); + } + // Accessors byte* pc() const { return pc_; } void set_pc(byte* pc) { pc_ = pc; } @@ -375,6 +398,7 @@ class RelocInfo BASE_EMBEDDED { return BitCast<uint64_t>(data64_); } Code* host() const { return host_; } + void set_host(Code* host) { host_ = host; } // Apply a relocation by delta bytes INLINE(void apply(intptr_t delta)); @@ -384,6 +408,10 @@ class RelocInfo BASE_EMBEDDED { // instructions). bool IsCodedSpecially(); + // If true, the pointer this relocation info refers to is an entry in the + // constant pool, otherwise the pointer is embedded in the instruction stream. + bool IsInConstantPool(); + // Read/modify the code target in the branch/call instruction // this relocation applies to; // can only be called if IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_) @@ -406,6 +434,10 @@ class RelocInfo BASE_EMBEDDED { INLINE(Code* code_age_stub()); INLINE(void set_code_age_stub(Code* stub)); + // Returns the address of the constant pool entry where the target address + // is held. This should only be called if IsInConstantPool returns true. + INLINE(Address constant_pool_entry_address()); + // Read the address of the word containing the target_address in an // instruction stream. What this means exactly is architecture-independent. // The only architecture-independent user of this function is the serializer. @@ -413,6 +445,7 @@ class RelocInfo BASE_EMBEDDED { // output before the next target. Architecture-independent code shouldn't // dereference the pointer it gets back from this. INLINE(Address target_address_address()); + // This indicates how much space a target takes up when deserializing a code // stream. For most architectures this is just the size of a pointer. For // an instruction like movw/movt where the target bits are mixed into the @@ -537,7 +570,7 @@ class RelocInfoWriter BASE_EMBEDDED { inline void WriteTaggedPC(uint32_t pc_delta, int tag); inline void WriteExtraTaggedPC(uint32_t pc_delta, int extra_tag); inline void WriteExtraTaggedIntData(int data_delta, int top_tag); - inline void WriteExtraTaggedConstPoolData(int data); + inline void WriteExtraTaggedPoolData(int data, int pool_type); inline void WriteExtraTaggedData(intptr_t data_delta, int top_tag); inline void WriteTaggedData(intptr_t data_delta, int tag); inline void WriteExtraTag(int extra_tag, int top_tag); @@ -588,7 +621,7 @@ class RelocIterator: public Malloced { void ReadTaggedPC(); void AdvanceReadPC(); void AdvanceReadId(); - void AdvanceReadConstPoolData(); + void AdvanceReadPoolData(); void AdvanceReadPosition(); void AdvanceReadData(); void AdvanceReadVariableLengthPCJump(); @@ -711,12 +744,11 @@ class ExternalReference BASE_EMBEDDED { static ExternalReference incremental_marking_record_write_function( Isolate* isolate); - static ExternalReference incremental_evacuation_record_write_function( - Isolate* isolate); static ExternalReference store_buffer_overflow_function( Isolate* isolate); static ExternalReference flush_icache_function(Isolate* isolate); static ExternalReference perform_gc_function(Isolate* isolate); + static ExternalReference out_of_memory_function(Isolate* isolate); static ExternalReference delete_handle_scope_extensions(Isolate* isolate); static ExternalReference get_date_field_function(Isolate* isolate); @@ -1002,32 +1034,6 @@ class PreservePositionScope BASE_EMBEDDED { // ----------------------------------------------------------------------------- // Utility functions -inline bool is_intn(int x, int n) { - return -(1 << (n-1)) <= x && x < (1 << (n-1)); -} - -inline bool is_int8(int x) { return is_intn(x, 8); } -inline bool is_int16(int x) { return is_intn(x, 16); } -inline bool is_int18(int x) { return is_intn(x, 18); } -inline bool is_int24(int x) { return is_intn(x, 24); } - -inline bool is_uintn(int x, int n) { - return (x & -(1 << n)) == 0; -} - -inline bool is_uint2(int x) { return is_uintn(x, 2); } -inline bool is_uint3(int x) { return is_uintn(x, 3); } -inline bool is_uint4(int x) { return is_uintn(x, 4); } -inline bool is_uint5(int x) { return is_uintn(x, 5); } -inline bool is_uint6(int x) { return is_uintn(x, 6); } -inline bool is_uint8(int x) { return is_uintn(x, 8); } -inline bool is_uint10(int x) { return is_uintn(x, 10); } -inline bool is_uint12(int x) { return is_uintn(x, 12); } -inline bool is_uint16(int x) { return is_uintn(x, 16); } -inline bool is_uint24(int x) { return is_uintn(x, 24); } -inline bool is_uint26(int x) { return is_uintn(x, 26); } -inline bool is_uint28(int x) { return is_uintn(x, 28); } - inline int NumberOfBitsSet(uint32_t x) { unsigned int num_bits_set; for (num_bits_set = 0; x; x >>= 1) { @@ -1065,6 +1071,21 @@ class NullCallWrapper : public CallWrapper { virtual void AfterCall() const { } }; + +// The multiplier and shift for signed division via multiplication, see Warren's +// "Hacker's Delight", chapter 10. +class MultiplierAndShift { + public: + explicit MultiplierAndShift(int32_t d); + int32_t multiplier() const { return multiplier_; } + int32_t shift() const { return shift_; } + + private: + int32_t multiplier_; + int32_t shift_; +}; + + } } // namespace v8::internal #endif // V8_ASSEMBLER_H_ |