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

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

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