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

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

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