OLD | NEW |
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_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
8 | 8 |
9 // Note on Mips implementation: | 9 // Note on Mips implementation: |
10 // | 10 // |
(...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 1682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3213 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | 3217 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
3214 context()->Plug(v0); | 3218 context()->Plug(v0); |
3215 } | 3219 } |
3216 | 3220 |
3217 | 3221 |
3218 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { | 3222 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { |
3219 SuperReference* super_ref = expr->expression()->AsSuperReference(); | 3223 SuperReference* super_ref = expr->expression()->AsSuperReference(); |
3220 EmitLoadSuperConstructor(super_ref); | 3224 EmitLoadSuperConstructor(super_ref); |
3221 __ push(result_register()); | 3225 __ push(result_register()); |
3222 | 3226 |
| 3227 Variable* this_var = super_ref->this_var()->var(); |
| 3228 |
| 3229 GetVar(a0, this_var); |
| 3230 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
| 3231 Label uninitialized_this; |
| 3232 __ Branch(&uninitialized_this, eq, a0, Operand(at)); |
| 3233 __ li(a0, Operand(this_var->name())); |
| 3234 __ Push(a0); |
| 3235 __ CallRuntime(Runtime::kThrowReferenceError, 1); |
| 3236 __ bind(&uninitialized_this); |
| 3237 |
3223 // Push the arguments ("left-to-right") on the stack. | 3238 // Push the arguments ("left-to-right") on the stack. |
3224 ZoneList<Expression*>* args = expr->arguments(); | 3239 ZoneList<Expression*>* args = expr->arguments(); |
3225 int arg_count = args->length(); | 3240 int arg_count = args->length(); |
3226 for (int i = 0; i < arg_count; i++) { | 3241 for (int i = 0; i < arg_count; i++) { |
3227 VisitForStackValue(args->at(i)); | 3242 VisitForStackValue(args->at(i)); |
3228 } | 3243 } |
3229 | 3244 |
3230 // Call the construct call builtin that handles allocation and | 3245 // Call the construct call builtin that handles allocation and |
3231 // constructor invocation. | 3246 // constructor invocation. |
3232 SetSourcePosition(expr->position()); | 3247 SetSourcePosition(expr->position()); |
(...skipping 14 matching lines...) Expand all Loading... |
3247 | 3262 |
3248 __ li(a2, FeedbackVector()); | 3263 __ li(a2, FeedbackVector()); |
3249 __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackSlot()))); | 3264 __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackSlot()))); |
3250 | 3265 |
3251 // TODO(dslomov): use a different stub and propagate new.target. | 3266 // TODO(dslomov): use a different stub and propagate new.target. |
3252 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); | 3267 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); |
3253 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 3268 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
3254 | 3269 |
3255 RecordJSReturnSite(expr); | 3270 RecordJSReturnSite(expr); |
3256 | 3271 |
3257 // TODO(dslomov): implement TDZ for `this`. | 3272 EmitVariableAssignment(this_var, Token::INIT_CONST); |
3258 EmitVariableAssignment(super_ref->this_var()->var(), Token::ASSIGN); | |
3259 context()->Plug(v0); | 3273 context()->Plug(v0); |
3260 } | 3274 } |
3261 | 3275 |
3262 | 3276 |
3263 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { | 3277 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { |
3264 ZoneList<Expression*>* args = expr->arguments(); | 3278 ZoneList<Expression*>* args = expr->arguments(); |
3265 DCHECK(args->length() == 1); | 3279 DCHECK(args->length() == 1); |
3266 | 3280 |
3267 VisitForAccumulatorValue(args->at(0)); | 3281 VisitForAccumulatorValue(args->at(0)); |
3268 | 3282 |
(...skipping 2078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5347 Assembler::target_address_at(pc_immediate_load_address)) == | 5361 Assembler::target_address_at(pc_immediate_load_address)) == |
5348 reinterpret_cast<uint64_t>( | 5362 reinterpret_cast<uint64_t>( |
5349 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5363 isolate->builtins()->OsrAfterStackCheck()->entry())); |
5350 return OSR_AFTER_STACK_CHECK; | 5364 return OSR_AFTER_STACK_CHECK; |
5351 } | 5365 } |
5352 | 5366 |
5353 | 5367 |
5354 } } // namespace v8::internal | 5368 } } // namespace v8::internal |
5355 | 5369 |
5356 #endif // V8_TARGET_ARCH_MIPS64 | 5370 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |