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

Unified Diff: src/mips64/full-codegen-mips64.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/mips/lithium-codegen-mips.cc ('k') | src/mips64/lithium-codegen-mips64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mips64/full-codegen-mips64.cc
diff --git a/src/mips64/full-codegen-mips64.cc b/src/mips64/full-codegen-mips64.cc
index 7e1ade4c5665ccb2985e248da124915879a0b9dc..438d355ab48c711e18c80b4f53ef68d24b76c542 100644
--- a/src/mips64/full-codegen-mips64.cc
+++ b/src/mips64/full-codegen-mips64.cc
@@ -135,7 +135,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;
__ ld(at, MemOperand(sp, receiver_offset));
@@ -222,8 +222,9 @@ void FullCodeGenerator::Generate() {
__ sd(v0, 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;
@@ -3018,8 +3019,9 @@ void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) {
__ ld(a6, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
// a5: the receiver of the enclosing function.
- int receiver_offset = 2 + info_->scope()->num_parameters();
- __ ld(a5, MemOperand(fp, receiver_offset * kPointerSize));
+ Variable* this_var = scope()->LookupThis();
+ DCHECK_NOT_NULL(this_var);
+ __ ld(a5, VarOperand(this_var, a5));
// a4: the language mode.
__ li(a4, Operand(Smi::FromInt(language_mode())));
« no previous file with comments | « src/mips/lithium-codegen-mips.cc ('k') | src/mips64/lithium-codegen-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698