}
}
- bool function_in_register = true;
+ bool function_in_register_r4 = true;
// Possibly allocate a local context.
if (info->scope()->num_heap_slots() > 0) {
__ push(r4);
__ CallRuntime(Runtime::kNewFunctionContext, 1);
}
- function_in_register = false;
+ function_in_register_r4 = false;
// Context is returned in r3. It replaces the context passed to us.
// It's saved in the stack and kept live in cp.
__ mr(cp, r3);
}
}
+ PrepareForBailoutForId(BailoutId::Prologue(), NO_REGISTERS);
+ // Function register is trashed in case we bailout here. But since that
+ // could happen only when we allocate a context the value of
+ // |function_in_register_r4| is correct.
+
// Possibly set up a local binding to the this function which is used in
// derived constructors with super calls.
Variable* this_function_var = scope()->this_function_var();
if (this_function_var != nullptr) {
Comment cmnt(masm_, "[ This function");
- if (!function_in_register) {
+ if (!function_in_register_r4) {
__ LoadP(r4, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
- // The write barrier clobbers register again, keep is marked as such.
+ // The write barrier clobbers register again, keep it marked as such.
}
SetVar(this_function_var, r4, r3, r5);
}
__ LoadP(r4, MemOperand(r5, StandardFrameConstants::kMarkerOffset));
__ CmpSmiLiteral(r4, Smi::FromInt(StackFrame::CONSTRUCT), r0);
Label non_construct_frame, done;
+ function_in_register_r4 = false;
__ bne(&non_construct_frame);
__ LoadP(r3, MemOperand(
__ LoadSmiLiteral(r4, Smi::FromInt(rest_index));
__ LoadSmiLiteral(r3, Smi::FromInt(language_mode()));
__ Push(r6, r5, r4, r3);
+ function_in_register_r4 = false;
RestParamAccessStub stub(isolate());
__ CallStub(&stub);
if (arguments != NULL) {
// Function uses arguments object.
Comment cmnt(masm_, "[ Allocate arguments object");
- if (!function_in_register) {
+ if (!function_in_register_r4) {
// Load this again, if it's used by the local context below.
__ LoadP(r6, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
} else {
if (info()->saves_caller_doubles()) {
SaveCallerDoubles();
}
+ return !is_aborted();
+}
+
+
+void LCodeGen::DoPrologue(LPrologue* instr) {
+ Comment(";;; Prologue begin");
// Possibly allocate a local context.
- int heap_slots = info()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
- if (heap_slots > 0) {
+ if (info()->scope()->num_heap_slots() > 0) {
Comment(";;; Allocate local context");
bool need_write_barrier = true;
// Argument to NewContext is the function, which is in r4.
- DCHECK(!info()->scope()->is_script_scope());
- if (heap_slots <= FastNewContextStub::kMaximumSlots) {
- FastNewContextStub stub(isolate(), heap_slots);
+ int slots = info()->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
+ Safepoint::DeoptMode deopt_mode = Safepoint::kNoLazyDeopt;
+ if (info()->scope()->is_script_scope()) {
+ __ push(r4);
+ __ Push(info()->scope()->GetScopeInfo(info()->isolate()));
+ __ CallRuntime(Runtime::kNewScriptContext, 2);
+ deopt_mode = Safepoint::kLazyDeopt;
+ } else if (slots <= FastNewContextStub::kMaximumSlots) {
+ FastNewContextStub stub(isolate(), slots);
__ CallStub(&stub);
// Result of FastNewContextStub is always in new space.
need_write_barrier = false;
__ push(r4);
__ CallRuntime(Runtime::kNewFunctionContext, 1);
}
- RecordSafepoint(Safepoint::kNoLazyDeopt);
+ RecordSafepoint(deopt_mode);
+
// Context is returned in both r3 and cp. It replaces the context
// passed to us. It's saved in the stack and kept live in cp.
__ mr(cp, r3);
Comment(";;; End allocate local context");
}
- // Trace the call.
- if (FLAG_trace && info()->IsOptimizing()) {
- // We have not executed any compiled code yet, so cp still holds the
- // incoming context.
- __ CallRuntime(Runtime::kTraceEnter, 0);
- }
- return !is_aborted();
+ Comment(";;; Prologue end");
}
}
chunk_->AddInstruction(instr, current_block_);
- if (instr->IsCall()) {
+ if (instr->IsCall() || instr->IsPrologue()) {
HValue* hydrogen_value_for_lazy_bailout = hydrogen_val;
if (hydrogen_val->HasObservableSideEffects()) {
HSimulate* sim = HSimulate::cast(hydrogen_val->next());
}
+LInstruction* LChunkBuilder::DoPrologue(HPrologue* instr) {
+ return new (zone()) LPrologue();
+}
+
+
LInstruction* LChunkBuilder::DoGoto(HGoto* instr) {
return new (zone()) LGoto(instr->FirstSuccessor());
}
V(OsrEntry) \
V(Parameter) \
V(Power) \
+ V(Prologue) \
V(PushArgument) \
V(RegExpLiteral) \
V(Return) \
};
+class LPrologue final : public LTemplateInstruction<0, 0, 0> {
+ public:
+ DECLARE_CONCRETE_INSTRUCTION(Prologue, "prologue")
+};
+
+
class LLazyBailout final : public LTemplateInstruction<0, 0, 0> {
public:
LLazyBailout() : gap_instructions_size_(0) {}