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 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 } | 856 } |
857 } | 857 } |
858 } | 858 } |
859 | 859 |
860 | 860 |
861 void FullCodeGenerator::VisitSuperReference(SuperReference* super) { | 861 void FullCodeGenerator::VisitSuperReference(SuperReference* super) { |
862 __ CallRuntime(Runtime::kThrowUnsupportedSuperError, 0); | 862 __ CallRuntime(Runtime::kThrowUnsupportedSuperError, 0); |
863 } | 863 } |
864 | 864 |
865 | 865 |
| 866 bool FullCodeGenerator::ValidateSuperCall(Call* expr) { |
| 867 Variable* new_target_var = scope()->DeclarationScope()->new_target_var(); |
| 868 if (new_target_var == nullptr) { |
| 869 // TODO(dslomov): this is not exactly correct, the spec requires us |
| 870 // to execute the constructor and only fail when an assigment to 'this' |
| 871 // is attempted. Will implement once we have general new.target support, |
| 872 // but also filed spec bug 3843 to make it an early error. |
| 873 __ CallRuntime(Runtime::kThrowUnsupportedSuperError, 0); |
| 874 RecordJSReturnSite(expr); |
| 875 context()->Plug(result_register()); |
| 876 return false; |
| 877 } |
| 878 return true; |
| 879 } |
| 880 |
| 881 |
866 void FullCodeGenerator::SetExpressionPosition(Expression* expr) { | 882 void FullCodeGenerator::SetExpressionPosition(Expression* expr) { |
867 if (!info_->is_debug()) { | 883 if (!info_->is_debug()) { |
868 CodeGenerator::RecordPositions(masm_, expr->position()); | 884 CodeGenerator::RecordPositions(masm_, expr->position()); |
869 } else { | 885 } else { |
870 // Check if the expression will be breakable without adding a debug break | 886 // Check if the expression will be breakable without adding a debug break |
871 // slot. | 887 // slot. |
872 BreakableStatementChecker checker(info_->isolate(), zone()); | 888 BreakableStatementChecker checker(info_->isolate(), zone()); |
873 checker.Check(expr); | 889 checker.Check(expr); |
874 // Record a statement position right here if the expression is not | 890 // Record a statement position right here if the expression is not |
875 // breakable. For breakable expressions the actual recording of the | 891 // breakable. For breakable expressions the actual recording of the |
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1829 } | 1845 } |
1830 codegen_->PrepareForBailoutForId(exit_id_, NO_REGISTERS); | 1846 codegen_->PrepareForBailoutForId(exit_id_, NO_REGISTERS); |
1831 codegen_->scope_ = saved_scope_; | 1847 codegen_->scope_ = saved_scope_; |
1832 } | 1848 } |
1833 | 1849 |
1834 | 1850 |
1835 #undef __ | 1851 #undef __ |
1836 | 1852 |
1837 | 1853 |
1838 } } // namespace v8::internal | 1854 } } // namespace v8::internal |
OLD | NEW |