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

Side by Side Diff: src/mips/full-codegen-mips.cc

Issue 1180043004: Revert of Add script context with context-allocated "const this" (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/mips64/full-codegen-mips64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_MIPS 7 #if V8_TARGET_ARCH_MIPS
8 8
9 // Note on Mips implementation: 9 // Note on Mips implementation:
10 // 10 //
(...skipping 3071 matching lines...) Expand 10 before | Expand all | Expand 10 after
3082 // t3: copy of the first argument or undefined if it doesn't exist. 3082 // t3: copy of the first argument or undefined if it doesn't exist.
3083 if (arg_count > 0) { 3083 if (arg_count > 0) {
3084 __ lw(t3, MemOperand(sp, arg_count * kPointerSize)); 3084 __ lw(t3, MemOperand(sp, arg_count * kPointerSize));
3085 } else { 3085 } else {
3086 __ LoadRoot(t3, Heap::kUndefinedValueRootIndex); 3086 __ LoadRoot(t3, Heap::kUndefinedValueRootIndex);
3087 } 3087 }
3088 3088
3089 // t2: the receiver of the enclosing function. 3089 // t2: the receiver of the enclosing function.
3090 __ lw(t2, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 3090 __ lw(t2, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
3091 3091
3092 // t1: the language mode. 3092 // t1: the receiver of the enclosing function.
3093 __ li(t1, Operand(Smi::FromInt(language_mode()))); 3093 Variable* this_var = scope()->LookupThis();
3094 DCHECK_NOT_NULL(this_var);
3095 __ lw(t1, VarOperand(this_var, t1));
3094 3096
3095 // t0: the start position of the scope the calls resides in. 3097 // t0: the language mode.
3096 __ li(t0, Operand(Smi::FromInt(scope()->start_position()))); 3098 __ li(t0, Operand(Smi::FromInt(language_mode())));
3099
3100 // a1: the start position of the scope the calls resides in.
3101 __ li(a1, Operand(Smi::FromInt(scope()->start_position())));
3097 3102
3098 // Do the runtime call. 3103 // Do the runtime call.
3099 __ Push(t3, t2, t1, t0); 3104 __ Push(t3);
3100 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); 3105 __ Push(t2, t1, t0, a1);
3106 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 6);
3101 } 3107 }
3102 3108
3103 3109
3104 void FullCodeGenerator::EmitInitializeThisAfterSuper( 3110 void FullCodeGenerator::EmitInitializeThisAfterSuper(
3105 SuperCallReference* super_ref, FeedbackVectorICSlot slot) { 3111 SuperCallReference* super_ref, FeedbackVectorICSlot slot) {
3106 Variable* this_var = super_ref->this_var()->var(); 3112 Variable* this_var = super_ref->this_var()->var();
3107 GetVar(a1, this_var); 3113 GetVar(a1, this_var);
3108 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); 3114 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
3109 Label uninitialized_this; 3115 Label uninitialized_this;
3110 __ Branch(&uninitialized_this, eq, a1, Operand(at)); 3116 __ Branch(&uninitialized_this, eq, a1, Operand(at));
(...skipping 12 matching lines...) Expand all
3123 // through this function. Avoid early returns. 3129 // through this function. Avoid early returns.
3124 expr->return_is_recorded_ = false; 3130 expr->return_is_recorded_ = false;
3125 #endif 3131 #endif
3126 3132
3127 Comment cmnt(masm_, "[ Call"); 3133 Comment cmnt(masm_, "[ Call");
3128 Expression* callee = expr->expression(); 3134 Expression* callee = expr->expression();
3129 Call::CallType call_type = expr->GetCallType(isolate()); 3135 Call::CallType call_type = expr->GetCallType(isolate());
3130 3136
3131 if (call_type == Call::POSSIBLY_EVAL_CALL) { 3137 if (call_type == Call::POSSIBLY_EVAL_CALL) {
3132 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval 3138 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval
3133 // to resolve the function we need to call. Then we call the resolved 3139 // to resolve the function we need to call and the receiver of the
3134 // function using the given arguments. 3140 // call. Then we call the resolved function using the given
3141 // arguments.
3135 ZoneList<Expression*>* args = expr->arguments(); 3142 ZoneList<Expression*>* args = expr->arguments();
3136 int arg_count = args->length(); 3143 int arg_count = args->length();
3137 3144
3138 { PreservePositionScope pos_scope(masm()->positions_recorder()); 3145 { PreservePositionScope pos_scope(masm()->positions_recorder());
3139 VisitForStackValue(callee); 3146 VisitForStackValue(callee);
3140 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex); 3147 __ LoadRoot(a2, Heap::kUndefinedValueRootIndex);
3141 __ push(a2); // Reserved receiver slot. 3148 __ push(a2); // Reserved receiver slot.
3142 3149
3143 // Push the arguments. 3150 // Push the arguments.
3144 for (int i = 0; i < arg_count; i++) { 3151 for (int i = 0; i < arg_count; i++) {
3145 VisitForStackValue(args->at(i)); 3152 VisitForStackValue(args->at(i));
3146 } 3153 }
3147 3154
3148 // Push a copy of the function (found below the arguments) and 3155 // Push a copy of the function (found below the arguments) and
3149 // resolve eval. 3156 // resolve eval.
3150 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); 3157 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize));
3151 __ push(a1); 3158 __ push(a1);
3152 EmitResolvePossiblyDirectEval(arg_count); 3159 EmitResolvePossiblyDirectEval(arg_count);
3153 3160
3154 // Touch up the stack with the resolved function. 3161 // The runtime call returns a pair of values in v0 (function) and
3162 // v1 (receiver). Touch up the stack with the right values.
3155 __ sw(v0, MemOperand(sp, (arg_count + 1) * kPointerSize)); 3163 __ sw(v0, MemOperand(sp, (arg_count + 1) * kPointerSize));
3164 __ sw(v1, MemOperand(sp, arg_count * kPointerSize));
3156 3165
3157 PrepareForBailoutForId(expr->EvalOrLookupId(), NO_REGISTERS); 3166 PrepareForBailoutForId(expr->EvalOrLookupId(), NO_REGISTERS);
3158 } 3167 }
3159 // Record source position for debugger. 3168 // Record source position for debugger.
3160 SetSourcePosition(expr->position()); 3169 SetSourcePosition(expr->position());
3161 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); 3170 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS);
3162 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize)); 3171 __ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize));
3163 __ CallStub(&stub); 3172 __ CallStub(&stub);
3164 RecordJSReturnSite(expr); 3173 RecordJSReturnSite(expr);
3165 // Restore context register. 3174 // Restore context register.
(...skipping 1608 matching lines...) Expand 10 before | Expand all | Expand 10 after
4774 4783
4775 if (property != NULL) { 4784 if (property != NULL) {
4776 VisitForStackValue(property->obj()); 4785 VisitForStackValue(property->obj());
4777 VisitForStackValue(property->key()); 4786 VisitForStackValue(property->key());
4778 __ li(a1, Operand(Smi::FromInt(language_mode()))); 4787 __ li(a1, Operand(Smi::FromInt(language_mode())));
4779 __ push(a1); 4788 __ push(a1);
4780 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); 4789 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION);
4781 context()->Plug(v0); 4790 context()->Plug(v0);
4782 } else if (proxy != NULL) { 4791 } else if (proxy != NULL) {
4783 Variable* var = proxy->var(); 4792 Variable* var = proxy->var();
4784 // Delete of an unqualified identifier is disallowed in strict mode but 4793 // Delete of an unqualified identifier is disallowed in strict mode
4785 // "delete this" is allowed. 4794 // but "delete this" is allowed.
4786 bool is_this = var->HasThisName(isolate()); 4795 DCHECK(is_sloppy(language_mode()) || var->is_this());
4787 DCHECK(is_sloppy(language_mode()) || is_this);
4788 if (var->IsUnallocated()) { 4796 if (var->IsUnallocated()) {
4789 __ lw(a2, GlobalObjectOperand()); 4797 __ lw(a2, GlobalObjectOperand());
4790 __ li(a1, Operand(var->name())); 4798 __ li(a1, Operand(var->name()));
4791 __ li(a0, Operand(Smi::FromInt(SLOPPY))); 4799 __ li(a0, Operand(Smi::FromInt(SLOPPY)));
4792 __ Push(a2, a1, a0); 4800 __ Push(a2, a1, a0);
4793 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); 4801 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION);
4794 context()->Plug(v0); 4802 context()->Plug(v0);
4795 } else if (var->IsStackAllocated() || var->IsContextSlot()) { 4803 } else if (var->IsStackAllocated() || var->IsContextSlot()) {
4796 // Result of deleting non-global, non-dynamic variables is false. 4804 // Result of deleting non-global, non-dynamic variables is false.
4797 // The subexpression does not have side effects. 4805 // The subexpression does not have side effects.
4798 context()->Plug(is_this); 4806 context()->Plug(var->is_this());
4799 } else { 4807 } else {
4800 // Non-global variable. Call the runtime to try to delete from the 4808 // Non-global variable. Call the runtime to try to delete from the
4801 // context where the variable was introduced. 4809 // context where the variable was introduced.
4802 DCHECK(!context_register().is(a2)); 4810 DCHECK(!context_register().is(a2));
4803 __ li(a2, Operand(var->name())); 4811 __ li(a2, Operand(var->name()));
4804 __ Push(context_register(), a2); 4812 __ Push(context_register(), a2);
4805 __ CallRuntime(Runtime::kDeleteLookupSlot, 2); 4813 __ CallRuntime(Runtime::kDeleteLookupSlot, 2);
4806 context()->Plug(v0); 4814 context()->Plug(v0);
4807 } 4815 }
4808 } else { 4816 } else {
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
5538 reinterpret_cast<uint32_t>( 5546 reinterpret_cast<uint32_t>(
5539 isolate->builtins()->OsrAfterStackCheck()->entry())); 5547 isolate->builtins()->OsrAfterStackCheck()->entry()));
5540 return OSR_AFTER_STACK_CHECK; 5548 return OSR_AFTER_STACK_CHECK;
5541 } 5549 }
5542 5550
5543 5551
5544 } // namespace internal 5552 } // namespace internal
5545 } // namespace v8 5553 } // namespace v8
5546 5554
5547 #endif // V8_TARGET_ARCH_MIPS 5555 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/mips64/full-codegen-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698