Reviewers: Weiliang,

Message:
PTAL.

Description:
Revert of X87: Resolve references to "this" the same way as normal variables

Reason for revert:

   original commit was reverted.

   This reverts commit c3529ce50158546e2f2c25ee888e7e0170a488f1.

   original issues's description:

   > X87: Resolve references to "this" the same way as normal variables
   >
   > port 06a792b7cc2db33ffce7244c044a9c05afbb6116 (r28263).
   >
   > 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 <[email protected]>

BUG=

Please review this at https://codereview.chromium.org/1130913005/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+7, -11 lines):
  M src/x87/full-codegen-x87.cc
  M src/x87/lithium-codegen-x87.cc


Index: src/x87/full-codegen-x87.cc
diff --git a/src/x87/full-codegen-x87.cc b/src/x87/full-codegen-x87.cc
index 877f91c508adbedec2d00b6379b4ec4c29d4d35f..f1abd5befe21281f388a270770db9ea631466c92 100644
--- a/src/x87/full-codegen-x87.cc
+++ b/src/x87/full-codegen-x87.cc
@@ -210,9 +210,8 @@ void FullCodeGenerator::Generate() {

     // Copy parameters into context if necessary.
     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;
@@ -2951,9 +2950,7 @@ void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) {
   // Push the enclosing function.
   __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
   // Push the receiver of the enclosing function.
-  Variable* this_var = scope()->LookupThis();
-  DCHECK_NOT_NULL(this_var);
-  __ push(VarOperand(this_var, ecx));
+ __ push(Operand(ebp, (2 + info_->scope()->num_parameters()) * kPointerSize));
   // Push the language mode.
   __ push(Immediate(Smi::FromInt(language_mode())));

Index: src/x87/lithium-codegen-x87.cc
diff --git a/src/x87/lithium-codegen-x87.cc b/src/x87/lithium-codegen-x87.cc
index 62c4c942a45c85a74ff716c0a115689aadbba335..b5dc1425f9ef59775a316d570e93b2be31c16e92 100644
--- a/src/x87/lithium-codegen-x87.cc
+++ b/src/x87/lithium-codegen-x87.cc
@@ -110,8 +110,8 @@ 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 (is_sloppy(info()->language_mode()) && info()->MayUseThis() &&
-        !info()->is_native() && info()->scope()->has_this_declaration()) {
+    if (is_sloppy(info_->language_mode()) && info()->MayUseThis() &&
+        !info_->is_native()) {
       Label ok;
       // +1 for return address.
       int receiver_offset = (scope()->num_parameters() + 1) * kPointerSize;
@@ -242,9 +242,8 @@ bool LCodeGen::GeneratePrologue() {

     // Copy parameters into context if necessary.
     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;


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to