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

Side by Side Diff: src/ia32/full-codegen-ia32.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/hydrogen.cc ('k') | src/mips/full-codegen-mips.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_IA32 7 #if V8_TARGET_ARCH_IA32
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 2988 matching lines...) Expand 10 before | Expand all | Expand 10 after
2999 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { 2999 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) {
3000 // Push copy of the first argument or undefined if it doesn't exist. 3000 // Push copy of the first argument or undefined if it doesn't exist.
3001 if (arg_count > 0) { 3001 if (arg_count > 0) {
3002 __ push(Operand(esp, arg_count * kPointerSize)); 3002 __ push(Operand(esp, arg_count * kPointerSize));
3003 } else { 3003 } else {
3004 __ push(Immediate(isolate()->factory()->undefined_value())); 3004 __ push(Immediate(isolate()->factory()->undefined_value()));
3005 } 3005 }
3006 3006
3007 // Push the enclosing function. 3007 // Push the enclosing function.
3008 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 3008 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
3009 3009 // Push the receiver of the enclosing function.
3010 Variable* this_var = scope()->LookupThis();
3011 DCHECK_NOT_NULL(this_var);
3012 __ push(VarOperand(this_var, ecx));
3010 // Push the language mode. 3013 // Push the language mode.
3011 __ push(Immediate(Smi::FromInt(language_mode()))); 3014 __ push(Immediate(Smi::FromInt(language_mode())));
3012 3015
3013 // Push the start position of the scope the calls resides in. 3016 // Push the start position of the scope the calls resides in.
3014 __ push(Immediate(Smi::FromInt(scope()->start_position()))); 3017 __ push(Immediate(Smi::FromInt(scope()->start_position())));
3015 3018
3016 // Do the runtime call. 3019 // Do the runtime call.
3017 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); 3020 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 6);
3018 } 3021 }
3019 3022
3020 3023
3021 void FullCodeGenerator::EmitInitializeThisAfterSuper( 3024 void FullCodeGenerator::EmitInitializeThisAfterSuper(
3022 SuperCallReference* super_call_ref, FeedbackVectorICSlot slot) { 3025 SuperCallReference* super_call_ref, FeedbackVectorICSlot slot) {
3023 Variable* this_var = super_call_ref->this_var()->var(); 3026 Variable* this_var = super_call_ref->this_var()->var();
3024 GetVar(ecx, this_var); 3027 GetVar(ecx, this_var);
3025 __ cmp(ecx, isolate()->factory()->the_hole_value()); 3028 __ cmp(ecx, isolate()->factory()->the_hole_value());
3026 Label uninitialized_this; 3029 Label uninitialized_this;
3027 __ j(equal, &uninitialized_this); 3030 __ j(equal, &uninitialized_this);
(...skipping 11 matching lines...) Expand all
3039 // through this function. Avoid early returns. 3042 // through this function. Avoid early returns.
3040 expr->return_is_recorded_ = false; 3043 expr->return_is_recorded_ = false;
3041 #endif 3044 #endif
3042 3045
3043 Comment cmnt(masm_, "[ Call"); 3046 Comment cmnt(masm_, "[ Call");
3044 Expression* callee = expr->expression(); 3047 Expression* callee = expr->expression();
3045 Call::CallType call_type = expr->GetCallType(isolate()); 3048 Call::CallType call_type = expr->GetCallType(isolate());
3046 3049
3047 if (call_type == Call::POSSIBLY_EVAL_CALL) { 3050 if (call_type == Call::POSSIBLY_EVAL_CALL) {
3048 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval 3051 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval
3049 // to resolve the function we need to call. Then we call the resolved 3052 // to resolve the function we need to call and the receiver of the call.
3050 // function using the given arguments. 3053 // Then we call the resolved function using the given arguments.
3051 ZoneList<Expression*>* args = expr->arguments(); 3054 ZoneList<Expression*>* args = expr->arguments();
3052 int arg_count = args->length(); 3055 int arg_count = args->length();
3053 { PreservePositionScope pos_scope(masm()->positions_recorder()); 3056 { PreservePositionScope pos_scope(masm()->positions_recorder());
3054 VisitForStackValue(callee); 3057 VisitForStackValue(callee);
3055 // Reserved receiver slot. 3058 // Reserved receiver slot.
3056 __ push(Immediate(isolate()->factory()->undefined_value())); 3059 __ push(Immediate(isolate()->factory()->undefined_value()));
3057 // Push the arguments. 3060 // Push the arguments.
3058 for (int i = 0; i < arg_count; i++) { 3061 for (int i = 0; i < arg_count; i++) {
3059 VisitForStackValue(args->at(i)); 3062 VisitForStackValue(args->at(i));
3060 } 3063 }
3061 3064
3062 // Push a copy of the function (found below the arguments) and 3065 // Push a copy of the function (found below the arguments) and
3063 // resolve eval. 3066 // resolve eval.
3064 __ push(Operand(esp, (arg_count + 1) * kPointerSize)); 3067 __ push(Operand(esp, (arg_count + 1) * kPointerSize));
3065 EmitResolvePossiblyDirectEval(arg_count); 3068 EmitResolvePossiblyDirectEval(arg_count);
3066 3069
3067 // Touch up the stack with the resolved function. 3070 // The runtime call returns a pair of values in eax (function) and
3071 // edx (receiver). Touch up the stack with the right values.
3072 __ mov(Operand(esp, (arg_count + 0) * kPointerSize), edx);
3068 __ mov(Operand(esp, (arg_count + 1) * kPointerSize), eax); 3073 __ mov(Operand(esp, (arg_count + 1) * kPointerSize), eax);
3069 3074
3070 PrepareForBailoutForId(expr->EvalOrLookupId(), NO_REGISTERS); 3075 PrepareForBailoutForId(expr->EvalOrLookupId(), NO_REGISTERS);
3071 } 3076 }
3072 // Record source position for debugger. 3077 // Record source position for debugger.
3073 SetSourcePosition(expr->position()); 3078 SetSourcePosition(expr->position());
3074 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); 3079 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS);
3075 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); 3080 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize));
3076 __ CallStub(&stub); 3081 __ CallStub(&stub);
3077 RecordJSReturnSite(expr); 3082 RecordJSReturnSite(expr);
(...skipping 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after
4691 VariableProxy* proxy = expr->expression()->AsVariableProxy(); 4696 VariableProxy* proxy = expr->expression()->AsVariableProxy();
4692 4697
4693 if (property != NULL) { 4698 if (property != NULL) {
4694 VisitForStackValue(property->obj()); 4699 VisitForStackValue(property->obj());
4695 VisitForStackValue(property->key()); 4700 VisitForStackValue(property->key());
4696 __ push(Immediate(Smi::FromInt(language_mode()))); 4701 __ push(Immediate(Smi::FromInt(language_mode())));
4697 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); 4702 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION);
4698 context()->Plug(eax); 4703 context()->Plug(eax);
4699 } else if (proxy != NULL) { 4704 } else if (proxy != NULL) {
4700 Variable* var = proxy->var(); 4705 Variable* var = proxy->var();
4701 // Delete of an unqualified identifier is disallowed in strict mode but 4706 // Delete of an unqualified identifier is disallowed in strict mode
4702 // "delete this" is allowed. 4707 // but "delete this" is allowed.
4703 bool is_this = var->HasThisName(isolate()); 4708 DCHECK(is_sloppy(language_mode()) || var->is_this());
4704 DCHECK(is_sloppy(language_mode()) || is_this);
4705 if (var->IsUnallocated()) { 4709 if (var->IsUnallocated()) {
4706 __ push(GlobalObjectOperand()); 4710 __ push(GlobalObjectOperand());
4707 __ push(Immediate(var->name())); 4711 __ push(Immediate(var->name()));
4708 __ push(Immediate(Smi::FromInt(SLOPPY))); 4712 __ push(Immediate(Smi::FromInt(SLOPPY)));
4709 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); 4713 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION);
4710 context()->Plug(eax); 4714 context()->Plug(eax);
4711 } else if (var->IsStackAllocated() || var->IsContextSlot()) { 4715 } else if (var->IsStackAllocated() || var->IsContextSlot()) {
4712 // Result of deleting non-global variables is false. 'this' is 4716 // Result of deleting non-global variables is false. 'this' is
4713 // not really a variable, though we implement it as one. The 4717 // not really a variable, though we implement it as one. The
4714 // subexpression does not have side effects. 4718 // subexpression does not have side effects.
4715 context()->Plug(is_this); 4719 context()->Plug(var->is_this());
4716 } else { 4720 } else {
4717 // Non-global variable. Call the runtime to try to delete from the 4721 // Non-global variable. Call the runtime to try to delete from the
4718 // context where the variable was introduced. 4722 // context where the variable was introduced.
4719 __ push(context_register()); 4723 __ push(context_register());
4720 __ push(Immediate(var->name())); 4724 __ push(Immediate(var->name()));
4721 __ CallRuntime(Runtime::kDeleteLookupSlot, 2); 4725 __ CallRuntime(Runtime::kDeleteLookupSlot, 2);
4722 context()->Plug(eax); 4726 context()->Plug(eax);
4723 } 4727 }
4724 } else { 4728 } else {
4725 // Result of deleting non-property, non-variable reference is true. 4729 // Result of deleting non-property, non-variable reference is true.
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
5461 Assembler::target_address_at(call_target_address, 5465 Assembler::target_address_at(call_target_address,
5462 unoptimized_code)); 5466 unoptimized_code));
5463 return OSR_AFTER_STACK_CHECK; 5467 return OSR_AFTER_STACK_CHECK;
5464 } 5468 }
5465 5469
5466 5470
5467 } // namespace internal 5471 } // namespace internal
5468 } // namespace v8 5472 } // namespace v8
5469 5473
5470 #endif // V8_TARGET_ARCH_IA32 5474 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/mips/full-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698