Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(183)

Side by Side Diff: src/parser.cc

Issue 7464030: Fix calculation of 'scope_calls_eval' when 'eval' is within a nested catch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/scopes.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2138 matching lines...) Expand 10 before | Expand all | Expand 10 after
2149 catch_scope = NewScope(top_scope_, Scope::CATCH_SCOPE, inside_with()); 2149 catch_scope = NewScope(top_scope_, Scope::CATCH_SCOPE, inside_with());
2150 if (top_scope_->is_strict_mode()) { 2150 if (top_scope_->is_strict_mode()) {
2151 catch_scope->EnableStrictMode(); 2151 catch_scope->EnableStrictMode();
2152 } 2152 }
2153 catch_variable = catch_scope->DeclareLocal(name, Variable::VAR); 2153 catch_variable = catch_scope->DeclareLocal(name, Variable::VAR);
2154 2154
2155 Scope* saved_scope = top_scope_; 2155 Scope* saved_scope = top_scope_;
2156 top_scope_ = catch_scope; 2156 top_scope_ = catch_scope;
2157 inner_body = ParseBlock(NULL, CHECK_OK); 2157 inner_body = ParseBlock(NULL, CHECK_OK);
2158 top_scope_ = saved_scope; 2158 top_scope_ = saved_scope;
2159 if(catch_scope->calls_eval()) top_scope_->RecordEvalCall();
Kevin Millikin (Chromium) 2011/07/28 08:53:40 Style nit: there should be a space after the keywo
Steven 2011/07/28 11:12:12 Removed. On 2011/07/28 08:53:40, Kevin Millikin wr
2159 } 2160 }
2160 } 2161 }
2161 2162
2162 // Create exit block. 2163 // Create exit block.
2163 Block* inner_finally = new(zone()) Block(isolate(), NULL, 1, false); 2164 Block* inner_finally = new(zone()) Block(isolate(), NULL, 1, false);
2164 inner_finally->AddStatement(new(zone()) ExitContextStatement()); 2165 inner_finally->AddStatement(new(zone()) ExitContextStatement());
2165 2166
2166 // Create a try/finally statement. 2167 // Create a try/finally statement.
2167 TryFinallyStatement* inner_try_finally = 2168 TryFinallyStatement* inner_try_finally =
2168 new(zone()) TryFinallyStatement(inner_body, inner_finally); 2169 new(zone()) TryFinallyStatement(inner_body, inner_finally);
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
2748 // TODO(994): In ES5, it doesn't matter if the "eval" var is declared 2749 // TODO(994): In ES5, it doesn't matter if the "eval" var is declared
2749 // in the local scope chain. It only matters that it's called "eval", 2750 // in the local scope chain. It only matters that it's called "eval",
2750 // is called without a receiver and it refers to the original eval 2751 // is called without a receiver and it refers to the original eval
2751 // function. 2752 // function.
2752 VariableProxy* callee = result->AsVariableProxy(); 2753 VariableProxy* callee = result->AsVariableProxy();
2753 if (callee != NULL && 2754 if (callee != NULL &&
2754 callee->IsVariable(isolate()->factory()->eval_symbol())) { 2755 callee->IsVariable(isolate()->factory()->eval_symbol())) {
2755 Handle<String> name = callee->name(); 2756 Handle<String> name = callee->name();
2756 Variable* var = top_scope_->Lookup(name); 2757 Variable* var = top_scope_->Lookup(name);
2757 if (var == NULL) { 2758 if (var == NULL) {
2758 top_scope_->RecordEvalCall(); 2759 top_scope_->RecordEvalCall();
Kevin Millikin (Chromium) 2011/07/28 08:53:40 I think it's more straightforward to do, instead,
Steven 2011/07/28 11:12:12 Done.
2759 } 2760 }
2760 } 2761 }
2761 result = NewCall(result, args, pos); 2762 result = NewCall(result, args, pos);
2762 break; 2763 break;
2763 } 2764 }
2764 2765
2765 case Token::PERIOD: { 2766 case Token::PERIOD: {
2766 Consume(Token::PERIOD); 2767 Consume(Token::PERIOD);
2767 int pos = scanner().location().beg_pos; 2768 int pos = scanner().location().beg_pos;
2768 Handle<String> name = ParseIdentifierName(CHECK_OK); 2769 Handle<String> name = ParseIdentifierName(CHECK_OK);
(...skipping 2342 matching lines...) Expand 10 before | Expand all | Expand 10 after
5111 info->is_global(), 5112 info->is_global(),
5112 info->StrictMode()); 5113 info->StrictMode());
5113 } 5114 }
5114 } 5115 }
5115 5116
5116 info->SetFunction(result); 5117 info->SetFunction(result);
5117 return (result != NULL); 5118 return (result != NULL);
5118 } 5119 }
5119 5120
5120 } } // namespace v8::internal 5121 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/scopes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698