Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Unified Diff: src/ppc/full-codegen-ppc.cc

Issue 1140633003: Reapply "Resolve references to "this" the same way as normal variables"" (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: ScopeInfo records slot of "this" binding; formatting Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/parser.cc ('k') | src/ppc/lithium-codegen-ppc.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ppc/full-codegen-ppc.cc
diff --git a/src/ppc/full-codegen-ppc.cc b/src/ppc/full-codegen-ppc.cc
index 877d4d01ca6ce9fae4445147fcaf07600b300e97..bf8424dc99e2c44e353d13253bf294a1ab54442e 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->MayUseThis() && info->scope()->has_this_declaration()) {
Label ok;
int receiver_offset = info->scope()->num_parameters() * kPointerSize;
__ LoadP(r5, MemOperand(sp, receiver_offset), r0);
@@ -221,8 +221,9 @@ void FullCodeGenerator::Generate() {
__ StoreP(r3, MemOperand(fp, StandardFrameConstants::kContextOffset));
// Copy any necessary parameters into the context.
int num_parameters = info->scope()->num_parameters();
- for (int i = 0; i < num_parameters; i++) {
- Variable* var = scope()->parameter(i);
+ 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);
if (var->IsContextSlot()) {
int parameter_offset = StandardFrameConstants::kCallerSPOffset +
(num_parameters - 1 - i) * kPointerSize;
@@ -3028,8 +3029,9 @@ void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) {
__ LoadP(r7, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
// r6: the receiver of the enclosing function.
- int receiver_offset = 2 + info_->scope()->num_parameters();
- __ LoadP(r6, MemOperand(fp, receiver_offset * kPointerSize), r0);
+ Variable* this_var = scope()->LookupThis();
+ DCHECK_NOT_NULL(this_var);
+ GetVar(r6, this_var);
// r5: language mode.
__ LoadSmiLiteral(r5, Smi::FromInt(language_mode()));
« no previous file with comments | « src/parser.cc ('k') | src/ppc/lithium-codegen-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698