From b10fb64b0c320c47d449496c063ed38850e171f9 Mon Sep 17 00:00:00 2001 From: mbrandy Date: Mon, 4 May 2015 08:33:50 -0700 Subject: [PATCH] PPC: Only swap undefined for the global object if necessary in the prologue Port fab3508062396c2768b5dcfa0fd7d40eba527d62 R=verwaest@chromium.org, dstence@us.ibm.com, michael_dawson@ca.ibm.com BUG= Review URL: https://codereview.chromium.org/1122773002 Cr-Commit-Position: refs/heads/master@{#28203} --- src/ppc/full-codegen-ppc.cc | 3 ++- src/ppc/lithium-codegen-ppc.cc | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ppc/full-codegen-ppc.cc b/src/ppc/full-codegen-ppc.cc index b80a2b2..27de1dc 100644 --- a/src/ppc/full-codegen-ppc.cc +++ b/src/ppc/full-codegen-ppc.cc @@ -123,7 +123,8 @@ void FullCodeGenerator::Generate() { // Sloppy mode functions and builtins need to replace the receiver with the // global proxy when called as functions (without an explicit receiver // object). - if (is_sloppy(info->language_mode()) && !info->is_native()) { + if (is_sloppy(info->language_mode()) && !info->is_native() && + info->MayUseThis()) { Label ok; int receiver_offset = info->scope()->num_parameters() * kPointerSize; __ LoadP(r5, MemOperand(sp, receiver_offset), r0); diff --git a/src/ppc/lithium-codegen-ppc.cc b/src/ppc/lithium-codegen-ppc.cc index 50dcd19..fb2b823 100644 --- a/src/ppc/lithium-codegen-ppc.cc +++ b/src/ppc/lithium-codegen-ppc.cc @@ -118,7 +118,7 @@ bool LCodeGen::GeneratePrologue() { // Sloppy mode functions and builtins need to replace the receiver with the // global proxy when called as functions (without an explicit receiver // object). - if (graph()->this_has_uses() && is_sloppy(info_->language_mode()) && + if (is_sloppy(info_->language_mode()) && info()->MayUseThis() && !info_->is_native()) { Label ok; int receiver_offset = info_->scope()->num_parameters() * kPointerSize; -- 2.7.4