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 2379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2390 result->AddStatement(wrapper); | 2390 result->AddStatement(wrapper); |
2391 } | 2391 } |
2392 return result; | 2392 return result; |
2393 } | 2393 } |
2394 | 2394 |
2395 | 2395 |
2396 Statement* Parser::ParseWithStatement(ZoneStringList* labels, bool* ok) { | 2396 Statement* Parser::ParseWithStatement(ZoneStringList* labels, bool* ok) { |
2397 // WithStatement :: | 2397 // WithStatement :: |
2398 // 'with' '(' Expression ')' Statement | 2398 // 'with' '(' Expression ')' Statement |
2399 | 2399 |
2400 // We do not allow the use of 'with' statements in the internal JS | |
2401 // code. If 'with' statements were allowed, the simplified setup of | |
2402 // the runtime context chain would allow access to properties in the | |
2403 // global object from within a 'with' statement. | |
2404 ASSERT(extension_ != NULL || !Bootstrapper::IsActive()); | |
2405 | |
2406 Expect(Token::WITH, CHECK_OK); | 2400 Expect(Token::WITH, CHECK_OK); |
2407 Expect(Token::LPAREN, CHECK_OK); | 2401 Expect(Token::LPAREN, CHECK_OK); |
2408 Expression* expr = ParseExpression(true, CHECK_OK); | 2402 Expression* expr = ParseExpression(true, CHECK_OK); |
2409 Expect(Token::RPAREN, CHECK_OK); | 2403 Expect(Token::RPAREN, CHECK_OK); |
2410 | 2404 |
2411 return WithHelper(expr, labels, false, CHECK_OK); | 2405 return WithHelper(expr, labels, false, CHECK_OK); |
2412 } | 2406 } |
2413 | 2407 |
2414 | 2408 |
2415 CaseClause* Parser::ParseCaseClause(bool* default_seen_ptr, bool* ok) { | 2409 CaseClause* Parser::ParseCaseClause(bool* default_seen_ptr, bool* ok) { |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3081 // potentially direct eval calls. Whether they are actually direct calls | 3075 // potentially direct eval calls. Whether they are actually direct calls |
3082 // to eval is determined at run time. | 3076 // to eval is determined at run time. |
3083 | 3077 |
3084 bool is_potentially_direct_eval = false; | 3078 bool is_potentially_direct_eval = false; |
3085 if (!is_pre_parsing_) { | 3079 if (!is_pre_parsing_) { |
3086 VariableProxy* callee = result->AsVariableProxy(); | 3080 VariableProxy* callee = result->AsVariableProxy(); |
3087 if (callee != NULL && callee->IsVariable(Factory::eval_symbol())) { | 3081 if (callee != NULL && callee->IsVariable(Factory::eval_symbol())) { |
3088 Handle<String> name = callee->name(); | 3082 Handle<String> name = callee->name(); |
3089 Variable* var = top_scope_->Lookup(name); | 3083 Variable* var = top_scope_->Lookup(name); |
3090 if (var == NULL) { | 3084 if (var == NULL) { |
3091 // We do not allow direct calls to 'eval' in our internal | |
3092 // JS files. Use builtin functions instead. | |
3093 ASSERT(extension_ != NULL || !Bootstrapper::IsActive()); | |
3094 top_scope_->RecordEvalCall(); | 3085 top_scope_->RecordEvalCall(); |
3095 is_potentially_direct_eval = true; | 3086 is_potentially_direct_eval = true; |
3096 } | 3087 } |
3097 } | 3088 } |
3098 } | 3089 } |
3099 | 3090 |
3100 if (is_potentially_direct_eval) { | 3091 if (is_potentially_direct_eval) { |
3101 result = factory()->NewCallEval(result, args, pos); | 3092 result = factory()->NewCallEval(result, args, pos); |
3102 } else { | 3093 } else { |
3103 result = factory()->NewCall(result, args, pos); | 3094 result = factory()->NewCall(result, args, pos); |
(...skipping 1810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4914 start_position, | 4905 start_position, |
4915 is_expression); | 4906 is_expression); |
4916 return result; | 4907 return result; |
4917 } | 4908 } |
4918 | 4909 |
4919 | 4910 |
4920 #undef NEW | 4911 #undef NEW |
4921 | 4912 |
4922 | 4913 |
4923 } } // namespace v8::internal | 4914 } } // namespace v8::internal |
OLD | NEW |