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

Side by Side Diff: src/scopes.h

Issue 6625048: Strict mode arguments do not share binding with formal parameters. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: CR Feedback Created 9 years, 9 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 | « src/parser.cc ('k') | src/scopes.cc » ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 186
187 // --------------------------------------------------------------------------- 187 // ---------------------------------------------------------------------------
188 // Scope-specific info. 188 // Scope-specific info.
189 189
190 // Inform the scope that the corresponding code contains a with statement. 190 // Inform the scope that the corresponding code contains a with statement.
191 void RecordWithStatement() { scope_contains_with_ = true; } 191 void RecordWithStatement() { scope_contains_with_ = true; }
192 192
193 // Inform the scope that the corresponding code contains an eval call. 193 // Inform the scope that the corresponding code contains an eval call.
194 void RecordEvalCall() { scope_calls_eval_ = true; } 194 void RecordEvalCall() { scope_calls_eval_ = true; }
195 195
196 // Enable strict mode for the scope (unless disabled by a global flag).
197 void EnableStrictMode() {
198 strict_mode_ = FLAG_strict_mode;
199 }
196 200
197 // --------------------------------------------------------------------------- 201 // ---------------------------------------------------------------------------
198 // Predicates. 202 // Predicates.
199 203
200 // Specific scope types. 204 // Specific scope types.
201 bool is_eval_scope() const { return type_ == EVAL_SCOPE; } 205 bool is_eval_scope() const { return type_ == EVAL_SCOPE; }
202 bool is_function_scope() const { return type_ == FUNCTION_SCOPE; } 206 bool is_function_scope() const { return type_ == FUNCTION_SCOPE; }
203 bool is_global_scope() const { return type_ == GLOBAL_SCOPE; } 207 bool is_global_scope() const { return type_ == GLOBAL_SCOPE; }
208 bool is_strict_mode() const { return strict_mode_; }
204 209
205 // Information about which scopes calls eval. 210 // Information about which scopes calls eval.
206 bool calls_eval() const { return scope_calls_eval_; } 211 bool calls_eval() const { return scope_calls_eval_; }
207 bool outer_scope_calls_eval() const { return outer_scope_calls_eval_; } 212 bool outer_scope_calls_eval() const { return outer_scope_calls_eval_; }
208 213
209 // Is this scope inside a with statement. 214 // Is this scope inside a with statement.
210 bool inside_with() const { return scope_inside_with_; } 215 bool inside_with() const { return scope_inside_with_; }
211 // Does this scope contain a with statement. 216 // Does this scope contain a with statement.
212 bool contains_with() const { return scope_contains_with_; } 217 bool contains_with() const { return scope_contains_with_; }
213 218
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 // Convenience variable; function scopes only. 361 // Convenience variable; function scopes only.
357 Variable* arguments_shadow_; 362 Variable* arguments_shadow_;
358 363
359 // Illegal redeclaration. 364 // Illegal redeclaration.
360 Expression* illegal_redecl_; 365 Expression* illegal_redecl_;
361 366
362 // Scope-specific information. 367 // Scope-specific information.
363 bool scope_inside_with_; // this scope is inside a 'with' of some outer scope 368 bool scope_inside_with_; // this scope is inside a 'with' of some outer scope
364 bool scope_contains_with_; // this scope contains a 'with' statement 369 bool scope_contains_with_; // this scope contains a 'with' statement
365 bool scope_calls_eval_; // this scope contains an 'eval' call 370 bool scope_calls_eval_; // this scope contains an 'eval' call
371 bool strict_mode_; // this scope is a strict mode scope
366 372
367 // Computed via PropagateScopeInfo. 373 // Computed via PropagateScopeInfo.
368 bool outer_scope_calls_eval_; 374 bool outer_scope_calls_eval_;
369 bool inner_scope_calls_eval_; 375 bool inner_scope_calls_eval_;
370 bool outer_scope_is_eval_scope_; 376 bool outer_scope_is_eval_scope_;
371 bool force_eager_compilation_; 377 bool force_eager_compilation_;
372 378
373 // Computed via AllocateVariables; function scopes only. 379 // Computed via AllocateVariables; function scopes only.
374 int num_stack_slots_; 380 int num_stack_slots_;
375 int num_heap_slots_; 381 int num_heap_slots_;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 scope_name_ = Factory::empty_symbol(); 427 scope_name_ = Factory::empty_symbol();
422 dynamics_ = NULL; 428 dynamics_ = NULL;
423 receiver_ = NULL; 429 receiver_ = NULL;
424 function_ = NULL; 430 function_ = NULL;
425 arguments_ = NULL; 431 arguments_ = NULL;
426 arguments_shadow_ = NULL; 432 arguments_shadow_ = NULL;
427 illegal_redecl_ = NULL; 433 illegal_redecl_ = NULL;
428 scope_inside_with_ = false; 434 scope_inside_with_ = false;
429 scope_contains_with_ = false; 435 scope_contains_with_ = false;
430 scope_calls_eval_ = false; 436 scope_calls_eval_ = false;
437 // Inherit the strict mode from the parent scope.
438 strict_mode_ = (outer_scope != NULL) && outer_scope->strict_mode_;
431 outer_scope_calls_eval_ = false; 439 outer_scope_calls_eval_ = false;
432 inner_scope_calls_eval_ = false; 440 inner_scope_calls_eval_ = false;
433 outer_scope_is_eval_scope_ = false; 441 outer_scope_is_eval_scope_ = false;
434 force_eager_compilation_ = false; 442 force_eager_compilation_ = false;
435 num_stack_slots_ = 0; 443 num_stack_slots_ = 0;
436 num_heap_slots_ = 0; 444 num_heap_slots_ = 0;
437 scope_info_ = scope_info; 445 scope_info_ = scope_info;
438 } 446 }
439 }; 447 };
440 448
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 int nesting_level_; 493 int nesting_level_;
486 // Nesting level of outermost scope that is contained in a with statement, 494 // Nesting level of outermost scope that is contained in a with statement,
487 // or kNotInsideWith if there are no with's around the current scope. 495 // or kNotInsideWith if there are no with's around the current scope.
488 int inside_with_level_; 496 int inside_with_level_;
489 }; 497 };
490 498
491 499
492 } } // namespace v8::internal 500 } } // namespace v8::internal
493 501
494 #endif // V8_SCOPES_H_ 502 #endif // V8_SCOPES_H_
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | src/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698