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

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

Issue 1177903004: 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/x64/full-codegen-x64.cc ('k') | test/unittests/compiler/js-type-feedback-unittest.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_X87 7 #if V8_TARGET_ARCH_X87
8 8
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 2979 matching lines...) Expand 10 before | Expand all | Expand 10 after
2990 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { 2990 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) {
2991 // Push copy of the first argument or undefined if it doesn't exist. 2991 // Push copy of the first argument or undefined if it doesn't exist.
2992 if (arg_count > 0) { 2992 if (arg_count > 0) {
2993 __ push(Operand(esp, arg_count * kPointerSize)); 2993 __ push(Operand(esp, arg_count * kPointerSize));
2994 } else { 2994 } else {
2995 __ push(Immediate(isolate()->factory()->undefined_value())); 2995 __ push(Immediate(isolate()->factory()->undefined_value()));
2996 } 2996 }
2997 2997
2998 // Push the enclosing function. 2998 // Push the enclosing function.
2999 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 2999 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
3000 3000 // Push the receiver of the enclosing function.
3001 Variable* this_var = scope()->LookupThis();
3002 DCHECK_NOT_NULL(this_var);
3003 __ push(VarOperand(this_var, ecx));
3001 // Push the language mode. 3004 // Push the language mode.
3002 __ push(Immediate(Smi::FromInt(language_mode()))); 3005 __ push(Immediate(Smi::FromInt(language_mode())));
3003 3006
3004 // Push the start position of the scope the calls resides in. 3007 // Push the start position of the scope the calls resides in.
3005 __ push(Immediate(Smi::FromInt(scope()->start_position()))); 3008 __ push(Immediate(Smi::FromInt(scope()->start_position())));
3006 3009
3007 // Do the runtime call. 3010 // Do the runtime call.
3008 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); 3011 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 6);
3009 } 3012 }
3010 3013
3011 3014
3012 void FullCodeGenerator::EmitInitializeThisAfterSuper( 3015 void FullCodeGenerator::EmitInitializeThisAfterSuper(
3013 SuperCallReference* super_call_ref, FeedbackVectorICSlot slot) { 3016 SuperCallReference* super_call_ref, FeedbackVectorICSlot slot) {
3014 Variable* this_var = super_call_ref->this_var()->var(); 3017 Variable* this_var = super_call_ref->this_var()->var();
3015 GetVar(ecx, this_var); 3018 GetVar(ecx, this_var);
3016 __ cmp(ecx, isolate()->factory()->the_hole_value()); 3019 __ cmp(ecx, isolate()->factory()->the_hole_value());
3017 Label uninitialized_this; 3020 Label uninitialized_this;
3018 __ j(equal, &uninitialized_this); 3021 __ j(equal, &uninitialized_this);
(...skipping 11 matching lines...) Expand all
3030 // through this function. Avoid early returns. 3033 // through this function. Avoid early returns.
3031 expr->return_is_recorded_ = false; 3034 expr->return_is_recorded_ = false;
3032 #endif 3035 #endif
3033 3036
3034 Comment cmnt(masm_, "[ Call"); 3037 Comment cmnt(masm_, "[ Call");
3035 Expression* callee = expr->expression(); 3038 Expression* callee = expr->expression();
3036 Call::CallType call_type = expr->GetCallType(isolate()); 3039 Call::CallType call_type = expr->GetCallType(isolate());
3037 3040
3038 if (call_type == Call::POSSIBLY_EVAL_CALL) { 3041 if (call_type == Call::POSSIBLY_EVAL_CALL) {
3039 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval 3042 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval
3040 // to resolve the function we need to call. Then we call the resolved 3043 // to resolve the function we need to call and the receiver of the call.
3041 // function using the given arguments. 3044 // Then we call the resolved function using the given arguments.
3042 ZoneList<Expression*>* args = expr->arguments(); 3045 ZoneList<Expression*>* args = expr->arguments();
3043 int arg_count = args->length(); 3046 int arg_count = args->length();
3044 { PreservePositionScope pos_scope(masm()->positions_recorder()); 3047 { PreservePositionScope pos_scope(masm()->positions_recorder());
3045 VisitForStackValue(callee); 3048 VisitForStackValue(callee);
3046 // Reserved receiver slot. 3049 // Reserved receiver slot.
3047 __ push(Immediate(isolate()->factory()->undefined_value())); 3050 __ push(Immediate(isolate()->factory()->undefined_value()));
3048 // Push the arguments. 3051 // Push the arguments.
3049 for (int i = 0; i < arg_count; i++) { 3052 for (int i = 0; i < arg_count; i++) {
3050 VisitForStackValue(args->at(i)); 3053 VisitForStackValue(args->at(i));
3051 } 3054 }
3052 3055
3053 // Push a copy of the function (found below the arguments) and 3056 // Push a copy of the function (found below the arguments) and
3054 // resolve eval. 3057 // resolve eval.
3055 __ push(Operand(esp, (arg_count + 1) * kPointerSize)); 3058 __ push(Operand(esp, (arg_count + 1) * kPointerSize));
3056 EmitResolvePossiblyDirectEval(arg_count); 3059 EmitResolvePossiblyDirectEval(arg_count);
3057 3060
3058 // Touch up the stack with the resolved function. 3061 // The runtime call returns a pair of values in eax (function) and
3062 // edx (receiver). Touch up the stack with the right values.
3063 __ mov(Operand(esp, (arg_count + 0) * kPointerSize), edx);
3059 __ mov(Operand(esp, (arg_count + 1) * kPointerSize), eax); 3064 __ mov(Operand(esp, (arg_count + 1) * kPointerSize), eax);
3060 3065
3061 PrepareForBailoutForId(expr->EvalOrLookupId(), NO_REGISTERS); 3066 PrepareForBailoutForId(expr->EvalOrLookupId(), NO_REGISTERS);
3062 } 3067 }
3063 // Record source position for debugger. 3068 // Record source position for debugger.
3064 SetSourcePosition(expr->position()); 3069 SetSourcePosition(expr->position());
3065 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); 3070 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS);
3066 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); 3071 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize));
3067 __ CallStub(&stub); 3072 __ CallStub(&stub);
3068 RecordJSReturnSite(expr); 3073 RecordJSReturnSite(expr);
(...skipping 1612 matching lines...) Expand 10 before | Expand all | Expand 10 after
4681 VariableProxy* proxy = expr->expression()->AsVariableProxy(); 4686 VariableProxy* proxy = expr->expression()->AsVariableProxy();
4682 4687
4683 if (property != NULL) { 4688 if (property != NULL) {
4684 VisitForStackValue(property->obj()); 4689 VisitForStackValue(property->obj());
4685 VisitForStackValue(property->key()); 4690 VisitForStackValue(property->key());
4686 __ push(Immediate(Smi::FromInt(language_mode()))); 4691 __ push(Immediate(Smi::FromInt(language_mode())));
4687 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); 4692 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION);
4688 context()->Plug(eax); 4693 context()->Plug(eax);
4689 } else if (proxy != NULL) { 4694 } else if (proxy != NULL) {
4690 Variable* var = proxy->var(); 4695 Variable* var = proxy->var();
4691 // Delete of an unqualified identifier is disallowed in strict mode but 4696 // Delete of an unqualified identifier is disallowed in strict mode
4692 // "delete this" is allowed. 4697 // but "delete this" is allowed.
4693 bool is_this = var->HasThisName(isolate()); 4698 DCHECK(is_sloppy(language_mode()) || var->is_this());
4694 DCHECK(is_sloppy(language_mode()) || is_this);
4695 if (var->IsUnallocated()) { 4699 if (var->IsUnallocated()) {
4696 __ push(GlobalObjectOperand()); 4700 __ push(GlobalObjectOperand());
4697 __ push(Immediate(var->name())); 4701 __ push(Immediate(var->name()));
4698 __ push(Immediate(Smi::FromInt(SLOPPY))); 4702 __ push(Immediate(Smi::FromInt(SLOPPY)));
4699 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); 4703 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION);
4700 context()->Plug(eax); 4704 context()->Plug(eax);
4701 } else if (var->IsStackAllocated() || var->IsContextSlot()) { 4705 } else if (var->IsStackAllocated() || var->IsContextSlot()) {
4702 // Result of deleting non-global variables is false. 'this' is 4706 // Result of deleting non-global variables is false. 'this' is
4703 // not really a variable, though we implement it as one. The 4707 // not really a variable, though we implement it as one. The
4704 // subexpression does not have side effects. 4708 // subexpression does not have side effects.
4705 context()->Plug(is_this); 4709 context()->Plug(var->is_this());
4706 } else { 4710 } else {
4707 // Non-global variable. Call the runtime to try to delete from the 4711 // Non-global variable. Call the runtime to try to delete from the
4708 // context where the variable was introduced. 4712 // context where the variable was introduced.
4709 __ push(context_register()); 4713 __ push(context_register());
4710 __ push(Immediate(var->name())); 4714 __ push(Immediate(var->name()));
4711 __ CallRuntime(Runtime::kDeleteLookupSlot, 2); 4715 __ CallRuntime(Runtime::kDeleteLookupSlot, 2);
4712 context()->Plug(eax); 4716 context()->Plug(eax);
4713 } 4717 }
4714 } else { 4718 } else {
4715 // Result of deleting non-property, non-variable reference is true. 4719 // Result of deleting non-property, non-variable reference is true.
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
5451 Assembler::target_address_at(call_target_address, 5455 Assembler::target_address_at(call_target_address,
5452 unoptimized_code)); 5456 unoptimized_code));
5453 return OSR_AFTER_STACK_CHECK; 5457 return OSR_AFTER_STACK_CHECK;
5454 } 5458 }
5455 5459
5456 5460
5457 } // namespace internal 5461 } // namespace internal
5458 } // namespace v8 5462 } // namespace v8
5459 5463
5460 #endif // V8_TARGET_ARCH_X87 5464 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | test/unittests/compiler/js-type-feedback-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698