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

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

Issue 867153003: new classes: special construct stub for derived classs and TDZ for `this`. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: CHECK_OK fixed 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/arm64/builtins-arm64.cc ('k') | src/ast.h » ('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 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after
1511 // if (false) { const x; }; var y = x; 1511 // if (false) { const x; }; var y = x;
1512 // 1512 //
1513 // The condition on the declaration scopes is a conservative check for 1513 // The condition on the declaration scopes is a conservative check for
1514 // nested functions that access a binding and are called before the 1514 // nested functions that access a binding and are called before the
1515 // binding is initialized: 1515 // binding is initialized:
1516 // function() { f(); let x = 1; function f() { x = 2; } } 1516 // function() { f(); let x = 1; function f() { x = 2; } }
1517 // 1517 //
1518 bool skip_init_check; 1518 bool skip_init_check;
1519 if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) { 1519 if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) {
1520 skip_init_check = false; 1520 skip_init_check = false;
1521 } else if (var->is_this()) {
1522 CHECK((info_->shared_info()->kind() & kSubclassConstructor) != 0);
1523 // TODO(dslomov): implement 'this' hole check elimination.
1524 skip_init_check = false;
1521 } else { 1525 } else {
1522 // Check that we always have valid source position. 1526 // Check that we always have valid source position.
1523 DCHECK(var->initializer_position() != RelocInfo::kNoPosition); 1527 DCHECK(var->initializer_position() != RelocInfo::kNoPosition);
1524 DCHECK(proxy->position() != RelocInfo::kNoPosition); 1528 DCHECK(proxy->position() != RelocInfo::kNoPosition);
1525 skip_init_check = var->mode() != CONST_LEGACY && 1529 skip_init_check = var->mode() != CONST_LEGACY &&
1526 var->initializer_position() < proxy->position(); 1530 var->initializer_position() < proxy->position();
1527 } 1531 }
1528 1532
1529 if (!skip_init_check) { 1533 if (!skip_init_check) {
1530 // Let and const need a read barrier. 1534 // Let and const need a read barrier.
(...skipping 1400 matching lines...) Expand 10 before | Expand all | Expand 10 after
2931 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); 2935 PrepareForBailoutForId(expr->ReturnId(), TOS_REG);
2932 context()->Plug(x0); 2936 context()->Plug(x0);
2933 } 2937 }
2934 2938
2935 2939
2936 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { 2940 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) {
2937 SuperReference* super_ref = expr->expression()->AsSuperReference(); 2941 SuperReference* super_ref = expr->expression()->AsSuperReference();
2938 EmitLoadSuperConstructor(super_ref); 2942 EmitLoadSuperConstructor(super_ref);
2939 __ push(result_register()); 2943 __ push(result_register());
2940 2944
2945 Variable* this_var = super_ref->this_var()->var();
2946
2947 GetVar(x0, this_var);
2948 Label uninitialized_this;
2949 __ JumpIfRoot(x0, Heap::kTheHoleValueRootIndex, &uninitialized_this);
2950 __ Mov(x0, Operand(this_var->name()));
2951 __ Push(x0);
2952 __ CallRuntime(Runtime::kThrowReferenceError, 1);
2953 __ bind(&uninitialized_this);
2954
2941 // Push the arguments ("left-to-right") on the stack. 2955 // Push the arguments ("left-to-right") on the stack.
2942 ZoneList<Expression*>* args = expr->arguments(); 2956 ZoneList<Expression*>* args = expr->arguments();
2943 int arg_count = args->length(); 2957 int arg_count = args->length();
2944 for (int i = 0; i < arg_count; i++) { 2958 for (int i = 0; i < arg_count; i++) {
2945 VisitForStackValue(args->at(i)); 2959 VisitForStackValue(args->at(i));
2946 } 2960 }
2947 2961
2948 // Call the construct call builtin that handles allocation and 2962 // Call the construct call builtin that handles allocation and
2949 // constructor invocation. 2963 // constructor invocation.
2950 SetSourcePosition(expr->position()); 2964 SetSourcePosition(expr->position());
(...skipping 14 matching lines...) Expand all
2965 2979
2966 __ LoadObject(x2, FeedbackVector()); 2980 __ LoadObject(x2, FeedbackVector());
2967 __ Mov(x3, SmiFromSlot(expr->CallFeedbackSlot())); 2981 __ Mov(x3, SmiFromSlot(expr->CallFeedbackSlot()));
2968 2982
2969 // TODO(dslomov): use a different stub and propagate new.target. 2983 // TODO(dslomov): use a different stub and propagate new.target.
2970 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); 2984 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET);
2971 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); 2985 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
2972 2986
2973 RecordJSReturnSite(expr); 2987 RecordJSReturnSite(expr);
2974 2988
2975 // TODO(dslomov): implement TDZ for `this`. 2989 EmitVariableAssignment(this_var, Token::INIT_CONST);
2976 EmitVariableAssignment(super_ref->this_var()->var(), Token::ASSIGN);
2977 context()->Plug(x0); 2990 context()->Plug(x0);
2978 } 2991 }
2979 2992
2980 2993
2981 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { 2994 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
2982 ZoneList<Expression*>* args = expr->arguments(); 2995 ZoneList<Expression*>* args = expr->arguments();
2983 DCHECK(args->length() == 1); 2996 DCHECK(args->length() == 1);
2984 2997
2985 VisitForAccumulatorValue(args->at(0)); 2998 VisitForAccumulatorValue(args->at(0));
2986 2999
(...skipping 2398 matching lines...) Expand 10 before | Expand all | Expand 10 after
5385 return previous_; 5398 return previous_;
5386 } 5399 }
5387 5400
5388 5401
5389 #undef __ 5402 #undef __
5390 5403
5391 5404
5392 } } // namespace v8::internal 5405 } } // namespace v8::internal
5393 5406
5394 #endif // V8_TARGET_ARCH_ARM64 5407 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm64/builtins-arm64.cc ('k') | src/ast.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698