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 2138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 Loading... | |
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 Loading... | |
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 |
OLD | NEW |