Commit b10fb64b authored by mbrandy's avatar mbrandy Committed by Commit bot

PPC: Only swap undefined for the global object if necessary in the prologue

Port fab35080

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}
parent f21ea065
......@@ -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);
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment