| Index: src/hydrogen.cc
|
| diff --git a/src/hydrogen.cc b/src/hydrogen.cc
|
| index 17d0131881b879fc2d33a8d24100350ccf5c4d9f..c1fe097956821475874250b0e0c0324dddb1a814 100644
|
| --- a/src/hydrogen.cc
|
| +++ b/src/hydrogen.cc
|
| @@ -3985,6 +3985,12 @@ void HGraphBuilder::TraceInline(Handle<JSFunction> target, const char* reason) {
|
| bool HGraphBuilder::TryInline(Call* expr) {
|
| if (!FLAG_use_inlining) return false;
|
|
|
| + // The function call we are inlining has an explicit receiver if it
|
| + // is a property call.
|
| + ReceiverType receiver_type = (expr->expression()->AsProperty() == NULL)
|
| + ? IMPLICIT_RECEIVER
|
| + : EXPLICIT_RECEIVER;
|
| +
|
| // Precondition: call is monomorphic and we have found a target with the
|
| // appropriate arity.
|
| Handle<JSFunction> target = expr->target();
|
| @@ -4119,13 +4125,16 @@ bool HGraphBuilder::TryInline(Call* expr) {
|
| environment()->CopyForInlining(target,
|
| function,
|
| HEnvironment::HYDROGEN,
|
| - undefined);
|
| + undefined,
|
| + receiver_type);
|
| HBasicBlock* body_entry = CreateBasicBlock(inner_env);
|
| current_block()->Goto(body_entry);
|
|
|
| body_entry->SetJoinId(expr->ReturnId());
|
| set_current_block(body_entry);
|
| - AddInstruction(new(zone()) HEnterInlined(target, function));
|
| + AddInstruction(new(zone()) HEnterInlined(target,
|
| + function,
|
| + receiver_type));
|
| VisitStatements(function->body());
|
| if (HasStackOverflow()) {
|
| // Bail out if the inline function did, as we cannot residualize a call
|
| @@ -4369,7 +4378,7 @@ void HGraphBuilder::VisitCall(Call* expr) {
|
| }
|
|
|
| // Named function call.
|
| - expr->RecordTypeFeedback(oracle());
|
| + expr->RecordTypeFeedback(oracle(), EXPLICIT_RECEIVER);
|
|
|
| if (TryCallApply(expr)) return;
|
|
|
| @@ -4378,7 +4387,6 @@ void HGraphBuilder::VisitCall(Call* expr) {
|
|
|
| Handle<String> name = prop->key()->AsLiteral()->AsPropertyName();
|
|
|
| - expr->RecordTypeFeedback(oracle());
|
| ZoneMapList* types = expr->GetReceiverTypes();
|
|
|
| HValue* receiver =
|
| @@ -4472,8 +4480,8 @@ void HGraphBuilder::VisitCall(Call* expr) {
|
| CHECK_ALIVE(VisitExpressions(expr->arguments()));
|
|
|
| call = PreProcessCall(new(zone()) HCallGlobal(context,
|
| - var->name(),
|
| - argument_count));
|
| + var->name(),
|
| + argument_count));
|
| }
|
|
|
| } else {
|
| @@ -5777,10 +5785,12 @@ HEnvironment* HEnvironment::CopyAsLoopHeader(HBasicBlock* loop_header) const {
|
| }
|
|
|
|
|
| -HEnvironment* HEnvironment::CopyForInlining(Handle<JSFunction> target,
|
| - FunctionLiteral* function,
|
| - CompilationPhase compilation_phase,
|
| - HConstant* undefined) const {
|
| +HEnvironment* HEnvironment::CopyForInlining(
|
| + Handle<JSFunction> target,
|
| + FunctionLiteral* function,
|
| + CompilationPhase compilation_phase,
|
| + HConstant* undefined,
|
| + ReceiverType receiver_type) const {
|
| // Outer environment is a copy of this one without the arguments.
|
| int arity = function->scope()->num_parameters();
|
| HEnvironment* outer = Copy();
|
| @@ -5802,6 +5812,11 @@ HEnvironment* HEnvironment::CopyForInlining(Handle<JSFunction> target,
|
| inner->SetValueAt(i, push);
|
| }
|
| }
|
| + // If the function we are inlining is a strict mode function, pass
|
| + // undefined as the implicit receiver.
|
| + if (function->strict_mode() && receiver_type == IMPLICIT_RECEIVER) {
|
| + inner->SetValueAt(0, undefined);
|
| + }
|
| inner->SetValueAt(arity + 1, outer->LookupContext());
|
| for (int i = arity + 2; i < inner->length(); ++i) {
|
| inner->SetValueAt(i, undefined);
|
|
|