30 #if V8_TARGET_ARCH_X64
41 const int Deoptimizer::table_entry_size_ = 10;
49 void Deoptimizer::PatchCodeForDeoptimization(Isolate* isolate, Code*
code) {
52 code->InvalidateRelocation();
54 if (FLAG_zap_code_space) {
56 byte* pointer = code->FindCodeAgeSequence();
57 if (pointer !=
NULL) {
58 pointer += kNoCodeAgeSequenceLength;
60 pointer = code->instruction_start();
62 CodePatcher patcher(pointer, 1);
63 patcher.masm()->int3();
65 DeoptimizationInputData* data =
67 int osr_offset = data->OsrPcOffset()->value();
69 CodePatcher osr_patcher(code->instruction_start() + osr_offset, 1);
70 osr_patcher.masm()->int3();
80 Address instruction_start = code->instruction_start();
84 DeoptimizationInputData* deopt_data =
86 SharedFunctionInfo* shared =
92 for (
int i = 0; i < deopt_data->DeoptCount(); i++) {
93 if (deopt_data->Pc(i)->value() == -1)
continue;
95 Address call_address = instruction_start + deopt_data->Pc(i)->value();
102 call_address >= prev_call_address +
patch_size());
105 prev_call_address = call_address;
111 void Deoptimizer::FillInputFrame(
Address tos, JavaScriptFrame* frame) {
131 void Deoptimizer::SetPlatformCompiledStubRegisters(
132 FrameDescription* output_frame, CodeStubInterfaceDescriptor* descriptor) {
134 reinterpret_cast<intptr_t
>(descriptor->deoptimization_handler_);
135 int params = descriptor->GetHandlerParameterCount();
136 output_frame->SetRegister(
rax.
code(), params);
137 output_frame->SetRegister(
rbx.
code(), handler);
141 void Deoptimizer::CopyDoubleRegisters(FrameDescription* output_frame) {
144 output_frame->SetDoubleRegister(i, double_value);
149 bool Deoptimizer::HasAlignmentPadding(JSFunction*
function) {
155 Code* Deoptimizer::NotifyStubFailureBuiltin() {
156 return isolate_->
builtins()->
builtin(Builtins::kNotifyStubFailureSaveDoubles);
162 void Deoptimizer::EntryGenerator::Generate() {
170 __ subp(
rsp, Immediate(kDoubleRegsSize));
175 __ movsd(Operand(
rsp, offset), xmm_reg);
185 const int kSavedRegistersAreaSize = kNumberOfRegisters *
kRegisterSize +
206 __ PrepareCallCFunction(6);
216 __ LoadAddress(arg5, ExternalReference::isolate_address(isolate()));
220 __ LoadAddress(
r9, ExternalReference::isolate_address(isolate()));
223 { AllowExternalCallThatCantCauseGC scope(masm());
224 __ CallCFunction(ExternalReference::new_deoptimizer_function(isolate()), 6);
231 for (
int i = kNumberOfRegisters -1; i >= 0; i--) {
233 __ Pop(Operand(
rbx, offset));
239 int dst_offset = i * kDoubleSize + double_regs_offset;
240 __ popq(Operand(
rbx, dst_offset));
255 Label pop_loop_header;
256 __ jmp(&pop_loop_header);
259 __ Pop(Operand(
rdx, 0));
260 __ addp(
rdx, Immediate(
sizeof(intptr_t)));
261 __ bind(&pop_loop_header);
267 __ PrepareCallCFunction(2);
269 __ LoadAddress(
arg_reg_2, ExternalReference::isolate_address(isolate()));
271 AllowExternalCallThatCantCauseGC scope(masm());
273 ExternalReference::compute_output_frames_function(isolate()), 2);
278 Label outer_push_loop, inner_push_loop,
279 outer_loop_header, inner_loop_header;
285 __ jmp(&outer_loop_header);
286 __ bind(&outer_push_loop);
290 __ jmp(&inner_loop_header);
291 __ bind(&inner_push_loop);
292 __ subp(
rcx, Immediate(
sizeof(intptr_t)));
294 __ bind(&inner_loop_header);
298 __ bind(&outer_loop_header);
304 int src_offset = i * kDoubleSize + double_regs_offset;
305 __ movsd(xmm_reg, Operand(
rbx, src_offset));
316 __ Push(Operand(
rbx, offset));
320 for (
int i = kNumberOfRegisters - 1; i >= 0 ; i--) {
332 __ InitializeRootRegister();
333 __ InitializeSmiConstantRegister();
343 for (
int i = 0; i < count(); i++) {
344 int start = masm()->pc_offset();
348 ASSERT(masm()->pc_offset() - start == table_entry_size_);
355 SetFrameSlot(offset, value);
360 SetFrameSlot(offset, value);
375 #endif // V8_TARGET_ARCH_X64
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter NULL
static int registers_offset()
static RelocInfo::Mode RelocInfoNone()
void SetCallerPc(unsigned offset, intptr_t value)
Code * builtin(Name name)
static Smi * FromInt(int value)
void SetFrameSlot(unsigned offset, intptr_t value)
static XMMRegister FromAllocationIndex(int index)
#define ASSERT(condition)
static SharedFunctionInfo * cast(Object *obj)
double GetDoubleRegister(unsigned n) const
static int NumAllocatableRegisters()
static const int kNumRegisters
static int double_registers_offset()
static int frame_content_offset()
static int output_offset()
static Address GetDeoptimizationEntry(Isolate *isolate, int id, BailoutType type, GetEntryMode mode=ENSURE_ENTRY_CODE)
static int state_offset()
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra code(assertions) for debugging") DEFINE_bool(code_comments
void SetRegister(unsigned n, intptr_t value)
static Register from_code(int code)
void SetCallerConstantPool(unsigned offset, intptr_t value)
uint32_t GetFrameSize() const
static int frame_size_offset()
static int output_count_offset()
static const int kCallSequenceLength
const unsigned kNumberOfRegisters
static const int kFunctionOffset
static int NumAllocatableRegisters()
virtual void GeneratePrologue()
static uintptr_t & uintptr_at(Address addr)
void SetDoubleRegister(unsigned n, double value)
void SetCallerFp(unsigned offset, intptr_t value)
void EvictFromOptimizedCodeMap(Code *optimized_code, const char *reason)
static int continuation_offset()
static int input_offset()