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 1523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1534 Handle<SharedFunctionInfo> function_info = | 1534 Handle<SharedFunctionInfo> function_info = |
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* lit) { |
1545 Comment cmnt(masm_, "[ ClassLiteral"); | 1545 Comment cmnt(masm_, "[ ClassLiteral"); |
1546 | 1546 |
1547 if (expr->raw_name() != NULL) { | 1547 if (lit->raw_name() != NULL) { |
1548 __ Push(expr->name()); | 1548 __ Push(lit->name()); |
1549 } else { | 1549 } else { |
1550 __ Push(isolate()->factory()->undefined_value()); | 1550 __ Push(isolate()->factory()->undefined_value()); |
1551 } | 1551 } |
1552 | 1552 |
1553 if (expr->extends() != NULL) { | 1553 if (lit->extends() != NULL) { |
1554 VisitForStackValue(expr->extends()); | 1554 VisitForStackValue(lit->extends()); |
1555 } else { | 1555 } else { |
1556 __ Push(isolate()->factory()->the_hole_value()); | 1556 __ Push(isolate()->factory()->the_hole_value()); |
1557 } | 1557 } |
1558 | 1558 |
1559 if (expr->constructor() != NULL) { | 1559 if (lit->constructor() != NULL) { |
1560 VisitForStackValue(expr->constructor()); | 1560 VisitForStackValue(lit->constructor()); |
1561 } else { | 1561 } else { |
1562 __ Push(isolate()->factory()->undefined_value()); | 1562 __ Push(isolate()->factory()->undefined_value()); |
1563 } | 1563 } |
1564 | 1564 |
| 1565 __ Push(script()); |
| 1566 __ Push(Smi::FromInt(lit->start_position())); |
| 1567 __ Push(Smi::FromInt(lit->end_position())); |
| 1568 |
1565 // TODO(arv): Process methods | 1569 // TODO(arv): Process methods |
1566 | 1570 |
1567 __ CallRuntime(Runtime::kDefineClass, 3); | 1571 __ CallRuntime(Runtime::kDefineClass, 6); |
1568 context()->Plug(result_register()); | 1572 context()->Plug(result_register()); |
1569 } | 1573 } |
1570 | 1574 |
1571 | 1575 |
1572 void FullCodeGenerator::VisitNativeFunctionLiteral( | 1576 void FullCodeGenerator::VisitNativeFunctionLiteral( |
1573 NativeFunctionLiteral* expr) { | 1577 NativeFunctionLiteral* expr) { |
1574 Comment cmnt(masm_, "[ NativeFunctionLiteral"); | 1578 Comment cmnt(masm_, "[ NativeFunctionLiteral"); |
1575 | 1579 |
1576 // Compute the function template for the native function. | 1580 // Compute the function template for the native function. |
1577 Handle<String> name = expr->name(); | 1581 Handle<String> name = expr->name(); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1728 } | 1732 } |
1729 return true; | 1733 return true; |
1730 } | 1734 } |
1731 #endif // DEBUG | 1735 #endif // DEBUG |
1732 | 1736 |
1733 | 1737 |
1734 #undef __ | 1738 #undef __ |
1735 | 1739 |
1736 | 1740 |
1737 } } // namespace v8::internal | 1741 } } // namespace v8::internal |
OLD | NEW |