35 #ifndef V8_ASSEMBLER_H_
36 #define V8_ASSEMBLER_H_
118 : assembler_(assembler), old_value_(assembler->emit_debug_code()) {
119 assembler_->set_emit_debug_code(
false);
122 assembler_->set_emit_debug_code(old_value_);
154 uint64_t old_enabled_;
172 static void Probe(
bool cross_compile) {
232 DCHECK(!is_near_linked());
236 INLINE(
void UnuseNear()) { near_link_pos_ = 0; }
238 INLINE(
bool is_bound()
const) {
return pos_ < 0; }
239 INLINE(
bool is_unused()
const) {
return pos_ == 0 && near_link_pos_ == 0; }
240 INLINE(
bool is_linked()
const) {
return pos_ > 0; }
241 INLINE(
bool is_near_linked()
const) {
return near_link_pos_ > 0; }
265 if (distance == kNear) {
266 near_link_pos_ = pos + 1;
275 friend class Displacement;
276 friend class RegExpMacroAssemblerIrregexp;
278 #if V8_TARGET_ARCH_ARM64
555 template<
typename StaticVisitor>
inline void Visit(
Heap* heap);
559 void PatchCode(
byte* instructions,
int instruction_count);
570 INLINE(
bool IsPatchedDebugBreakSlotSequence());
575 static bool RequiresRelocation(
const CodeDesc& desc);
578 #ifdef ENABLE_DISASSEMBLER
580 static const char* RelocModeName(
Mode rmode);
627 byte*
pos()
const {
return pos_; }
644 static const int kMaxSize = 16;
781 PROFILING_GETTER_CALL
933 #ifndef V8_INTERPRETED_REGEXP
953 ExternalReferenceRedirector* redirector) {
955 DCHECK(isolate->external_reference_redirector() ==
NULL);
956 isolate->set_external_reference_redirector(
963 return address_ == other.address_;
967 return !(*
this == other);
972 : address_(address) {}
976 Type type = ExternalReference::BUILTIN_CALL) {
977 ExternalReferenceRedirector* redirector =
978 reinterpret_cast<ExternalReferenceRedirector*
>(
979 isolate->external_reference_redirector());
980 void* address =
reinterpret_cast<void*
>(address_arg);
981 void* answer = (redirector ==
NULL) ?
983 (*redirector)(address, type);
1011 : assembler_(assembler) {
1012 jit_handler_data_ =
NULL;
1016 jit_handler_data_ = user_data;
1020 void* old_data = jit_handler_data_;
1021 jit_handler_data_ =
NULL;
1036 return state_.current_statement_position;
1046 friend class PreservePositionScope;
1055 : positions_recorder_(positions_recorder),
1056 saved_state_(positions_recorder->state_) {}
1059 positions_recorder_->state_ = saved_state_;
1074 unsigned int num_bits_set;
1075 for (num_bits_set = 0; x; x >>= 1) {
1076 num_bits_set += x & 1;
1078 return num_bits_set;
void set_enabled_cpu_features(uint64_t features)
static void QuietNaN(HeapObject *nan)
void set_emit_debug_code(bool value)
bool IsEnabled(CpuFeature f)
Isolate * isolate() const
static const int kMinimalBufferSize
uint64_t enabled_cpu_features_
AssemblerBase(Isolate *isolate, void *buffer, int buffer_size)
void set_predictable_code_size(bool value)
uint64_t enabled_cpu_features() const
virtual void AbortedCodeGeneration()
bool predictable_code_size() const
bool predictable_code_size_
bool serializer_enabled() const
bool emit_debug_code() const
static ExternalReference address_of_static_offsets_vector(Isolate *isolate)
static ExternalReference page_flags(Page *page)
int current_statement_position() const
void WriteExtraTag(int extra_tag, int top_tag)
void WriteTaggedPC(uint32_t pc_delta, int tag)
static ExternalReference cpu_features()
static ExternalReference address_of_min_int()
ExternalReference(StatsCounter *counter)
PositionsRecorder(Assembler *assembler)
static ExternalReference math_exp_constants(int constant_index)
static ExternalReference get_mark_code_as_executed_function(Isolate *isolate)
static ExternalReference debug_break(Isolate *isolate)
static ExternalReference stress_deopt_count(Isolate *isolate)
static void * Redirect(Isolate *isolate, Address address_arg, Type type=ExternalReference::BUILTIN_CALL)
ExternalReference(void *address)
void * DetachJITHandlerData()
INLINE(bool is_bound() const)
ExternalReference(Isolate::AddressId id, Isolate *isolate)
static ExternalReference date_cache_stamp(Isolate *isolate)
ExternalReference(const Runtime::Function *f, Isolate *isolate)
uint32_t WriteVariableLengthPCJump(uint32_t pc_delta)
static ExternalReference log_enter_external_function(Isolate *isolate)
static ExternalReference address_of_pending_message_script(Isolate *isolate)
static ExternalReference debug_step_in_fp_address(Isolate *isolate)
static ExternalReference address_of_one_half()
static ExternalReference power_double_double_function(Isolate *isolate)
static ExternalReference invoke_accessor_getter_callback(Isolate *isolate)
static ExternalReference new_space_mask(Isolate *isolate)
ExternalReference(Runtime::FunctionId id, Isolate *isolate)
RelocInfoWriter(byte *pos, byte *pc)
static ExternalReference power_double_int_function(Isolate *isolate)
void WriteTaggedData(intptr_t data_delta, int tag)
static ExternalReference math_exp_log_table()
void WriteExtraTaggedPC(uint32_t pc_delta, int extra_tag)
DISALLOW_COPY_AND_ASSIGN(PreservePositionScope)
static ExternalReference get_make_code_young_function(Isolate *isolate)
void * ExternalReferenceRedirector(void *original, Type type)
void WriteExtraTaggedPoolData(int data, int pool_type)
static ExternalReference re_check_stack_guard_state(Isolate *isolate)
void Reposition(byte *pos, byte *pc)
INLINE(bool is_linked() const)
static ExternalReference handle_scope_next_address(Isolate *isolate)
static ExternalReference flush_icache_function(Isolate *isolate)
void AttachJITHandlerData(void *user_data)
static ExternalReference compute_output_frames_function(Isolate *isolate)
static ExternalReference is_profiling_address(Isolate *isolate)
~DontEmitDebugCodeScope()
static ExternalReference new_space_allocation_limit_address(Isolate *isolate)
static ExternalReference address_of_has_pending_message(Isolate *isolate)
static ExternalReference handle_scope_limit_address(Isolate *isolate)
ExternalReference(Builtins::Name name, Isolate *isolate)
static ExternalReference re_word_character_map()
bool operator==(const ExternalReference &other) const
static void InitializeMathExpData()
static ExternalReference old_pointer_space_allocation_top_address(Isolate *isolate)
static ExternalReference address_of_pending_message_obj(Isolate *isolate)
static void TearDownMathExpData()
void link_to(int pos, Distance distance=kFar)
static ExternalReference address_of_the_hole_nan()
static ExternalReference address_of_stack_limit(Isolate *isolate)
static ExternalReference roots_array_start(Isolate *isolate)
static ExternalReference address_of_regexp_stack_memory_address(Isolate *isolate)
void WriteExtraTaggedData(intptr_t data_delta, int top_tag)
static ExternalReference address_of_regexp_stack_memory_size(Isolate *isolate)
bool WriteRecordedPositions()
static ExternalReference invoke_function_callback(Isolate *isolate)
static ExternalReference delete_handle_scope_extensions(Isolate *isolate)
void Write(const RelocInfo *rinfo)
ExternalReference(const SCTableReference &table_ref)
static ExternalReference log_leave_external_function(Isolate *isolate)
static ExternalReference address_of_canonical_non_hole_nan()
static ExternalReference allocation_sites_list_address(Isolate *isolate)
static ExternalReference old_data_space_allocation_top_address(Isolate *isolate)
const PositionState saved_state_
ExternalReference(const IC_Utility &ic_utility, Isolate *isolate)
static ExternalReference old_data_space_allocation_limit_address(Isolate *isolate)
AssemblerBase * assembler_
void RecordStatementPosition(int pos)
static ExternalReference math_log_double_function(Isolate *isolate)
PositionsRecorder * positions_recorder_
int current_position() const
static ExternalReference store_buffer_top(Isolate *isolate)
void WriteExtraTaggedIntData(int data_delta, int top_tag)
INLINE(bool is_unused() const)
static ExternalReference scheduled_exception_address(Isolate *isolate)
static ExternalReference re_grow_stack(Isolate *isolate)
static ExternalReference address_of_real_stack_limit(Isolate *isolate)
static ExternalReference ForDeoptEntry(Address entry)
static ExternalReference address_of_uint32_bias()
static ExternalReference keyed_lookup_cache_keys(Isolate *isolate)
static ExternalReference old_pointer_space_allocation_limit_address(Isolate *isolate)
static ExternalReference debug_after_break_target_address(Isolate *isolate)
static void set_redirector(Isolate *isolate, ExternalReferenceRedirector *redirector)
static ExternalReference address_of_regexp_stack_limit(Isolate *isolate)
static ExternalReference new_deoptimizer_function(Isolate *isolate)
static ExternalReference get_date_field_function(Isolate *isolate)
static ExternalReference isolate_address(Isolate *isolate)
static ExternalReference new_space_start(Isolate *isolate)
static ExternalReference new_space_allocation_top_address(Isolate *isolate)
static ExternalReference re_case_insensitive_compare_uc16(Isolate *isolate)
DISALLOW_COPY_AND_ASSIGN(PositionsRecorder)
DISALLOW_COPY_AND_ASSIGN(RelocInfoWriter)
static ExternalReference incremental_marking_record_write_function(Isolate *isolate)
ExternalReference(Builtins::CFunctionId id, Isolate *isolate)
static ExternalReference debug_is_active_address(Isolate *isolate)
bool operator!=(const ExternalReference &other) const
PreservePositionScope(PositionsRecorder *positions_recorder)
int near_link_pos() const
DontEmitDebugCodeScope(AssemblerBase *assembler)
static ExternalReference store_buffer_overflow_function(Isolate *isolate)
static ExternalReference keyed_lookup_cache_field_offsets(Isolate *isolate)
INLINE(bool is_near_linked() const)
CpuFeatureScope(AssemblerBase *assembler, CpuFeature f)
ExternalReference(ApiFunction *ptr, Type type, Isolate *isolate)
void RecordPosition(int pos)
static ExternalReference address_of_minus_one_half()
static ExternalReference mod_two_doubles_operation(Isolate *isolate)
static ExternalReference handle_scope_level_address(Isolate *isolate)
static ExternalReference debug_restarter_frame_function_pointer_address(Isolate *isolate)
static ExternalReference address_of_negative_infinity()
virtual void BeforeCall(int call_size) const =0
virtual void AfterCall() const =0
static void FlushICache(void *start, size_t size)
static bool IsSupported(CpuFeature f)
static unsigned SupportedFeatures()
friend class ExternalReference
static void Probe(bool cross_compile)
static bool SupportsCrankshaft()
static unsigned cache_line_size_
DISALLOW_COPY_AND_ASSIGN(CpuFeatures)
static unsigned supported_
static void PrintFeatures()
static void PrintTarget()
static void ProbeImpl(bool cross_compile)
static unsigned cache_line_size()
virtual void AfterCall() const
virtual ~NullCallWrapper()
virtual void BeforeCall(int call_size) const
AssemblerBase * assembler_
~PredictableCodeSizeScope()
PredictableCodeSizeScope(AssemblerBase *assembler, int expected_size)
static int ModeMask(Mode mode)
static const int kCodeTargetMask
static bool IsDebugBreakSlot(Mode mode)
INLINE(void set_target_address(Address target, WriteBarrierMode write_barrier_mode=UPDATE_WRITE_BARRIER, ICacheFlushMode icache_flush_mode=FLUSH_ICACHE_IF_NEEDED))
static const int kPositionMask
static bool IsJSReturn(Mode mode)
static bool IsVeneerPool(Mode mode)
static bool IsComment(Mode mode)
INLINE(void set_target_object(Object *target, WriteBarrierMode write_barrier_mode=UPDATE_WRITE_BARRIER, ICacheFlushMode icache_flush_mode=FLUSH_ICACHE_IF_NEEDED))
static bool IsEmbeddedObject(Mode mode)
INLINE(Address target_address_address())
INLINE(void set_target_cell(Cell *cell, WriteBarrierMode write_barrier_mode=UPDATE_WRITE_BARRIER, ICacheFlushMode icache_flush_mode=FLUSH_ICACHE_IF_NEEDED))
INLINE(bool IsPatchedDebugBreakSlotSequence())
INLINE(Object *target_object())
static bool IsRuntimeEntry(Mode mode)
static bool IsPosition(Mode mode)
static const int kApplyMask
INLINE(Code *code_age_stub())
INLINE(Address target_address())
INLINE(Address constant_pool_entry_address())
Address reconstructed_adr_ptr_
static bool IsCodeTarget(Mode mode)
INLINE(Object *call_object())
static bool IsNone(Mode mode)
INLINE(Handle< Cell > target_cell_handle())
INLINE(void set_target_runtime_entry(Address target, WriteBarrierMode write_barrier_mode=UPDATE_WRITE_BARRIER, ICacheFlushMode icache_flush_mode=FLUSH_ICACHE_IF_NEEDED))
INLINE(Object **call_object_address())
void PatchCode(byte *instructions, int instruction_count)
RelocInfo(byte *pc, Mode rmode, intptr_t data, Code *host)
static bool IsExternalReference(Mode mode)
static const char *const kFillerCommentString
static const int kMaxCallSize
INLINE(void set_code_age_stub(Code *stub, ICacheFlushMode icache_flush_mode=FLUSH_ICACHE_IF_NEEDED))
INLINE(bool IsPatchedReturnSequence())
INLINE(void set_call_address(Address target))
RelocInfo(byte *pc, double data64)
static const int kDataMask
@ LAST_STANDARD_NONCOMPACT_ENUM
@ FIRST_PSEUDO_RELOC_MODE
INLINE(int target_address_size())
INLINE(Handle< Object > code_age_stub_handle(Assembler *origin))
INLINE(Address target_reference())
static bool IsConstPool(Mode mode)
static bool IsRealRelocMode(Mode mode)
static bool IsConstructCall(Mode mode)
INLINE(Address target_runtime_entry(Assembler *origin))
static const int kMaxSmallPCDelta
INLINE(Address call_address())
INLINE(Handle< Object > target_object_handle(Assembler *origin))
INLINE(void set_call_object(Object *target))
static const int kMinRelocCommentSize
static bool IsPseudoRelocMode(Mode mode)
static bool IsStatementPosition(Mode mode)
INLINE(void apply(intptr_t delta, ICacheFlushMode icache_flush_mode=FLUSH_ICACHE_IF_NEEDED))
static bool IsInternalReference(Mode mode)
static bool IsEqual(RelocInfo first, RelocInfo second)
static bool IsCodeAgeSequence(Mode mode)
static const int kNoPosition
void PatchCodeWithCall(Address target, int guard_bytes)
static bool IsGCRelocMode(Mode mode)
void set_host(Code *host)
INLINE(Cell *target_cell())
void AdvanceReadVariableLengthPCJump()
byte * code_age_sequence_
bool SetMode(RelocInfo::Mode mode)
void AdvanceReadPoolData()
void ReadTaggedPosition()
RelocIterator(Code *code, int mode_mask=-1)
int GetLocatableTypeTag()
void Advance(int bytes=1)
DISALLOW_COPY_AND_ASSIGN(RelocIterator)
void AdvanceReadPosition()
enable harmony numeric enable harmony object literal extensions Optimize object size
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in name
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long mode(MIPS only)") DEFINE_BOOL(enable_always_align_csp
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL
#define DCHECK(condition)
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
double power_double_int(double x, int y)
bool EvalComparison(Token::Value op, double op1, double op2)
double power_helper(double x, double y)
double power_double_double(double x, double y)
STATIC_ASSERT(sizeof(CPURegister)==sizeof(Register))
void * ExternalReferenceRedirectorPointer()
int NumberOfBitsSet(uint32_t x)
Debugger support for the V8 JavaScript engine.
int current_statement_position
int written_statement_position