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

Side by Side Diff: src/x87/full-codegen-x87.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/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 2975 matching lines...) Expand 10 before | Expand all | Expand 10 after
2986 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { 2986 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) {
2987 // Push copy of the first argument or undefined if it doesn't exist. 2987 // Push copy of the first argument or undefined if it doesn't exist.
2988 if (arg_count > 0) { 2988 if (arg_count > 0) {
2989 __ push(Operand(esp, arg_count * kPointerSize)); 2989 __ push(Operand(esp, arg_count * kPointerSize));
2990 } else { 2990 } else {
2991 __ push(Immediate(isolate()->factory()->undefined_value())); 2991 __ push(Immediate(isolate()->factory()->undefined_value()));
2992 } 2992 }
2993 2993
2994 // Push the enclosing function. 2994 // Push the enclosing function.
2995 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 2995 __ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
2996 2996 // Push the receiver of the enclosing function.
2997 Variable* this_var = scope()->LookupThis();
2998 DCHECK_NOT_NULL(this_var);
2999 __ push(VarOperand(this_var, ecx));
2997 // Push the language mode. 3000 // Push the language mode.
2998 __ push(Immediate(Smi::FromInt(language_mode()))); 3001 __ push(Immediate(Smi::FromInt(language_mode())));
2999 3002
3000 // Push the start position of the scope the calls resides in. 3003 // Push the start position of the scope the calls resides in.
3001 __ push(Immediate(Smi::FromInt(scope()->start_position()))); 3004 __ push(Immediate(Smi::FromInt(scope()->start_position())));
3002 3005
3003 // Do the runtime call. 3006 // Do the runtime call.
3004 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); 3007 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 6);
3005 } 3008 }
3006 3009
3007 3010
3008 void FullCodeGenerator::EmitInitializeThisAfterSuper( 3011 void FullCodeGenerator::EmitInitializeThisAfterSuper(
3009 SuperCallReference* super_call_ref, FeedbackVectorICSlot slot) { 3012 SuperCallReference* super_call_ref, FeedbackVectorICSlot slot) {
3010 Variable* this_var = super_call_ref->this_var()->var(); 3013 Variable* this_var = super_call_ref->this_var()->var();
3011 GetVar(ecx, this_var); 3014 GetVar(ecx, this_var);
3012 __ cmp(ecx, isolate()->factory()->the_hole_value()); 3015 __ cmp(ecx, isolate()->factory()->the_hole_value());
3013 Label uninitialized_this; 3016 Label uninitialized_this;
3014 __ j(equal, &uninitialized_this); 3017 __ j(equal, &uninitialized_this);
(...skipping 11 matching lines...) Expand all
3026 // through this function. Avoid early returns. 3029 // through this function. Avoid early returns.
3027 expr->return_is_recorded_ = false; 3030 expr->return_is_recorded_ = false;
3028 #endif 3031 #endif
3029 3032
3030 Comment cmnt(masm_, "[ Call"); 3033 Comment cmnt(masm_, "[ Call");
3031 Expression* callee = expr->expression(); 3034 Expression* callee = expr->expression();
3032 Call::CallType call_type = expr->GetCallType(isolate()); 3035 Call::CallType call_type = expr->GetCallType(isolate());
3033 3036
3034 if (call_type == Call::POSSIBLY_EVAL_CALL) { 3037 if (call_type == Call::POSSIBLY_EVAL_CALL) {
3035 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval 3038 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval
3036 // to resolve the function we need to call. Then we call the resolved 3039 // to resolve the function we need to call and the receiver of the call.
3037 // function using the given arguments. 3040 // Then we call the resolved function using the given arguments.
3038 ZoneList<Expression*>* args = expr->arguments(); 3041 ZoneList<Expression*>* args = expr->arguments();
3039 int arg_count = args->length(); 3042 int arg_count = args->length();
3040 { PreservePositionScope pos_scope(masm()->positions_recorder()); 3043 { PreservePositionScope pos_scope(masm()->positions_recorder());
3041 VisitForStackValue(callee); 3044 VisitForStackValue(callee);
3042 // Reserved receiver slot. 3045 // Reserved receiver slot.
3043 __ push(Immediate(isolate()->factory()->undefined_value())); 3046 __ push(Immediate(isolate()->factory()->undefined_value()));
3044 // Push the arguments. 3047 // Push the arguments.
3045 for (int i = 0; i < arg_count; i++) { 3048 for (int i = 0; i < arg_count; i++) {
3046 VisitForStackValue(args->at(i)); 3049 VisitForStackValue(args->at(i));
3047 } 3050 }
3048 3051
3049 // Push a copy of the function (found below the arguments) and 3052 // Push a copy of the function (found below the arguments) and
3050 // resolve eval. 3053 // resolve eval.
3051 __ push(Operand(esp, (arg_count + 1) * kPointerSize)); 3054 __ push(Operand(esp, (arg_count + 1) * kPointerSize));
3052 EmitResolvePossiblyDirectEval(arg_count); 3055 EmitResolvePossiblyDirectEval(arg_count);
3053 3056
3054 // Touch up the stack with the resolved function. 3057 // The runtime call returns a pair of values in eax (function) and
3058 // edx (receiver). Touch up the stack with the right values.
3059 __ mov(Operand(esp, (arg_count + 0) * kPointerSize), edx);
3055 __ mov(Operand(esp, (arg_count + 1) * kPointerSize), eax); 3060 __ mov(Operand(esp, (arg_count + 1) * kPointerSize), eax);
3056 3061
3057 PrepareForBailoutForId(expr->EvalOrLookupId(), NO_REGISTERS); 3062 PrepareForBailoutForId(expr->EvalOrLookupId(), NO_REGISTERS);
3058 } 3063 }
3059 // Record source position for debugger. 3064 // Record source position for debugger.
3060 SetSourcePosition(expr->position()); 3065 SetSourcePosition(expr->position());
3061 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); 3066 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS);
3062 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); 3067 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize));
3063 __ CallStub(&stub); 3068 __ CallStub(&stub);
3064 RecordJSReturnSite(expr); 3069 RecordJSReturnSite(expr);
(...skipping 1598 matching lines...) Expand 10 before | Expand all | Expand 10 after
4663 VariableProxy* proxy = expr->expression()->AsVariableProxy(); 4668 VariableProxy* proxy = expr->expression()->AsVariableProxy();
4664 4669
4665 if (property != NULL) { 4670 if (property != NULL) {
4666 VisitForStackValue(property->obj()); 4671 VisitForStackValue(property->obj());
4667 VisitForStackValue(property->key()); 4672 VisitForStackValue(property->key());
4668 __ push(Immediate(Smi::FromInt(language_mode()))); 4673 __ push(Immediate(Smi::FromInt(language_mode())));
4669 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); 4674 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION);
4670 context()->Plug(eax); 4675 context()->Plug(eax);
4671 } else if (proxy != NULL) { 4676 } else if (proxy != NULL) {
4672 Variable* var = proxy->var(); 4677 Variable* var = proxy->var();
4673 // Delete of an unqualified identifier is disallowed in strict mode but 4678 // Delete of an unqualified identifier is disallowed in strict mode
4674 // "delete this" is allowed. 4679 // but "delete this" is allowed.
4675 bool is_this = var->HasThisName(isolate()); 4680 DCHECK(is_sloppy(language_mode()) || var->is_this());
4676 DCHECK(is_sloppy(language_mode()) || is_this);
4677 if (var->IsUnallocated()) { 4681 if (var->IsUnallocated()) {
4678 __ push(GlobalObjectOperand()); 4682 __ push(GlobalObjectOperand());
4679 __ push(Immediate(var->name())); 4683 __ push(Immediate(var->name()));
4680 __ push(Immediate(Smi::FromInt(SLOPPY))); 4684 __ push(Immediate(Smi::FromInt(SLOPPY)));
4681 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); 4685 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION);
4682 context()->Plug(eax); 4686 context()->Plug(eax);
4683 } else if (var->IsStackAllocated() || var->IsContextSlot()) { 4687 } else if (var->IsStackAllocated() || var->IsContextSlot()) {
4684 // Result of deleting non-global variables is false. 'this' is 4688 // Result of deleting non-global variables is false. 'this' is
4685 // not really a variable, though we implement it as one. The 4689 // not really a variable, though we implement it as one. The
4686 // subexpression does not have side effects. 4690 // subexpression does not have side effects.
4687 context()->Plug(is_this); 4691 context()->Plug(var->is_this());
4688 } else { 4692 } else {
4689 // Non-global variable. Call the runtime to try to delete from the 4693 // Non-global variable. Call the runtime to try to delete from the
4690 // context where the variable was introduced. 4694 // context where the variable was introduced.
4691 __ push(context_register()); 4695 __ push(context_register());
4692 __ push(Immediate(var->name())); 4696 __ push(Immediate(var->name()));
4693 __ CallRuntime(Runtime::kDeleteLookupSlot, 2); 4697 __ CallRuntime(Runtime::kDeleteLookupSlot, 2);
4694 context()->Plug(eax); 4698 context()->Plug(eax);
4695 } 4699 }
4696 } else { 4700 } else {
4697 // Result of deleting non-property, non-variable reference is true. 4701 // Result of deleting non-property, non-variable reference is true.
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
5433 Assembler::target_address_at(call_target_address, 5437 Assembler::target_address_at(call_target_address,
5434 unoptimized_code)); 5438 unoptimized_code));
5435 return OSR_AFTER_STACK_CHECK; 5439 return OSR_AFTER_STACK_CHECK;
5436 } 5440 }
5437 5441
5438 5442
5439 } // namespace internal 5443 } // namespace internal
5440 } // namespace v8 5444 } // namespace v8
5441 5445
5442 #endif // V8_TARGET_ARCH_X87 5446 #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