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_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
8 | 8 |
9 // Note on Mips implementation: | 9 // Note on Mips implementation: |
10 // | 10 // |
(...skipping 1503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1514 // if (false) { const x; }; var y = x; | 1514 // if (false) { const x; }; var y = x; |
1515 // | 1515 // |
1516 // The condition on the declaration scopes is a conservative check for | 1516 // The condition on the declaration scopes is a conservative check for |
1517 // nested functions that access a binding and are called before the | 1517 // nested functions that access a binding and are called before the |
1518 // binding is initialized: | 1518 // binding is initialized: |
1519 // function() { f(); let x = 1; function f() { x = 2; } } | 1519 // function() { f(); let x = 1; function f() { x = 2; } } |
1520 // | 1520 // |
1521 bool skip_init_check; | 1521 bool skip_init_check; |
1522 if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) { | 1522 if (var->scope()->DeclarationScope() != scope()->DeclarationScope()) { |
1523 skip_init_check = false; | 1523 skip_init_check = false; |
| 1524 } else if (var->is_this()) { |
| 1525 CHECK((info_->shared_info()->kind() & kSubclassConstructor) != 0); |
| 1526 // TODO(dslomov): implement 'this' hole check elimination. |
| 1527 skip_init_check = false; |
1524 } else { | 1528 } else { |
1525 // Check that we always have valid source position. | 1529 // Check that we always have valid source position. |
1526 DCHECK(var->initializer_position() != RelocInfo::kNoPosition); | 1530 DCHECK(var->initializer_position() != RelocInfo::kNoPosition); |
1527 DCHECK(proxy->position() != RelocInfo::kNoPosition); | 1531 DCHECK(proxy->position() != RelocInfo::kNoPosition); |
1528 skip_init_check = var->mode() != CONST_LEGACY && | 1532 skip_init_check = var->mode() != CONST_LEGACY && |
1529 var->initializer_position() < proxy->position(); | 1533 var->initializer_position() < proxy->position(); |
1530 } | 1534 } |
1531 | 1535 |
1532 if (!skip_init_check) { | 1536 if (!skip_init_check) { |
1533 // Let and const need a read barrier. | 1537 // Let and const need a read barrier. |
(...skipping 1681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3215 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | 3219 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
3216 context()->Plug(v0); | 3220 context()->Plug(v0); |
3217 } | 3221 } |
3218 | 3222 |
3219 | 3223 |
3220 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { | 3224 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { |
3221 SuperReference* super_ref = expr->expression()->AsSuperReference(); | 3225 SuperReference* super_ref = expr->expression()->AsSuperReference(); |
3222 EmitLoadSuperConstructor(super_ref); | 3226 EmitLoadSuperConstructor(super_ref); |
3223 __ push(result_register()); | 3227 __ push(result_register()); |
3224 | 3228 |
| 3229 Variable* this_var = super_ref->this_var()->var(); |
| 3230 |
| 3231 GetVar(a0, this_var); |
| 3232 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
| 3233 Label uninitialized_this; |
| 3234 __ Branch(&uninitialized_this, eq, a0, Operand(at)); |
| 3235 __ li(a0, Operand(this_var->name())); |
| 3236 __ Push(a0); |
| 3237 __ CallRuntime(Runtime::kThrowReferenceError, 1); |
| 3238 __ bind(&uninitialized_this); |
| 3239 |
3225 // Push the arguments ("left-to-right") on the stack. | 3240 // Push the arguments ("left-to-right") on the stack. |
3226 ZoneList<Expression*>* args = expr->arguments(); | 3241 ZoneList<Expression*>* args = expr->arguments(); |
3227 int arg_count = args->length(); | 3242 int arg_count = args->length(); |
3228 for (int i = 0; i < arg_count; i++) { | 3243 for (int i = 0; i < arg_count; i++) { |
3229 VisitForStackValue(args->at(i)); | 3244 VisitForStackValue(args->at(i)); |
3230 } | 3245 } |
3231 | 3246 |
3232 // Call the construct call builtin that handles allocation and | 3247 // Call the construct call builtin that handles allocation and |
3233 // constructor invocation. | 3248 // constructor invocation. |
3234 SetSourcePosition(expr->position()); | 3249 SetSourcePosition(expr->position()); |
(...skipping 14 matching lines...) Expand all Loading... |
3249 | 3264 |
3250 __ li(a2, FeedbackVector()); | 3265 __ li(a2, FeedbackVector()); |
3251 __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackSlot()))); | 3266 __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackSlot()))); |
3252 | 3267 |
3253 // TODO(dslomov): use a different stub and propagate new.target. | 3268 // TODO(dslomov): use a different stub and propagate new.target. |
3254 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); | 3269 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); |
3255 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 3270 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
3256 | 3271 |
3257 RecordJSReturnSite(expr); | 3272 RecordJSReturnSite(expr); |
3258 | 3273 |
3259 // TODO(dslomov): implement TDZ for `this`. | 3274 EmitVariableAssignment(this_var, Token::INIT_CONST); |
3260 EmitVariableAssignment(super_ref->this_var()->var(), Token::ASSIGN); | |
3261 context()->Plug(v0); | 3275 context()->Plug(v0); |
3262 } | 3276 } |
3263 | 3277 |
3264 | 3278 |
3265 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { | 3279 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { |
3266 ZoneList<Expression*>* args = expr->arguments(); | 3280 ZoneList<Expression*>* args = expr->arguments(); |
3267 DCHECK(args->length() == 1); | 3281 DCHECK(args->length() == 1); |
3268 | 3282 |
3269 VisitForAccumulatorValue(args->at(0)); | 3283 VisitForAccumulatorValue(args->at(0)); |
3270 | 3284 |
(...skipping 2072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5343 Assembler::target_address_at(pc_immediate_load_address)) == | 5357 Assembler::target_address_at(pc_immediate_load_address)) == |
5344 reinterpret_cast<uint32_t>( | 5358 reinterpret_cast<uint32_t>( |
5345 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5359 isolate->builtins()->OsrAfterStackCheck()->entry())); |
5346 return OSR_AFTER_STACK_CHECK; | 5360 return OSR_AFTER_STACK_CHECK; |
5347 } | 5361 } |
5348 | 5362 |
5349 | 5363 |
5350 } } // namespace v8::internal | 5364 } } // namespace v8::internal |
5351 | 5365 |
5352 #endif // V8_TARGET_ARCH_MIPS | 5366 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |