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 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 } | 831 } |
832 } | 832 } |
833 } | 833 } |
834 | 834 |
835 | 835 |
836 void FullCodeGenerator::VisitSuperReference(SuperReference* super) { | 836 void FullCodeGenerator::VisitSuperReference(SuperReference* super) { |
837 __ CallRuntime(Runtime::kThrowUnsupportedSuperError, 0); | 837 __ CallRuntime(Runtime::kThrowUnsupportedSuperError, 0); |
838 } | 838 } |
839 | 839 |
840 | 840 |
841 bool FullCodeGenerator::ValidateSuperCall(Call* expr) { | |
842 Variable* new_target_var = scope()->DeclarationScope()->new_target_var(); | |
843 if (new_target_var == nullptr) { | |
844 // TODO(dslomov): this is not exactly correct, the spec requires us | |
845 // to execute the constructor and only fail when an assigment to 'this' | |
846 // is attempted. Will implement once we have general new.target support, | |
847 // but also filed spec bug 3843 to make it an early error. | |
848 __ CallRuntime(Runtime::kThrowUnsupportedSuperError, 0); | |
849 RecordJSReturnSite(expr); | |
850 context()->Plug(result_register()); | |
851 return false; | |
852 } | |
853 return true; | |
854 } | |
855 | |
856 | |
857 void FullCodeGenerator::SetExpressionPosition(Expression* expr) { | 841 void FullCodeGenerator::SetExpressionPosition(Expression* expr) { |
858 if (!info_->is_debug()) { | 842 if (!info_->is_debug()) { |
859 CodeGenerator::RecordPositions(masm_, expr->position()); | 843 CodeGenerator::RecordPositions(masm_, expr->position()); |
860 } else { | 844 } else { |
861 // Check if the expression will be breakable without adding a debug break | 845 // Check if the expression will be breakable without adding a debug break |
862 // slot. | 846 // slot. |
863 BreakableStatementChecker checker(info_->isolate(), zone()); | 847 BreakableStatementChecker checker(info_->isolate(), zone()); |
864 checker.Check(expr); | 848 checker.Check(expr); |
865 // Record a statement position right here if the expression is not | 849 // Record a statement position right here if the expression is not |
866 // breakable. For breakable expressions the actual recording of the | 850 // breakable. For breakable expressions the actual recording of the |
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1822 } | 1806 } |
1823 codegen_->PrepareForBailoutForId(exit_id_, NO_REGISTERS); | 1807 codegen_->PrepareForBailoutForId(exit_id_, NO_REGISTERS); |
1824 codegen_->scope_ = saved_scope_; | 1808 codegen_->scope_ = saved_scope_; |
1825 } | 1809 } |
1826 | 1810 |
1827 | 1811 |
1828 #undef __ | 1812 #undef __ |
1829 | 1813 |
1830 | 1814 |
1831 } } // namespace v8::internal | 1815 } } // namespace v8::internal |
OLD | NEW |