OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 2993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3004 // Keep track of eval() calls since they disable all local variable | 3004 // Keep track of eval() calls since they disable all local variable |
3005 // optimizations. | 3005 // optimizations. |
3006 // The calls that need special treatment are the | 3006 // The calls that need special treatment are the |
3007 // direct eval calls. These calls are all of the form eval(...), with | 3007 // direct eval calls. These calls are all of the form eval(...), with |
3008 // no explicit receiver. | 3008 // no explicit receiver. |
3009 // These calls are marked as potentially direct eval calls. Whether | 3009 // These calls are marked as potentially direct eval calls. Whether |
3010 // they are actually direct calls to eval is determined at run time. | 3010 // they are actually direct calls to eval is determined at run time. |
3011 VariableProxy* callee = result->AsVariableProxy(); | 3011 VariableProxy* callee = result->AsVariableProxy(); |
3012 if (callee != NULL && | 3012 if (callee != NULL && |
3013 callee->IsVariable(isolate()->factory()->eval_symbol())) { | 3013 callee->IsVariable(isolate()->factory()->eval_symbol())) { |
3014 top_scope_->DeclarationScope()->RecordEvalCall(); | 3014 if (FLAG_harmony_scoping) { |
| 3015 Scope* scope = top_scope_; |
| 3016 while (!scope->calls_eval() && |
| 3017 !scope->is_declaration_scope()) { |
| 3018 scope->RecordEvalCall(); |
| 3019 scope = scope->outer_scope(); |
| 3020 } |
| 3021 // Make sure to record the eval call in the declaration scope. |
| 3022 scope->RecordEvalCall(); |
| 3023 } else { |
| 3024 top_scope_->DeclarationScope()->RecordEvalCall(); |
| 3025 } |
3015 } | 3026 } |
3016 result = NewCall(result, args, pos); | 3027 result = NewCall(result, args, pos); |
3017 break; | 3028 break; |
3018 } | 3029 } |
3019 | 3030 |
3020 case Token::PERIOD: { | 3031 case Token::PERIOD: { |
3021 Consume(Token::PERIOD); | 3032 Consume(Token::PERIOD); |
3022 int pos = scanner().location().beg_pos; | 3033 int pos = scanner().location().beg_pos; |
3023 Handle<String> name = ParseIdentifierName(CHECK_OK); | 3034 Handle<String> name = ParseIdentifierName(CHECK_OK); |
3024 result = new(zone()) Property(isolate(), | 3035 result = new(zone()) Property(isolate(), |
(...skipping 2627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5652 ASSERT(info->isolate()->has_pending_exception()); | 5663 ASSERT(info->isolate()->has_pending_exception()); |
5653 } else { | 5664 } else { |
5654 result = parser.ParseProgram(info); | 5665 result = parser.ParseProgram(info); |
5655 } | 5666 } |
5656 } | 5667 } |
5657 info->SetFunction(result); | 5668 info->SetFunction(result); |
5658 return (result != NULL); | 5669 return (result != NULL); |
5659 } | 5670 } |
5660 | 5671 |
5661 } } // namespace v8::internal | 5672 } } // namespace v8::internal |
OLD | NEW |