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/codegen.h" | 7 #include "src/codegen.h" |
8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
9 #include "src/debug.h" | 9 #include "src/debug.h" |
10 #include "src/full-codegen.h" | 10 #include "src/full-codegen.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 | 25 |
26 void BreakableStatementChecker::Check(Expression* expr) { | 26 void BreakableStatementChecker::Check(Expression* expr) { |
27 Visit(expr); | 27 Visit(expr); |
28 } | 28 } |
29 | 29 |
30 | 30 |
31 void BreakableStatementChecker::VisitVariableDeclaration( | 31 void BreakableStatementChecker::VisitVariableDeclaration( |
32 VariableDeclaration* decl) { | 32 VariableDeclaration* decl) { |
33 } | 33 } |
34 | 34 |
| 35 |
35 void BreakableStatementChecker::VisitFunctionDeclaration( | 36 void BreakableStatementChecker::VisitFunctionDeclaration( |
36 FunctionDeclaration* decl) { | 37 FunctionDeclaration* decl) { |
37 } | 38 } |
38 | 39 |
| 40 |
| 41 void BreakableStatementChecker::VisitClassDeclaration(ClassDeclaration* decl) { |
| 42 Visit(decl->classLiteral()); |
| 43 } |
| 44 |
| 45 |
39 void BreakableStatementChecker::VisitModuleDeclaration( | 46 void BreakableStatementChecker::VisitModuleDeclaration( |
40 ModuleDeclaration* decl) { | 47 ModuleDeclaration* decl) { |
41 } | 48 } |
42 | 49 |
| 50 |
43 void BreakableStatementChecker::VisitImportDeclaration( | 51 void BreakableStatementChecker::VisitImportDeclaration( |
44 ImportDeclaration* decl) { | 52 ImportDeclaration* decl) { |
45 } | 53 } |
46 | 54 |
| 55 |
47 void BreakableStatementChecker::VisitExportDeclaration( | 56 void BreakableStatementChecker::VisitExportDeclaration( |
48 ExportDeclaration* decl) { | 57 ExportDeclaration* decl) { |
49 } | 58 } |
50 | 59 |
51 | 60 |
52 void BreakableStatementChecker::VisitModuleLiteral(ModuleLiteral* module) { | 61 void BreakableStatementChecker::VisitModuleLiteral(ModuleLiteral* module) { |
53 } | 62 } |
54 | 63 |
55 | 64 |
56 void BreakableStatementChecker::VisitModuleVariable(ModuleVariable* module) { | 65 void BreakableStatementChecker::VisitModuleVariable(ModuleVariable* module) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 179 |
171 | 180 |
172 void BreakableStatementChecker::VisitCaseClause(CaseClause* clause) { | 181 void BreakableStatementChecker::VisitCaseClause(CaseClause* clause) { |
173 } | 182 } |
174 | 183 |
175 | 184 |
176 void BreakableStatementChecker::VisitFunctionLiteral(FunctionLiteral* expr) { | 185 void BreakableStatementChecker::VisitFunctionLiteral(FunctionLiteral* expr) { |
177 } | 186 } |
178 | 187 |
179 | 188 |
| 189 void BreakableStatementChecker::VisitClassLiteral(ClassLiteral* expr) { |
| 190 if (expr->extends() != NULL) { |
| 191 Visit(expr->extends()); |
| 192 } |
| 193 } |
| 194 |
| 195 |
180 void BreakableStatementChecker::VisitNativeFunctionLiteral( | 196 void BreakableStatementChecker::VisitNativeFunctionLiteral( |
181 NativeFunctionLiteral* expr) { | 197 NativeFunctionLiteral* expr) { |
182 } | 198 } |
183 | 199 |
184 | 200 |
185 void BreakableStatementChecker::VisitConditional(Conditional* expr) { | 201 void BreakableStatementChecker::VisitConditional(Conditional* expr) { |
186 } | 202 } |
187 | 203 |
188 | 204 |
189 void BreakableStatementChecker::VisitVariableProxy(VariableProxy* expr) { | 205 void BreakableStatementChecker::VisitVariableProxy(VariableProxy* expr) { |
(...skipping 1334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1524 Handle<SharedFunctionInfo> function_info = | 1540 Handle<SharedFunctionInfo> function_info = |
1525 Compiler::BuildFunctionInfo(expr, script(), info_); | 1541 Compiler::BuildFunctionInfo(expr, script(), info_); |
1526 if (function_info.is_null()) { | 1542 if (function_info.is_null()) { |
1527 SetStackOverflow(); | 1543 SetStackOverflow(); |
1528 return; | 1544 return; |
1529 } | 1545 } |
1530 EmitNewClosure(function_info, expr->pretenure()); | 1546 EmitNewClosure(function_info, expr->pretenure()); |
1531 } | 1547 } |
1532 | 1548 |
1533 | 1549 |
| 1550 void FullCodeGenerator::VisitClassLiteral(ClassLiteral* expr) { |
| 1551 Comment cmnt(masm_, "[ ClassLiteral"); |
| 1552 if (expr->extends() != NULL) { |
| 1553 VisitForStackValue(expr->extends()); |
| 1554 } |
| 1555 /* |
| 1556 SetStatementPosition(stmt); |
| 1557 |
| 1558 VisitForStackValue(stmt->expression()); |
| 1559 PushFunctionArgumentForContextAllocation(); |
| 1560 __ CallRuntime(Runtime::kPushWithContext, 2); |
| 1561 StoreToFrameField(StandardFrameConstants::kContextOffset, context_register()); |
| 1562 |
| 1563 Scope* saved_scope = scope(); |
| 1564 scope_ = stmt->scope(); |
| 1565 { WithOrCatch body(this); |
| 1566 Visit(stmt->statement()); |
| 1567 } |
| 1568 scope_ = saved_scope; |
| 1569 |
| 1570 // Pop context. |
| 1571 LoadContextField(context_register(), Context::PREVIOUS_INDEX); |
| 1572 // Update local stack frame context field. |
| 1573 StoreToFrameField(StandardFrameConstants::kContextOffset, |
| 1574 context_register());( |
| 1575 */ |
| 1576 } |
| 1577 |
| 1578 |
1534 void FullCodeGenerator::VisitNativeFunctionLiteral( | 1579 void FullCodeGenerator::VisitNativeFunctionLiteral( |
1535 NativeFunctionLiteral* expr) { | 1580 NativeFunctionLiteral* expr) { |
1536 Comment cmnt(masm_, "[ NativeFunctionLiteral"); | 1581 Comment cmnt(masm_, "[ NativeFunctionLiteral"); |
1537 | 1582 |
1538 // Compute the function template for the native function. | 1583 // Compute the function template for the native function. |
1539 Handle<String> name = expr->name(); | 1584 Handle<String> name = expr->name(); |
1540 v8::Handle<v8::FunctionTemplate> fun_template = | 1585 v8::Handle<v8::FunctionTemplate> fun_template = |
1541 expr->extension()->GetNativeFunctionTemplate( | 1586 expr->extension()->GetNativeFunctionTemplate( |
1542 reinterpret_cast<v8::Isolate*>(isolate()), v8::Utils::ToLocal(name)); | 1587 reinterpret_cast<v8::Isolate*>(isolate()), v8::Utils::ToLocal(name)); |
1543 DCHECK(!fun_template.IsEmpty()); | 1588 DCHECK(!fun_template.IsEmpty()); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1690 } | 1735 } |
1691 return true; | 1736 return true; |
1692 } | 1737 } |
1693 #endif // DEBUG | 1738 #endif // DEBUG |
1694 | 1739 |
1695 | 1740 |
1696 #undef __ | 1741 #undef __ |
1697 | 1742 |
1698 | 1743 |
1699 } } // namespace v8::internal | 1744 } } // namespace v8::internal |
OLD | NEW |