OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 12 matching lines...) Expand all Loading... |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #include "v8.h" | 28 #include "v8.h" |
29 | 29 |
30 #include "api.h" | 30 #include "api.h" |
31 #include "ast.h" | 31 #include "ast.h" |
32 #include "bootstrapper.h" | 32 #include "bootstrapper.h" |
| 33 #include "codegen.h" |
33 #include "compiler.h" | 34 #include "compiler.h" |
34 #include "messages.h" | 35 #include "messages.h" |
35 #include "platform.h" | 36 #include "platform.h" |
36 #include "runtime.h" | 37 #include "runtime.h" |
37 #include "parser.h" | 38 #include "parser.h" |
38 #include "scopes.h" | 39 #include "scopes.h" |
39 #include "string-stream.h" | 40 #include "string-stream.h" |
40 | 41 |
41 namespace v8 { | 42 namespace v8 { |
42 namespace internal { | 43 namespace internal { |
(...skipping 3782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3825 // ... | 3826 // ... |
3826 } | 3827 } |
3827 | 3828 |
3828 if (!*ok) { | 3829 if (!*ok) { |
3829 // We found a macro but it failed. | 3830 // We found a macro but it failed. |
3830 ReportMessage("unable_to_parse", Vector<const char*>::empty()); | 3831 ReportMessage("unable_to_parse", Vector<const char*>::empty()); |
3831 return NULL; | 3832 return NULL; |
3832 } | 3833 } |
3833 } | 3834 } |
3834 | 3835 |
3835 // Otherwise we have a runtime call. | 3836 // Check that the expected number arguments are passed to runtime functions. |
| 3837 if (!is_pre_parsing_) { |
| 3838 if (function != NULL |
| 3839 && function->nargs != -1 |
| 3840 && function->nargs != args->length()) { |
| 3841 ReportMessage("illegal_access", Vector<const char*>::empty()); |
| 3842 *ok = false; |
| 3843 return NULL; |
| 3844 } else if (function == NULL && !name.is_null()) { |
| 3845 // If this is not a runtime function implemented in C++ it might be an |
| 3846 // inlined runtime function. |
| 3847 int argc = CodeGenerator::InlineRuntimeCallArgumentsCount(name); |
| 3848 if (argc != -1 && argc != args->length()) { |
| 3849 ReportMessage("illegal_access", Vector<const char*>::empty()); |
| 3850 *ok = false; |
| 3851 return NULL; |
| 3852 } |
| 3853 } |
| 3854 } |
| 3855 |
| 3856 // Otherwise we have a valid runtime call. |
3836 return NEW(CallRuntime(name, function, args)); | 3857 return NEW(CallRuntime(name, function, args)); |
3837 } | 3858 } |
3838 | 3859 |
3839 | 3860 |
3840 void Parser::Consume(Token::Value token) { | 3861 void Parser::Consume(Token::Value token) { |
3841 Token::Value next = Next(); | 3862 Token::Value next = Next(); |
3842 USE(next); | 3863 USE(next); |
3843 USE(token); | 3864 USE(token); |
3844 ASSERT(next == token); | 3865 ASSERT(next == token); |
3845 } | 3866 } |
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5089 parser.ParseLazy(script_source, name, | 5110 parser.ParseLazy(script_source, name, |
5090 start_position, end_position, is_expression); | 5111 start_position, end_position, is_expression); |
5091 return result; | 5112 return result; |
5092 } | 5113 } |
5093 | 5114 |
5094 | 5115 |
5095 #undef NEW | 5116 #undef NEW |
5096 | 5117 |
5097 | 5118 |
5098 } } // namespace v8::internal | 5119 } } // namespace v8::internal |
OLD | NEW |