Chromium Code Reviews| 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 #include "src/ast.h" | 7 #include "src/ast.h" |
| 8 #include "src/ast-numbering.h" | 8 #include "src/ast-numbering.h" |
| 9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 1587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1598 SetStackOverflow(); | 1598 SetStackOverflow(); |
| 1599 return; | 1599 return; |
| 1600 } | 1600 } |
| 1601 EmitNewClosure(function_info, expr->pretenure()); | 1601 EmitNewClosure(function_info, expr->pretenure()); |
| 1602 } | 1602 } |
| 1603 | 1603 |
| 1604 | 1604 |
| 1605 void FullCodeGenerator::VisitClassLiteral(ClassLiteral* lit) { | 1605 void FullCodeGenerator::VisitClassLiteral(ClassLiteral* lit) { |
| 1606 Comment cmnt(masm_, "[ ClassLiteral"); | 1606 Comment cmnt(masm_, "[ ClassLiteral"); |
| 1607 | 1607 |
| 1608 Scope* saved_scope = scope(); | |
| 1609 if (lit->scope() != NULL) { | |
| 1610 scope_ = lit->scope(); | |
| 1611 DCHECK(scope_->is_block_scope()); | |
| 1612 { | |
| 1613 Comment cmnt(masm_, "[ Extend block context"); | |
|
Dmitry Lomov (no reviews)
2014/11/13 11:17:37
Please share code with VisitBlock here (add an Ent
arv (Not doing code reviews)
2014/11/13 20:47:49
Done.
| |
| 1614 __ Push(scope_->GetScopeInfo()); | |
| 1615 PushFunctionArgumentForContextAllocation(); | |
| 1616 __ CallRuntime(Runtime::kPushBlockContext, 2); | |
| 1617 StoreToFrameField(StandardFrameConstants::kContextOffset, | |
| 1618 context_register()); | |
| 1619 } | |
| 1620 { | |
| 1621 Comment cmnt(masm_, "[ Declarations"); | |
| 1622 DCHECK_EQ(1, scope_->declarations()->length()); | |
| 1623 VisitDeclarations(scope_->declarations()); | |
| 1624 } | |
| 1625 } | |
| 1626 | |
| 1608 if (lit->raw_name() != NULL) { | 1627 if (lit->raw_name() != NULL) { |
| 1609 __ Push(lit->name()); | 1628 __ Push(lit->name()); |
| 1610 } else { | 1629 } else { |
| 1611 __ Push(isolate()->factory()->undefined_value()); | 1630 __ Push(isolate()->factory()->undefined_value()); |
| 1612 } | 1631 } |
| 1613 | 1632 |
| 1614 if (lit->extends() != NULL) { | 1633 if (lit->extends() != NULL) { |
| 1615 VisitForStackValue(lit->extends()); | 1634 VisitForStackValue(lit->extends()); |
| 1616 } else { | 1635 } else { |
| 1617 __ Push(isolate()->factory()->the_hole_value()); | 1636 __ Push(isolate()->factory()->the_hole_value()); |
| 1618 } | 1637 } |
| 1619 | 1638 |
| 1620 VisitForStackValue(lit->constructor()); | 1639 VisitForStackValue(lit->constructor()); |
| 1621 | 1640 |
| 1622 __ Push(script()); | 1641 __ Push(script()); |
| 1623 __ Push(Smi::FromInt(lit->start_position())); | 1642 __ Push(Smi::FromInt(lit->start_position())); |
| 1624 __ Push(Smi::FromInt(lit->end_position())); | 1643 __ Push(Smi::FromInt(lit->end_position())); |
| 1625 | 1644 |
| 1626 __ CallRuntime(Runtime::kDefineClass, 6); | 1645 __ CallRuntime(Runtime::kDefineClass, 6); |
| 1627 EmitClassDefineProperties(lit); | 1646 EmitClassDefineProperties(lit); |
| 1628 | 1647 |
| 1648 if (lit->scope() != NULL) { | |
| 1649 DCHECK_NOT_NULL(lit->proxy()); | |
| 1650 EmitVariableAssignment(lit->proxy()->var(), Token::INIT_CONST); | |
| 1651 LoadContextField(context_register(), Context::PREVIOUS_INDEX); | |
|
Dmitry Lomov (no reviews)
2014/11/13 11:17:37
Please share code with VisitBlock here (add an Exi
arv (Not doing code reviews)
2014/11/13 20:47:49
Done.
| |
| 1652 StoreToFrameField(StandardFrameConstants::kContextOffset, | |
| 1653 context_register()); | |
| 1654 } | |
| 1655 | |
| 1656 scope_ = saved_scope; | |
| 1629 context()->Plug(result_register()); | 1657 context()->Plug(result_register()); |
| 1630 } | 1658 } |
| 1631 | 1659 |
| 1632 | 1660 |
| 1633 void FullCodeGenerator::VisitNativeFunctionLiteral( | 1661 void FullCodeGenerator::VisitNativeFunctionLiteral( |
| 1634 NativeFunctionLiteral* expr) { | 1662 NativeFunctionLiteral* expr) { |
| 1635 Comment cmnt(masm_, "[ NativeFunctionLiteral"); | 1663 Comment cmnt(masm_, "[ NativeFunctionLiteral"); |
| 1636 | 1664 |
| 1637 // Compute the function template for the native function. | 1665 // Compute the function template for the native function. |
| 1638 Handle<String> name = expr->name(); | 1666 Handle<String> name = expr->name(); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1789 } | 1817 } |
| 1790 return true; | 1818 return true; |
| 1791 } | 1819 } |
| 1792 #endif // DEBUG | 1820 #endif // DEBUG |
| 1793 | 1821 |
| 1794 | 1822 |
| 1795 #undef __ | 1823 #undef __ |
| 1796 | 1824 |
| 1797 | 1825 |
| 1798 } } // namespace v8::internal | 1826 } } // namespace v8::internal |
| OLD | NEW |