38 const int Deoptimizer::table_entry_size_ = 12;
42 const int kCallInstructionSizeInWords = 3;
47 void Deoptimizer::PatchCodeForDeoptimization(
Isolate* isolate,
Code*
code) {
53 if (FLAG_zap_code_space) {
55 byte* pointer = code->FindCodeAgeSequence();
56 if (pointer !=
NULL) {
61 CodePatcher patcher(pointer, 1);
62 patcher.masm()->bkpt(0);
64 DeoptimizationInputData* data =
66 int osr_offset = data->OsrPcOffset()->value();
69 osr_patcher.masm()->bkpt(0);
73 DeoptimizationInputData* deopt_data =
75 SharedFunctionInfo* shared =
83 for (
int i = 0; i < deopt_data->DeoptCount(); i++) {
84 if (deopt_data->Pc(i)->value() == -1)
continue;
85 Address call_address = code_start_address + deopt_data->Pc(i)->value();
89 int call_size_in_bytes =
95 CodePatcher patcher(call_address, call_size_in_words);
96 patcher.masm()->Call(deopt_entry, RelocInfo::NONE32);
98 call_address >= prev_call_address +
patch_size());
101 prev_call_address = call_address;
107 void Deoptimizer::FillInputFrame(
Address tos, JavaScriptFrame* frame) {
128 void Deoptimizer::SetPlatformCompiledStubRegisters(
129 FrameDescription* output_frame, CodeStubInterfaceDescriptor* descriptor) {
130 ApiFunction
function(descriptor->deoptimization_handler_);
131 ExternalReference xref(&
function, ExternalReference::BUILTIN_CALL, isolate_);
132 intptr_t handler =
reinterpret_cast<intptr_t
>(xref.address());
133 int params = descriptor->GetHandlerParameterCount();
134 output_frame->SetRegister(
r0.
code(), params);
135 output_frame->SetRegister(
r1.
code(), handler);
139 void Deoptimizer::CopyDoubleRegisters(FrameDescription* output_frame) {
142 output_frame->SetDoubleRegister(i, double_value);
147 bool Deoptimizer::HasAlignmentPadding(JSFunction*
function) {
153 Code* Deoptimizer::NotifyStubFailureBuiltin() {
154 return isolate_->
builtins()->
builtin(Builtins::kNotifyStubFailureSaveDoubles);
162 void Deoptimizer::EntryGenerator::Generate() {
171 const int kDoubleRegsSize =
179 __ CheckFor32DRegs(
ip);
192 const int kSavedRegistersAreaSize =
208 __ PrepareCallCFunction(6,
r5);
210 __ mov(
r1, Operand(type()));
214 __ mov(
r5, Operand(ExternalReference::isolate_address(isolate())));
218 AllowExternalCallThatCantCauseGC scope(masm());
219 __ CallCFunction(ExternalReference::new_deoptimizer_function(isolate()), 6);
227 ASSERT(Register::kNumRegisters == kNumberOfRegisters);
238 int dst_offset = i *
kDoubleSize + double_regs_offset;
240 __ vldr(
d0,
sp, src_offset);
241 __ vstr(
d0,
r1, dst_offset);
257 Label pop_loop_header;
258 __ b(&pop_loop_header);
262 __ add(
r3,
r3, Operand(
sizeof(uint32_t)));
263 __ bind(&pop_loop_header);
270 __ PrepareCallCFunction(1,
r1);
273 AllowExternalCallThatCantCauseGC scope(masm());
275 ExternalReference::compute_output_frames_function(isolate()), 1);
280 Label outer_push_loop, inner_push_loop,
281 outer_loop_header, inner_loop_header;
287 __ jmp(&outer_loop_header);
288 __ bind(&outer_push_loop);
292 __ jmp(&inner_loop_header);
293 __ bind(&inner_push_loop);
294 __ sub(
r3,
r3, Operand(
sizeof(uint32_t)));
298 __ bind(&inner_loop_header);
299 __ cmp(
r3, Operand::Zero());
300 __ b(
ne, &inner_push_loop);
302 __ bind(&outer_loop_header);
304 __ b(
lt, &outer_push_loop);
307 __ CheckFor32DRegs(
ip);
316 __ vldr(reg,
r1, src_offset, i < 16 ?
al :
ne);
329 for (
int i = kNumberOfRegisters - 1; i >= 0; i--) {
340 __ InitializeRootRegister();
346 __ stop(
"Unreachable.");
354 for (
int i = 0; i < count(); i++) {
355 int start = masm()->pc_offset();
360 ASSERT(masm()->pc_offset() - start == table_entry_size_);
367 SetFrameSlot(offset, value);
372 SetFrameSlot(offset, value);
377 ASSERT(FLAG_enable_ool_constant_pool);
378 SetFrameSlot(offset, value);
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()
void SetCallerPc(unsigned offset, intptr_t value)
Code * builtin(Name name)
void InvalidateRelocation()
const LowDwVfpRegister d0
static const int kMaxNumAllocatableRegisters
void SetFrameSlot(unsigned offset, intptr_t value)
#define ASSERT(condition)
const RegList kJSCallerSaved
static SharedFunctionInfo * cast(Object *obj)
double GetDoubleRegister(unsigned n) const
static int NumAllocatableRegisters()
static DwVfpRegister from_code(int code)
static const int kNumRegisters
static int double_registers_offset()
static int frame_content_offset()
static int output_offset()
const LowDwVfpRegister d13
static Address GetDeoptimizationEntry(Isolate *isolate, int id, BailoutType type, GetEntryMode mode=ENSURE_ENTRY_CODE)
byte * instruction_start()
#define kScratchDoubleReg
static int state_offset()
const RegList kCalleeSaved
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 const int kMaxNumRegisters
void SetCallerConstantPool(unsigned offset, intptr_t value)
uint32_t GetFrameSize() const
static int frame_size_offset()
static int output_count_offset()
const unsigned kNumberOfRegisters
static const int kFunctionOffset
virtual void GeneratePrologue()
static int CallSizeNotPredictableCodeSize(Address target, RelocInfo::Mode rmode, Condition cond=al)
static const int kInstrSize
static uint32_t & uint32_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()