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

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

Issue 918603004: new classes: implement correct check for uninitialized this in 'super()' (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix Created 5 years, 10 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/arm/full-codegen-arm.cc ('k') | src/ia32/full-codegen-ia32.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_ARM64 7 #if V8_TARGET_ARCH_ARM64
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 2938 matching lines...) Expand 10 before | Expand all | Expand 10 after
2949 context()->Plug(x0); 2949 context()->Plug(x0);
2950 } 2950 }
2951 2951
2952 2952
2953 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { 2953 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) {
2954 Comment cmnt(masm_, "[ SuperConstructorCall"); 2954 Comment cmnt(masm_, "[ SuperConstructorCall");
2955 Variable* new_target_var = scope()->DeclarationScope()->new_target_var(); 2955 Variable* new_target_var = scope()->DeclarationScope()->new_target_var();
2956 GetVar(result_register(), new_target_var); 2956 GetVar(result_register(), new_target_var);
2957 __ Push(result_register()); 2957 __ Push(result_register());
2958 2958
2959 SuperReference* super_ref = expr->expression()->AsSuperReference();
2960 EmitLoadSuperConstructor(); 2959 EmitLoadSuperConstructor();
2961 __ push(result_register()); 2960 __ push(result_register());
2962 2961
2963 Variable* this_var = super_ref->this_var()->var();
2964
2965 GetVar(x0, this_var);
2966 Label uninitialized_this;
2967 __ JumpIfRoot(x0, Heap::kTheHoleValueRootIndex, &uninitialized_this);
2968 __ Mov(x0, Operand(this_var->name()));
2969 __ Push(x0);
2970 __ CallRuntime(Runtime::kThrowReferenceError, 1);
2971 __ bind(&uninitialized_this);
2972
2973 // Push the arguments ("left-to-right") on the stack. 2962 // Push the arguments ("left-to-right") on the stack.
2974 ZoneList<Expression*>* args = expr->arguments(); 2963 ZoneList<Expression*>* args = expr->arguments();
2975 int arg_count = args->length(); 2964 int arg_count = args->length();
2976 for (int i = 0; i < arg_count; i++) { 2965 for (int i = 0; i < arg_count; i++) {
2977 VisitForStackValue(args->at(i)); 2966 VisitForStackValue(args->at(i));
2978 } 2967 }
2979 2968
2980 // Call the construct call builtin that handles allocation and 2969 // Call the construct call builtin that handles allocation and
2981 // constructor invocation. 2970 // constructor invocation.
2982 SetSourcePosition(expr->position()); 2971 SetSourcePosition(expr->position());
(...skipping 15 matching lines...) Expand all
2998 __ LoadObject(x2, FeedbackVector()); 2987 __ LoadObject(x2, FeedbackVector());
2999 __ Mov(x3, SmiFromSlot(expr->CallFeedbackSlot())); 2988 __ Mov(x3, SmiFromSlot(expr->CallFeedbackSlot()));
3000 2989
3001 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET); 2990 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET);
3002 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); 2991 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
3003 2992
3004 __ Drop(1); 2993 __ Drop(1);
3005 2994
3006 RecordJSReturnSite(expr); 2995 RecordJSReturnSite(expr);
3007 2996
2997 SuperReference* super_ref = expr->expression()->AsSuperReference();
2998 Variable* this_var = super_ref->this_var()->var();
2999 GetVar(x1, this_var);
3000 Label uninitialized_this;
3001 __ JumpIfRoot(x1, Heap::kTheHoleValueRootIndex, &uninitialized_this);
3002 __ Mov(x0, Operand(this_var->name()));
3003 __ Push(x0);
3004 __ CallRuntime(Runtime::kThrowReferenceError, 1);
3005 __ bind(&uninitialized_this);
3006
3008 EmitVariableAssignment(this_var, Token::INIT_CONST); 3007 EmitVariableAssignment(this_var, Token::INIT_CONST);
3009 context()->Plug(x0); 3008 context()->Plug(x0);
3010 } 3009 }
3011 3010
3012 3011
3013 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { 3012 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
3014 ZoneList<Expression*>* args = expr->arguments(); 3013 ZoneList<Expression*>* args = expr->arguments();
3015 DCHECK(args->length() == 1); 3014 DCHECK(args->length() == 1);
3016 3015
3017 VisitForAccumulatorValue(args->at(0)); 3016 VisitForAccumulatorValue(args->at(0));
(...skipping 2452 matching lines...) Expand 10 before | Expand all | Expand 10 after
5470 return previous_; 5469 return previous_;
5471 } 5470 }
5472 5471
5473 5472
5474 #undef __ 5473 #undef __
5475 5474
5476 5475
5477 } } // namespace v8::internal 5476 } } // namespace v8::internal
5478 5477
5479 #endif // V8_TARGET_ARCH_ARM64 5478 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698