7 #if V8_TARGET_ARCH_IA32
26 Isolate*
isolate = code->GetIsolate();
31 int min_reloc_size = 0;
32 int prev_pc_offset = 0;
33 DeoptimizationInputData* deopt_data =
34 DeoptimizationInputData::cast(code->deoptimization_data());
35 for (
int i = 0;
i < deopt_data->DeoptCount();
i++) {
36 int pc_offset = deopt_data->Pc(
i)->value();
37 if (pc_offset == -1)
continue;
39 int pc_delta = pc_offset - prev_pc_offset;
48 prev_pc_offset = pc_offset;
54 int reloc_length = code->relocation_info()->length();
55 if (min_reloc_size > reloc_length) {
58 int min_padding = min_reloc_size - reloc_length;
60 int additional_comments =
61 (min_padding + comment_reloc_size - 1) / comment_reloc_size;
63 int padding = additional_comments * comment_reloc_size;
68 Handle<ByteArray> new_reloc =
69 factory->NewByteArray(reloc_length + padding,
TENURED);
70 MemCopy(new_reloc->GetDataStartAddress() + padding,
71 code->relocation_info()->GetDataStartAddress(), reloc_length);
74 RelocInfoWriter reloc_info_writer(
75 new_reloc->GetDataStartAddress() + padding, 0);
76 intptr_t comment_string
79 for (
int i = 0;
i < additional_comments; ++
i) {
81 byte* pos_before = reloc_info_writer.pos();
83 reloc_info_writer.Write(&rinfo);
85 pos_before - reloc_info_writer.pos());
88 code->set_relocation_info(*new_reloc);
94 Address code_start_address = code->instruction_start();
96 if (FLAG_zap_code_space) {
98 byte* pointer = code->FindCodeAgeSequence();
99 if (pointer !=
NULL) {
102 pointer = code->instruction_start();
104 CodePatcher patcher(pointer, 1);
105 patcher.masm()->int3();
107 DeoptimizationInputData* data =
108 DeoptimizationInputData::cast(code->deoptimization_data());
109 int osr_offset = data->OsrPcOffset()->value();
110 if (osr_offset > 0) {
111 CodePatcher osr_patcher(code->instruction_start() + osr_offset, 1);
112 osr_patcher.masm()->int3();
120 ByteArray* reloc_info = code->relocation_info();
121 Address reloc_end_address = reloc_info->address() + reloc_info->Size();
122 RelocInfoWriter reloc_info_writer(reloc_end_address, code_start_address);
129 DeoptimizationInputData* deopt_data =
130 DeoptimizationInputData::cast(code->deoptimization_data());
136 for (
int i = 0;
i < deopt_data->DeoptCount();
i++) {
137 if (deopt_data->Pc(
i)->value() == -1)
continue;
139 Address call_address = code_start_address + deopt_data->Pc(
i)->value();
140 CodePatcher patcher(call_address,
patch_size());
144 RelocInfo rinfo(call_address + 1,
146 reinterpret_cast<intptr_t
>(deopt_entry),
148 reloc_info_writer.Write(&rinfo);
152 call_address >= prev_call_address +
patch_size());
155 prev_call_address = call_address;
160 int new_reloc_size = reloc_end_address - reloc_info_writer.pos();
161 MemMove(code->relocation_start(), reloc_info_writer.pos(), new_reloc_size);
164 reloc_info->set_length(new_reloc_size);
168 Address junk_address = reloc_info->address() + reloc_info->Size();
169 DCHECK(junk_address <= reloc_end_address);
171 reloc_end_address - junk_address);
197 FrameDescription* output_frame, CodeStubDescriptor* descriptor) {
199 reinterpret_cast<intptr_t
>(descriptor->deoptimization_handler());
200 int params = descriptor->GetHandlerParameterCount();
201 output_frame->SetRegister(
eax.
code(), params);
202 output_frame->SetRegister(
ebx.
code(), handler);
209 output_frame->SetDoubleRegister(
i, double_value);
215 int parameter_count =
function->shared()->formal_parameter_count() + 1;
217 unsigned alignment_state_offset =
230 void Deoptimizer::EntryGenerator::Generate() {
238 __ sub(
esp, Immediate(kDoubleRegsSize));
242 __ movsd(Operand(
esp, offset), xmm_reg);
251 __ mov(
ebx, Operand(
esp, kSavedRegistersAreaSize));
262 __ PrepareCallCFunction(6,
eax);
270 Immediate(ExternalReference::isolate_address(isolate())));
272 AllowExternalCallThatCantCauseGC scope(masm());
273 __ CallCFunction(ExternalReference::new_deoptimizer_function(isolate()), 6);
283 __ pop(Operand(
ebx, offset));
291 __ movsd(
xmm0, Operand(
esp, src_offset));
292 __ movsd(Operand(
ebx, dst_offset),
xmm0);
312 Label pop_loop_header;
313 __ jmp(&pop_loop_header);
316 __ pop(Operand(
edx, 0));
318 __ bind(&pop_loop_header);
324 __ PrepareCallCFunction(1,
ebx);
327 AllowExternalCallThatCantCauseGC scope(masm());
329 ExternalReference::compute_output_frames_function(isolate()), 1);
339 if (FLAG_debug_code) {
341 __ Assert(
equal, kAlignmentMarkerExpected);
343 __ bind(&no_padding);
346 Label outer_push_loop, inner_push_loop,
347 outer_loop_header, inner_loop_header;
353 __ jmp(&outer_loop_header);
354 __ bind(&outer_push_loop);
358 __ jmp(&inner_loop_header);
359 __ bind(&inner_push_loop);
362 __ bind(&inner_loop_header);
366 __ bind(&outer_loop_header);
374 __ movsd(xmm_reg, Operand(
ebx, src_offset));
386 __ push(Operand(
ebx, offset));
401 int start = masm()->pc_offset();
412 SetFrameSlot(offset, value);
417 SetFrameSlot(offset, value);
static const int kCallInstructionLength
virtual void GeneratePrologue()
static int has_alignment_padding_offset()
static int output_offset()
static void EnsureRelocSpaceForLazyDeoptimization(Handle< Code > code)
static const int table_entry_size_
void CopyDoubleRegisters(FrameDescription *output_frame)
static Address GetDeoptimizationEntry(Isolate *isolate, int id, BailoutType type, GetEntryMode mode=ENSURE_ENTRY_CODE)
static int input_offset()
static void PatchCodeForDeoptimization(Isolate *isolate, Code *code)
static int output_count_offset()
void SetPlatformCompiledStubRegisters(FrameDescription *output_frame, CodeStubDescriptor *desc)
bool HasAlignmentPadding(JSFunction *function)
FrameDescription * input_
Isolate * isolate() const
void FillInputFrame(Address tos, JavaScriptFrame *frame)
static const int kHeaderSize
static int frame_size_offset()
void SetCallerFp(unsigned offset, intptr_t value)
uint32_t GetFrameSize() const
static int continuation_offset()
static int frame_content_offset()
void SetCallerConstantPool(unsigned offset, intptr_t value)
static int state_offset()
static int registers_offset()
double GetDoubleRegister(unsigned n) const
intptr_t GetFrameSlot(unsigned offset)
static int double_registers_offset()
void SetRegister(unsigned n, intptr_t value)
void SetCallerPc(unsigned offset, intptr_t value)
void SetFrameSlot(unsigned offset, intptr_t value)
void SetDoubleRegister(unsigned n, double value)
void CreateFillerObjectAt(Address addr, int size)
static const int kDynamicAlignmentStateOffset
static const int kLocal0Offset
static const int kFunctionOffset
static uint32_t & uint32_at(Address addr)
static const char *const kFillerCommentString
static const int kMaxSmallPCDelta
static const int kMinRelocCommentSize
static const int kFixedFrameSize
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_GE(v1, v2)
#define DCHECK(condition)
const int kAlignmentPaddingPushed
void MemMove(void *dest, const void *src, size_t size)
const int kAlignmentZapValue
const unsigned kNumberOfRegisters
static const int kNoCodeAgeSequenceLength
void MemCopy(void *dest, const void *src, size_t size)
Debugger support for the V8 JavaScript engine.
static const int kNumRegisters
static XMMRegister FromAllocationIndex(int index)
static const int kMaxNumAllocatableRegisters