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 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 | 813 |
814 int FullCodeGenerator::DeclareGlobalsFlags() { | 814 int FullCodeGenerator::DeclareGlobalsFlags() { |
815 DCHECK(DeclareGlobalsStrictMode::is_valid(strict_mode())); | 815 DCHECK(DeclareGlobalsStrictMode::is_valid(strict_mode())); |
816 return DeclareGlobalsEvalFlag::encode(is_eval()) | | 816 return DeclareGlobalsEvalFlag::encode(is_eval()) | |
817 DeclareGlobalsNativeFlag::encode(is_native()) | | 817 DeclareGlobalsNativeFlag::encode(is_native()) | |
818 DeclareGlobalsStrictMode::encode(strict_mode()); | 818 DeclareGlobalsStrictMode::encode(strict_mode()); |
819 } | 819 } |
820 | 820 |
821 | 821 |
822 void FullCodeGenerator::SetFunctionPosition(FunctionLiteral* fun) { | 822 void FullCodeGenerator::SetFunctionPosition(FunctionLiteral* fun) { |
823 CodeGenerator::RecordPositions(masm_, fun->start_position()); | 823 if (fun->start_position() != RelocInfo::kNoPosition) { |
| 824 CodeGenerator::RecordPositions(masm_, fun->start_position()); |
| 825 } |
824 } | 826 } |
825 | 827 |
826 | 828 |
827 void FullCodeGenerator::SetReturnPosition(FunctionLiteral* fun) { | 829 void FullCodeGenerator::SetReturnPosition(FunctionLiteral* fun) { |
828 CodeGenerator::RecordPositions(masm_, fun->end_position() - 1); | 830 if (fun->end_position() != RelocInfo::kNoPosition) { |
| 831 CodeGenerator::RecordPositions(masm_, fun->end_position() - 1); |
| 832 } |
829 } | 833 } |
830 | 834 |
831 | 835 |
832 void FullCodeGenerator::SetStatementPosition(Statement* stmt) { | 836 void FullCodeGenerator::SetStatementPosition(Statement* stmt) { |
833 if (!info_->is_debug()) { | 837 if (!info_->is_debug()) { |
834 CodeGenerator::RecordPositions(masm_, stmt->position()); | 838 CodeGenerator::RecordPositions(masm_, stmt->position()); |
835 } else { | 839 } else { |
836 // Check if the statement will be breakable without adding a debug break | 840 // Check if the statement will be breakable without adding a debug break |
837 // slot. | 841 // slot. |
838 BreakableStatementChecker checker(zone()); | 842 BreakableStatementChecker checker(zone()); |
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1568 } else { | 1572 } else { |
1569 __ Push(isolate()->factory()->undefined_value()); | 1573 __ Push(isolate()->factory()->undefined_value()); |
1570 } | 1574 } |
1571 | 1575 |
1572 if (lit->extends() != NULL) { | 1576 if (lit->extends() != NULL) { |
1573 VisitForStackValue(lit->extends()); | 1577 VisitForStackValue(lit->extends()); |
1574 } else { | 1578 } else { |
1575 __ Push(isolate()->factory()->the_hole_value()); | 1579 __ Push(isolate()->factory()->the_hole_value()); |
1576 } | 1580 } |
1577 | 1581 |
1578 if (lit->constructor() != NULL) { | 1582 VisitForStackValue(lit->constructor()); |
1579 VisitForStackValue(lit->constructor()); | |
1580 } else { | |
1581 __ Push(isolate()->factory()->undefined_value()); | |
1582 } | |
1583 | 1583 |
1584 __ Push(script()); | 1584 __ Push(script()); |
1585 __ Push(Smi::FromInt(lit->start_position())); | 1585 __ Push(Smi::FromInt(lit->start_position())); |
1586 __ Push(Smi::FromInt(lit->end_position())); | 1586 __ Push(Smi::FromInt(lit->end_position())); |
1587 | 1587 |
1588 __ CallRuntime(Runtime::kDefineClass, 6); | 1588 __ CallRuntime(Runtime::kDefineClass, 6); |
1589 EmitClassDefineProperties(lit); | 1589 EmitClassDefineProperties(lit); |
1590 | 1590 |
1591 context()->Plug(result_register()); | 1591 context()->Plug(result_register()); |
1592 } | 1592 } |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1751 } | 1751 } |
1752 return true; | 1752 return true; |
1753 } | 1753 } |
1754 #endif // DEBUG | 1754 #endif // DEBUG |
1755 | 1755 |
1756 | 1756 |
1757 #undef __ | 1757 #undef __ |
1758 | 1758 |
1759 | 1759 |
1760 } } // namespace v8::internal | 1760 } } // namespace v8::internal |
OLD | NEW |