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/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/debug.h" | 10 #include "src/debug.h" |
(...skipping 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1535 Compiler::BuildFunctionInfo(expr, script(), info_); | 1535 Compiler::BuildFunctionInfo(expr, script(), info_); |
1536 if (function_info.is_null()) { | 1536 if (function_info.is_null()) { |
1537 SetStackOverflow(); | 1537 SetStackOverflow(); |
1538 return; | 1538 return; |
1539 } | 1539 } |
1540 EmitNewClosure(function_info, expr->pretenure()); | 1540 EmitNewClosure(function_info, expr->pretenure()); |
1541 } | 1541 } |
1542 | 1542 |
1543 | 1543 |
1544 void FullCodeGenerator::VisitClassLiteral(ClassLiteral* expr) { | 1544 void FullCodeGenerator::VisitClassLiteral(ClassLiteral* expr) { |
1545 // TODO(arv): Implement | |
1546 Comment cmnt(masm_, "[ ClassLiteral"); | 1545 Comment cmnt(masm_, "[ ClassLiteral"); |
| 1546 |
| 1547 if (expr->raw_name() != NULL) { |
| 1548 __ Push(expr->name()); |
| 1549 } else { |
| 1550 __ Push(isolate()->factory()->undefined_value()); |
| 1551 } |
| 1552 |
1547 if (expr->extends() != NULL) { | 1553 if (expr->extends() != NULL) { |
1548 VisitForEffect(expr->extends()); | 1554 VisitForStackValue(expr->extends()); |
| 1555 } else { |
| 1556 __ Push(isolate()->factory()->the_hole_value()); |
1549 } | 1557 } |
1550 context()->Plug(isolate()->factory()->undefined_value()); | 1558 |
| 1559 if (expr->constructor() != NULL) { |
| 1560 VisitForStackValue(expr->constructor()); |
| 1561 } else { |
| 1562 __ Push(isolate()->factory()->undefined_value()); |
| 1563 } |
| 1564 |
| 1565 // TODO(arv): Process methods |
| 1566 |
| 1567 __ CallRuntime(Runtime::kDefineClass, 3); |
| 1568 context()->Plug(result_register()); |
1551 } | 1569 } |
1552 | 1570 |
1553 | 1571 |
1554 void FullCodeGenerator::VisitNativeFunctionLiteral( | 1572 void FullCodeGenerator::VisitNativeFunctionLiteral( |
1555 NativeFunctionLiteral* expr) { | 1573 NativeFunctionLiteral* expr) { |
1556 Comment cmnt(masm_, "[ NativeFunctionLiteral"); | 1574 Comment cmnt(masm_, "[ NativeFunctionLiteral"); |
1557 | 1575 |
1558 // Compute the function template for the native function. | 1576 // Compute the function template for the native function. |
1559 Handle<String> name = expr->name(); | 1577 Handle<String> name = expr->name(); |
1560 v8::Handle<v8::FunctionTemplate> fun_template = | 1578 v8::Handle<v8::FunctionTemplate> fun_template = |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1710 } | 1728 } |
1711 return true; | 1729 return true; |
1712 } | 1730 } |
1713 #endif // DEBUG | 1731 #endif // DEBUG |
1714 | 1732 |
1715 | 1733 |
1716 #undef __ | 1734 #undef __ |
1717 | 1735 |
1718 | 1736 |
1719 } } // namespace v8::internal | 1737 } } // namespace v8::internal |
OLD | NEW |