diff options
Diffstat (limited to 'src/3rdparty/v8/src/assembler.h')
-rw-r--r-- | src/3rdparty/v8/src/assembler.h | 85 |
1 files changed, 73 insertions, 12 deletions
diff --git a/src/3rdparty/v8/src/assembler.h b/src/3rdparty/v8/src/assembler.h index 05fe320..037799d 100644 --- a/src/3rdparty/v8/src/assembler.h +++ b/src/3rdparty/v8/src/assembler.h @@ -51,7 +51,6 @@ class ApiFunction; namespace internal { struct StatsCounter; -const unsigned kNoASTId = -1; // ----------------------------------------------------------------------------- // Platform independent assembler base class. @@ -60,7 +59,13 @@ class AssemblerBase: public Malloced { explicit AssemblerBase(Isolate* isolate); Isolate* isolate() const { return isolate_; } - int jit_cookie() { return jit_cookie_; } + int jit_cookie() const { return jit_cookie_; } + + bool emit_debug_code() const { return emit_debug_code_; } + void set_emit_debug_code(bool value) { emit_debug_code_ = value; } + + bool predictable_code_size() const { return predictable_code_size_; } + void set_predictable_code_size(bool value) { predictable_code_size_ = value; } // Overwrite a host NaN with a quiet target NaN. Used by mksnapshot for // cross-snapshotting. @@ -69,6 +74,28 @@ class AssemblerBase: public Malloced { private: Isolate* isolate_; int jit_cookie_; + bool emit_debug_code_; + bool predictable_code_size_; +}; + + +// Avoids using instructions that vary in size in unpredictable ways between the +// snapshot and the running VM. +class PredictableCodeSizeScope { + public: + explicit PredictableCodeSizeScope(AssemblerBase* assembler) + : assembler_(assembler) { + old_value_ = assembler_->predictable_code_size(); + assembler_->set_predictable_code_size(true); + } + + ~PredictableCodeSizeScope() { + assembler_->set_predictable_code_size(old_value_); + } + + private: + AssemblerBase* assembler_; + bool old_value_; }; @@ -204,14 +231,25 @@ 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. + CONST_POOL, + // add more as needed // Pseudo-types - NUMBER_OF_MODES, // There are at most 14 modes with noncompact encoding. + NUMBER_OF_MODES, // There are at most 15 modes with noncompact encoding. NONE, // never recorded + 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, + FIRST_PSEUDO_RELOC_MODE = CODE_AGE_SEQUENCE, + LAST_PSEUDO_RELOC_MODE = CODE_AGE_SEQUENCE, LAST_CODE_ENUM = DEBUG_BREAK, LAST_GCED_ENUM = GLOBAL_PROPERTY_CELL, // Modes <= LAST_COMPACT_ENUM are guaranteed to have compact encoding. - LAST_COMPACT_ENUM = CODE_TARGET_WITH_ID + LAST_COMPACT_ENUM = CODE_TARGET_WITH_ID, + LAST_STANDARD_NONCOMPACT_ENUM = INTERNAL_REFERENCE }; @@ -221,6 +259,15 @@ class RelocInfo BASE_EMBEDDED { : pc_(pc), rmode_(rmode), data_(data), host_(host) { } + static inline bool IsRealRelocMode(Mode mode) { + return mode >= FIRST_REAL_RELOC_MODE && + mode <= LAST_REAL_RELOC_MODE; + } + static inline bool IsPseudoRelocMode(Mode mode) { + ASSERT(!IsRealRelocMode(mode)); + return mode >= FIRST_PSEUDO_RELOC_MODE && + mode <= LAST_PSEUDO_RELOC_MODE; + } static inline bool IsConstructCall(Mode mode) { return mode == CONSTRUCT_CALL; } @@ -240,6 +287,9 @@ class RelocInfo BASE_EMBEDDED { static inline bool IsComment(Mode mode) { return mode == COMMENT; } + static inline bool IsConstPool(Mode mode) { + return mode == CONST_POOL; + } static inline bool IsPosition(Mode mode) { return mode == POSITION || mode == STATEMENT_POSITION; } @@ -255,6 +305,9 @@ class RelocInfo BASE_EMBEDDED { static inline bool IsDebugBreakSlot(Mode mode) { return mode == DEBUG_BREAK_SLOT; } + static inline bool IsCodeAgeSequence(Mode mode) { + return mode == CODE_AGE_SEQUENCE; + } static inline int ModeMask(Mode mode) { return 1 << mode; } // Accessors @@ -287,7 +340,8 @@ class RelocInfo BASE_EMBEDDED { INLINE(Handle<JSGlobalPropertyCell> target_cell_handle()); INLINE(void set_target_cell(JSGlobalPropertyCell* cell, WriteBarrierMode mode = UPDATE_WRITE_BARRIER)); - + INLINE(Code* code_age_stub()); + INLINE(void set_code_age_stub(Code* stub)); // Read the address of the word containing the target_address in an // instruction stream. What this means exactly is architecture-independent. @@ -342,8 +396,7 @@ class RelocInfo BASE_EMBEDDED { static const char* RelocModeName(Mode rmode); void Print(FILE* out); #endif // ENABLE_DISASSEMBLER -#ifdef DEBUG - // Debugging +#ifdef VERIFY_HEAP void Verify(); #endif @@ -362,19 +415,17 @@ class RelocInfo BASE_EMBEDDED { Mode rmode_; intptr_t data_; Code* host_; -#ifdef V8_TARGET_ARCH_MIPS - // Code and Embedded Object pointers in mips are stored split + // Code and Embedded Object pointers on some platforms are stored split // across two consecutive 32-bit instructions. Heap management // routines expect to access these pointers indirectly. The following - // location provides a place for these pointers to exist natually + // location provides a place for these pointers to exist naturally // when accessed via the Iterator. Object* reconstructed_obj_ptr_; // External-reference pointers are also split across instruction-pairs - // in mips, but are accessed via indirect pointers. This location + // on some platforms, but are accessed via indirect pointers. This location // provides a place for that pointer to exist naturally. Its address // is returned by RelocInfo::target_reference_address(). Address reconstructed_adr_ptr_; -#endif // V8_TARGET_ARCH_MIPS friend class RelocIterator; }; @@ -416,6 +467,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 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); @@ -466,6 +518,7 @@ class RelocIterator: public Malloced { void ReadTaggedPC(); void AdvanceReadPC(); void AdvanceReadId(); + void AdvanceReadConstPoolData(); void AdvanceReadPosition(); void AdvanceReadData(); void AdvanceReadVariableLengthPCJump(); @@ -481,6 +534,7 @@ class RelocIterator: public Malloced { byte* pos_; byte* end_; + byte* code_age_sequence_; RelocInfo rinfo_; bool done_; int mode_mask_; @@ -589,6 +643,8 @@ class ExternalReference BASE_EMBEDDED { static ExternalReference get_date_field_function(Isolate* isolate); static ExternalReference date_cache_stamp(Isolate* isolate); + static ExternalReference get_make_code_young_function(Isolate* isolate); + // Deoptimization support. static ExternalReference new_deoptimizer_function(Isolate* isolate); static ExternalReference compute_output_frames_function(Isolate* isolate); @@ -640,6 +696,9 @@ class ExternalReference BASE_EMBEDDED { static ExternalReference handle_scope_level_address(); static ExternalReference scheduled_exception_address(Isolate* isolate); + static ExternalReference address_of_pending_message_obj(Isolate* isolate); + static ExternalReference address_of_has_pending_message(Isolate* isolate); + static ExternalReference address_of_pending_message_script(Isolate* isolate); // Static variables containing common double constants. static ExternalReference address_of_min_int(); @@ -656,6 +715,8 @@ class ExternalReference BASE_EMBEDDED { static ExternalReference math_tan_double_function(Isolate* isolate); static ExternalReference math_log_double_function(Isolate* isolate); + static ExternalReference page_flags(Page* page); + Address address() const {return reinterpret_cast<Address>(address_);} #ifdef ENABLE_DEBUGGER_SUPPORT |