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

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

Issue 902423002: X87: 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: 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/x87/builtins-x87.cc ('k') | no next file » | 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 1432 matching lines...) Expand 10 before | Expand all | Expand 10 after
1443 // if (false) { const x; }; var y = x; 1443 // if (false) { const x; }; var y = x;
1444 // 1444 //
1445 // The condition on the declaration scopes is a conservative check for 1445 // The condition on the declaration scopes is a conservative check for
1446 // nested functions that access a binding and are called before the 1446 // nested functions that access a binding and are called before the
1447 // binding is initialized: 1447 // binding is initialized:
1448 // function() { f(); let x = 1; function f() { x = 2; } } 1448 // function() { f(); let x = 1; function f() { x = 2; } }
1449 // 1449 //
1450 bool skip_init_check; 1450 bool skip_init_check;
1451 if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) { 1451 if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) {
1452 skip_init_check = false; 1452 skip_init_check = false;
1453 } else if (var->is_this()) {
1454 CHECK((info_->shared_info()->kind() & kSubclassConstructor) != 0);
1455 // TODO(dslomov): implement 'this' hole check elimination.
1456 skip_init_check = false;
1453 } else { 1457 } else {
1454 // Check that we always have valid source position. 1458 // Check that we always have valid source position.
1455 DCHECK(var->initializer_position() != RelocInfo::kNoPosition); 1459 DCHECK(var->initializer_position() != RelocInfo::kNoPosition);
1456 DCHECK(proxy->position() != RelocInfo::kNoPosition); 1460 DCHECK(proxy->position() != RelocInfo::kNoPosition);
1457 skip_init_check = var->mode() != CONST_LEGACY && 1461 skip_init_check = var->mode() != CONST_LEGACY &&
1458 var->initializer_position() < proxy->position(); 1462 var->initializer_position() < proxy->position();
1459 } 1463 }
1460 1464
1461 if (!skip_init_check) { 1465 if (!skip_init_check) {
1462 // Let and const need a read barrier. 1466 // Let and const need a read barrier.
(...skipping 1658 matching lines...) Expand 10 before | Expand all | Expand 10 after
3121 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); 3125 PrepareForBailoutForId(expr->ReturnId(), TOS_REG);
3122 context()->Plug(eax); 3126 context()->Plug(eax);
3123 } 3127 }
3124 3128
3125 3129
3126 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { 3130 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) {
3127 SuperReference* super_ref = expr->expression()->AsSuperReference(); 3131 SuperReference* super_ref = expr->expression()->AsSuperReference();
3128 EmitLoadSuperConstructor(super_ref); 3132 EmitLoadSuperConstructor(super_ref);
3129 __ push(result_register()); 3133 __ push(result_register());
3130 3134
3135 Variable* this_var = super_ref->this_var()->var();
3136 GetVar(eax, this_var);
3137 __ cmp(eax, isolate()->factory()->the_hole_value());
3138 Label uninitialized_this;
3139 __ j(equal, &uninitialized_this);
3140 __ push(Immediate(this_var->name()));
3141 __ CallRuntime(Runtime::kThrowReferenceError, 1);
3142 __ bind(&uninitialized_this);
3143
3131 // Push the arguments ("left-to-right") on the stack. 3144 // Push the arguments ("left-to-right") on the stack.
3132 ZoneList<Expression*>* args = expr->arguments(); 3145 ZoneList<Expression*>* args = expr->arguments();
3133 int arg_count = args->length(); 3146 int arg_count = args->length();
3134 for (int i = 0; i < arg_count; i++) { 3147 for (int i = 0; i < arg_count; i++) {
3135 VisitForStackValue(args->at(i)); 3148 VisitForStackValue(args->at(i));
3136 } 3149 }
3137 3150
3138 // Call the construct call builtin that handles allocation and 3151 // Call the construct call builtin that handles allocation and
3139 // constructor invocation. 3152 // constructor invocation.
3140 SetSourcePosition(expr->position()); 3153 SetSourcePosition(expr->position());
(...skipping 14 matching lines...) Expand all
3155 3168
3156 __ LoadHeapObject(ebx, FeedbackVector()); 3169 __ LoadHeapObject(ebx, FeedbackVector());
3157 __ mov(edx, Immediate(SmiFromSlot(expr->CallFeedbackSlot()))); 3170 __ mov(edx, Immediate(SmiFromSlot(expr->CallFeedbackSlot())));
3158 3171
3159 // TODO(dslomov): use a different stub and propagate new.target. 3172 // TODO(dslomov): use a different stub and propagate new.target.
3160 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); 3173 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET);
3161 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); 3174 __ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
3162 3175
3163 RecordJSReturnSite(expr); 3176 RecordJSReturnSite(expr);
3164 3177
3165 // TODO(dslomov): implement TDZ for `this`. 3178 EmitVariableAssignment(this_var, Token::INIT_CONST);
3166 EmitVariableAssignment(super_ref->this_var()->var(), Token::ASSIGN);
3167 context()->Plug(eax); 3179 context()->Plug(eax);
3168 } 3180 }
3169 3181
3170 3182
3171 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { 3183 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
3172 ZoneList<Expression*>* args = expr->arguments(); 3184 ZoneList<Expression*>* args = expr->arguments();
3173 DCHECK(args->length() == 1); 3185 DCHECK(args->length() == 1);
3174 3186
3175 VisitForAccumulatorValue(args->at(0)); 3187 VisitForAccumulatorValue(args->at(0));
3176 3188
(...skipping 2093 matching lines...) Expand 10 before | Expand all | Expand 10 after
5270 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 5282 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
5271 Assembler::target_address_at(call_target_address, 5283 Assembler::target_address_at(call_target_address,
5272 unoptimized_code)); 5284 unoptimized_code));
5273 return OSR_AFTER_STACK_CHECK; 5285 return OSR_AFTER_STACK_CHECK;
5274 } 5286 }
5275 5287
5276 5288
5277 } } // namespace v8::internal 5289 } } // namespace v8::internal
5278 5290
5279 #endif // V8_TARGET_ARCH_X87 5291 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x87/builtins-x87.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698