From: mbrandy Date: Thu, 7 May 2015 22:15:38 +0000 (-0700) Subject: Revert of PPC: Resolve references to "this" the same way as normal variables (patchse... X-Git-Tag: upstream/4.7.83~2735 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=727e92eced9ef1eac618fec24787684f8bd577e4;p=platform%2Fupstream%2Fv8.git Revert of PPC: Resolve references to "this" the same way as normal variables (patchset #1 id:1 of https://codereview.chromium.org/1129803003/) Reason for revert: Original commit was reverted. Original issue's description: > PPC: Resolve references to "this" the same way as normal variables > > Port 18619d355192e2699203d12d9ebb9caea107b693 > > Original commit message: > Make the parser handle references to "this" as unresolved variables, so the > same logic as for the rest of function parameters is used for the receiver. > Minor additions to the code generation handle copying the receiver to the > context, along with the rest of the function parameters. > > Based on work by Adrian Perez de Castro . > > R=wingo@igalia.com, dstence@us.ibm.com, michael_dawson@ca.ibm.com > BUG= > > Committed: https://crrev.com/e0ec097b2f49c4c99a2e9490f4b1a09e02abfd4d > Cr-Commit-Position: refs/heads/master@{#28272} TBR=dstence@us.ibm.com,michael_dawson@ca.ibm.com,wingo@igalia.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG= Review URL: https://codereview.chromium.org/1132513005 Cr-Commit-Position: refs/heads/master@{#28305} --- diff --git a/src/ppc/full-codegen-ppc.cc b/src/ppc/full-codegen-ppc.cc index e96f7c4..39d6dae 100644 --- a/src/ppc/full-codegen-ppc.cc +++ b/src/ppc/full-codegen-ppc.cc @@ -124,7 +124,7 @@ void FullCodeGenerator::Generate() { // global proxy when called as functions (without an explicit receiver // object). if (is_sloppy(info->language_mode()) && !info->is_native() && - info->MayUseThis() && info->scope()->has_this_declaration()) { + info->MayUseThis()) { Label ok; int receiver_offset = info->scope()->num_parameters() * kPointerSize; __ LoadP(r5, MemOperand(sp, receiver_offset), r0); @@ -221,9 +221,8 @@ void FullCodeGenerator::Generate() { __ StoreP(r3, MemOperand(fp, StandardFrameConstants::kContextOffset)); // Copy any necessary parameters into the context. int num_parameters = info->scope()->num_parameters(); - int first_parameter = info->scope()->has_this_declaration() ? -1 : 0; - for (int i = first_parameter; i < num_parameters; i++) { - Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i); + for (int i = 0; i < num_parameters; i++) { + Variable* var = scope()->parameter(i); if (var->IsContextSlot()) { int parameter_offset = StandardFrameConstants::kCallerSPOffset + (num_parameters - 1 - i) * kPointerSize; @@ -3050,9 +3049,8 @@ void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { __ LoadP(r7, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); // r6: the receiver of the enclosing function. - Variable* this_var = scope()->LookupThis(); - DCHECK_NOT_NULL(this_var); - GetVar(r6, this_var); + int receiver_offset = 2 + info_->scope()->num_parameters(); + __ LoadP(r6, MemOperand(fp, receiver_offset * kPointerSize), r0); // r5: language mode. __ LoadSmiLiteral(r5, Smi::FromInt(language_mode())); diff --git a/src/ppc/lithium-codegen-ppc.cc b/src/ppc/lithium-codegen-ppc.cc index 17232c7..443d8e7 100644 --- a/src/ppc/lithium-codegen-ppc.cc +++ b/src/ppc/lithium-codegen-ppc.cc @@ -119,7 +119,7 @@ bool LCodeGen::GeneratePrologue() { // global proxy when called as functions (without an explicit receiver // object). if (is_sloppy(info_->language_mode()) && info()->MayUseThis() && - !info_->is_native() && info_->scope()->has_this_declaration()) { + !info_->is_native()) { Label ok; int receiver_offset = info_->scope()->num_parameters() * kPointerSize; __ LoadP(r5, MemOperand(sp, receiver_offset)); @@ -199,9 +199,8 @@ bool LCodeGen::GeneratePrologue() { __ StoreP(r3, MemOperand(fp, StandardFrameConstants::kContextOffset)); // Copy any necessary parameters into the context. int num_parameters = scope()->num_parameters(); - int first_parameter = scope()->has_this_declaration() ? -1 : 0; - for (int i = first_parameter; i < num_parameters; i++) { - Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i); + for (int i = 0; i < num_parameters; i++) { + Variable* var = scope()->parameter(i); if (var->IsContextSlot()) { int parameter_offset = StandardFrameConstants::kCallerSPOffset + (num_parameters - 1 - i) * kPointerSize;