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-numbering.h" | 7 #include "src/ast/ast-numbering.h" |
8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/ast/prettyprinter.h" | 9 #include "src/ast/prettyprinter.h" |
10 #include "src/ast/scopes.h" | 10 #include "src/ast/scopes.h" |
(...skipping 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1544 Compiler::GetSharedFunctionInfo(expr, script(), info_); | 1544 Compiler::GetSharedFunctionInfo(expr, script(), info_); |
1545 if (function_info.is_null()) { | 1545 if (function_info.is_null()) { |
1546 SetStackOverflow(); | 1546 SetStackOverflow(); |
1547 return; | 1547 return; |
1548 } | 1548 } |
1549 EmitNewClosure(function_info, expr->pretenure()); | 1549 EmitNewClosure(function_info, expr->pretenure()); |
1550 } | 1550 } |
1551 | 1551 |
1552 | 1552 |
1553 void FullCodeGenerator::VisitClassLiteral(ClassLiteral* lit) { | 1553 void FullCodeGenerator::VisitClassLiteral(ClassLiteral* lit) { |
1554 Comment cmnt(masm_, "[ ClassLiteral"); | 1554 // Unsupported |
1555 | 1555 UNREACHABLE(); |
1556 if (lit->extends() != NULL) { | |
1557 VisitForStackValue(lit->extends()); | |
1558 } else { | |
1559 PushOperand(isolate()->factory()->the_hole_value()); | |
1560 } | |
1561 | |
1562 VisitForStackValue(lit->constructor()); | |
1563 | |
1564 PushOperand(Smi::FromInt(lit->start_position())); | |
1565 PushOperand(Smi::FromInt(lit->end_position())); | |
1566 | |
1567 CallRuntimeWithOperands(Runtime::kDefineClass); | |
1568 PrepareForBailoutForId(lit->CreateLiteralId(), BailoutState::TOS_REGISTER); | |
1569 PushOperand(result_register()); | |
1570 | |
1571 // Load the "prototype" from the constructor. | |
1572 __ Move(LoadDescriptor::ReceiverRegister(), result_register()); | |
1573 CallLoadIC(lit->PrototypeSlot(), isolate()->factory()->prototype_string()); | |
1574 PrepareForBailoutForId(lit->PrototypeId(), BailoutState::TOS_REGISTER); | |
1575 PushOperand(result_register()); | |
1576 | |
1577 EmitClassDefineProperties(lit); | |
1578 DropOperands(1); | |
1579 | |
1580 // Set the constructor to have fast properties. | |
1581 CallRuntimeWithOperands(Runtime::kToFastProperties); | |
1582 | |
1583 if (lit->class_variable_proxy() != nullptr) { | |
1584 EmitVariableAssignment(lit->class_variable_proxy()->var(), Token::INIT, | |
1585 lit->ProxySlot(), HoleCheckMode::kElided); | |
1586 } | |
1587 | |
1588 context()->Plug(result_register()); | |
1589 } | 1556 } |
1590 | 1557 |
1591 void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { | 1558 void FullCodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) { |
1592 Comment cmnt(masm_, "[ RegExpLiteral"); | 1559 Comment cmnt(masm_, "[ RegExpLiteral"); |
1593 Callable callable = CodeFactory::FastCloneRegExp(isolate()); | 1560 Callable callable = CodeFactory::FastCloneRegExp(isolate()); |
1594 CallInterfaceDescriptor descriptor = callable.descriptor(); | 1561 CallInterfaceDescriptor descriptor = callable.descriptor(); |
1595 LoadFromFrameField(JavaScriptFrameConstants::kFunctionOffset, | 1562 LoadFromFrameField(JavaScriptFrameConstants::kFunctionOffset, |
1596 descriptor.GetRegisterParameter(0)); | 1563 descriptor.GetRegisterParameter(0)); |
1597 __ Move(descriptor.GetRegisterParameter(1), | 1564 __ Move(descriptor.GetRegisterParameter(1), |
1598 Smi::FromInt(expr->literal_index())); | 1565 Smi::FromInt(expr->literal_index())); |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1989 return info_->has_simple_parameters(); | 1956 return info_->has_simple_parameters(); |
1990 } | 1957 } |
1991 | 1958 |
1992 FunctionLiteral* FullCodeGenerator::literal() const { return info_->literal(); } | 1959 FunctionLiteral* FullCodeGenerator::literal() const { return info_->literal(); } |
1993 | 1960 |
1994 #undef __ | 1961 #undef __ |
1995 | 1962 |
1996 | 1963 |
1997 } // namespace internal | 1964 } // namespace internal |
1998 } // namespace v8 | 1965 } // namespace v8 |
OLD | NEW |