LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) {
HEnvironment* outer = current_block_->last_environment();
+ outer->set_ast_id(instr->ReturnId());
HConstant* undefined = graph()->GetConstantUndefined();
HEnvironment* inner = outer->CopyForInlining(instr->closure(),
instr->arguments_count(),
LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) {
HEnvironment* outer = current_block_->last_environment();
+ outer->set_ast_id(instr->ReturnId());
HConstant* undefined = graph()->GetConstantUndefined();
HEnvironment* inner = outer->CopyForInlining(instr->closure(),
instr->arguments_count(),
void HSimulate::MergeWith(ZoneList<HSimulate*>* list) {
+ if (!list->is_empty() && !HasAstId()) {
+ set_ast_id(list->last()->ast_id());
+ }
while (!list->is_empty()) {
HSimulate* from = list->RemoveLast();
ZoneList<HValue*>* from_values = &from->values_;
void HSimulate::Verify() {
HInstruction::Verify();
- ASSERT(HasAstId());
+ ASSERT(HasAstId() || next()->IsEnterInlined());
}
public:
static HEnterInlined* New(Zone* zone,
HValue* context,
+ BailoutId return_id,
Handle<JSFunction> closure,
int arguments_count,
FunctionLiteral* function,
InliningKind inlining_kind,
Variable* arguments_var,
HArgumentsObject* arguments_object) {
- return new(zone) HEnterInlined(closure, arguments_count, function,
- inlining_kind, arguments_var,
+ return new(zone) HEnterInlined(return_id, closure, arguments_count,
+ function, inlining_kind, arguments_var,
arguments_object, zone);
}
void set_arguments_pushed() { arguments_pushed_ = true; }
FunctionLiteral* function() const { return function_; }
InliningKind inlining_kind() const { return inlining_kind_; }
+ BailoutId ReturnId() const { return return_id_; }
virtual Representation RequiredInputRepresentation(int index) V8_OVERRIDE {
return Representation::None();
DECLARE_CONCRETE_INSTRUCTION(EnterInlined)
private:
- HEnterInlined(Handle<JSFunction> closure,
+ HEnterInlined(BailoutId return_id,
+ Handle<JSFunction> closure,
int arguments_count,
FunctionLiteral* function,
InliningKind inlining_kind,
Variable* arguments_var,
HArgumentsObject* arguments_object,
Zone* zone)
- : closure_(closure),
+ : return_id_(return_id),
+ closure_(closure),
arguments_count_(arguments_count),
arguments_pushed_(false),
function_(function),
return_targets_(2, zone) {
}
+ BailoutId return_id_;
Handle<JSFunction> closure_;
int arguments_count_;
bool arguments_pushed_;
HConstant* context = Add<HConstant>(Handle<Context>(target->context()));
inner_env->BindContext(context);
- Add<HSimulate>(return_id);
- current_block()->UpdateEnvironment(inner_env);
HArgumentsObject* arguments_object = NULL;
// If the function uses arguments object create and bind one, also copy
}
}
+ // Capture the state before invoking the inlined function for deopt in the
+ // inlined function. This simulate has no bailout-id since it's not directly
+ // reachable for deopt, and is only used to capture the state. If the simulate
+ // becomes reachable by merging, the ast id of the simulate merged into it is
+ // adopted.
+ Add<HSimulate>(BailoutId::None());
+
+ current_block()->UpdateEnvironment(inner_env);
+
HEnterInlined* enter_inlined =
- Add<HEnterInlined>(target, arguments_count, function,
+ Add<HEnterInlined>(return_id, target, arguments_count, function,
function_state()->inlining_kind(),
function->scope()->arguments(),
arguments_object);
LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) {
HEnvironment* outer = current_block_->last_environment();
+ outer->set_ast_id(instr->ReturnId());
HConstant* undefined = graph()->GetConstantUndefined();
HEnvironment* inner = outer->CopyForInlining(instr->closure(),
instr->arguments_count(),
LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) {
HEnvironment* outer = current_block_->last_environment();
+ outer->set_ast_id(instr->ReturnId());
HConstant* undefined = graph()->GetConstantUndefined();
HEnvironment* inner = outer->CopyForInlining(instr->closure(),
instr->arguments_count(),
LInstruction* LChunkBuilder::DoEnterInlined(HEnterInlined* instr) {
HEnvironment* outer = current_block_->last_environment();
+ outer->set_ast_id(instr->ReturnId());
HConstant* undefined = graph()->GetConstantUndefined();
HEnvironment* inner = outer->CopyForInlining(instr->closure(),
instr->arguments_count(),
--- /dev/null
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+"use strict";
+function f1(d) {
+ return 1 + f2(f3(d));
+}
+
+function f2(v) { return v; }
+
+function f3(d) {
+ if (d) %DeoptimizeFunction(f1);
+ return 2;
+}
+
+%NeverOptimizeFunction(f3);
+
+f1(false);
+f1(false);
+%OptimizeFunctionOnNextCall(f1);
+assertEquals(3, f1(true));