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/full-codegen/full-codegen.h" | 5 #include "src/full-codegen/full-codegen.h" |
6 | 6 |
7 #include "src/ast/ast.h" | 7 #include "src/ast/ast.h" |
8 #include "src/ast/ast-numbering.h" | 8 #include "src/ast/ast-numbering.h" |
9 #include "src/ast/prettyprinter.h" | 9 #include "src/ast/prettyprinter.h" |
10 #include "src/ast/scopeinfo.h" | 10 #include "src/ast/scopeinfo.h" |
(...skipping 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1359 __ Push(isolate()->factory()->the_hole_value()); | 1359 __ Push(isolate()->factory()->the_hole_value()); |
1360 } | 1360 } |
1361 | 1361 |
1362 VisitForStackValue(lit->constructor()); | 1362 VisitForStackValue(lit->constructor()); |
1363 | 1363 |
1364 __ Push(Smi::FromInt(lit->start_position())); | 1364 __ Push(Smi::FromInt(lit->start_position())); |
1365 __ Push(Smi::FromInt(lit->end_position())); | 1365 __ Push(Smi::FromInt(lit->end_position())); |
1366 | 1366 |
1367 __ CallRuntime(Runtime::kDefineClass); | 1367 __ CallRuntime(Runtime::kDefineClass); |
1368 PrepareForBailoutForId(lit->CreateLiteralId(), TOS_REG); | 1368 PrepareForBailoutForId(lit->CreateLiteralId(), TOS_REG); |
| 1369 __ Push(result_register()); |
| 1370 |
| 1371 // Load the "prototype" from the constructor. |
| 1372 __ Move(LoadDescriptor::ReceiverRegister(), result_register()); |
| 1373 __ LoadRoot(LoadDescriptor::NameRegister(), |
| 1374 Heap::kprototype_stringRootIndex); |
| 1375 __ Move(LoadDescriptor::SlotRegister(), SmiFromSlot(lit->PrototypeSlot())); |
| 1376 CallLoadIC(NOT_INSIDE_TYPEOF); |
| 1377 PrepareForBailoutForId(lit->PrototypeId(), TOS_REG); |
| 1378 __ Push(result_register()); |
1369 | 1379 |
1370 EmitClassDefineProperties(lit); | 1380 EmitClassDefineProperties(lit); |
1371 | 1381 |
| 1382 // Set both the prototype and constructor to have fast properties, and also |
| 1383 // freeze them in strong mode. |
| 1384 __ CallRuntime(Runtime::kFinalizeClassDefinition); |
| 1385 |
1372 if (lit->class_variable_proxy() != nullptr) { | 1386 if (lit->class_variable_proxy() != nullptr) { |
1373 EmitVariableAssignment(lit->class_variable_proxy()->var(), Token::INIT, | 1387 EmitVariableAssignment(lit->class_variable_proxy()->var(), Token::INIT, |
1374 lit->ProxySlot()); | 1388 lit->ProxySlot()); |
1375 } | 1389 } |
1376 } | 1390 } |
1377 | 1391 |
1378 context()->Plug(result_register()); | 1392 context()->Plug(result_register()); |
1379 } | 1393 } |
1380 | 1394 |
1381 | 1395 |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1780 return var->mode() == CONST_LEGACY || var->scope()->is_nonlinear() || | 1794 return var->mode() == CONST_LEGACY || var->scope()->is_nonlinear() || |
1781 var->initializer_position() >= proxy->position(); | 1795 var->initializer_position() >= proxy->position(); |
1782 } | 1796 } |
1783 | 1797 |
1784 | 1798 |
1785 #undef __ | 1799 #undef __ |
1786 | 1800 |
1787 | 1801 |
1788 } // namespace internal | 1802 } // namespace internal |
1789 } // namespace v8 | 1803 } // namespace v8 |
OLD | NEW |