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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
542 // variable | 542 // variable |
543 | 543 |
544 INTERNAL, // like VAR, but not user-visible (may or may not | 544 INTERNAL, // like VAR, but not user-visible (may or may not |
545 // be in a context) | 545 // be in a context) |
546 | 546 |
547 TEMPORARY // temporary variables (not user-visible), never | 547 TEMPORARY // temporary variables (not user-visible), never |
548 // in a context | 548 // in a context |
549 }; | 549 }; |
550 | 550 |
551 | 551 |
552 // ES6 Draft Rev3 10.2 specifies declarative environment records with mutable | |
553 // and immutable bindings that can be in two states: initialized and | |
554 // uninitialized. In ES5 only immutable bindings have these two states. When | |
555 // accessing a binding, it needs to be checked for initialization. However in | |
556 // the following cases the binding is initialized immediately after creation | |
557 // so the initialization check can always be skipped: | |
558 // 1. Var declared local variables. | |
559 // var foo; | |
560 // 2. A local variable introduced by a function declaration. | |
561 // function foo() {} | |
562 // 3. Parameters | |
563 // function x(foo) {} | |
564 // 4. Catch bound variables. | |
565 // try {} catch (foo) {} | |
566 // 6. Function variables of named function expressions. | |
567 // var x = function foo() {} | |
568 // 7. Implicit binding of 'this'. | |
569 // 8. Implicit binding of 'arguments' in functions. | |
570 // | |
571 // ES5 specified object environment records which are introduced by ES elements | |
572 // such as Program and WithStatement that associate identifier bindings with the | |
573 // properties of some object. In the specification only mutable bindings exists | |
Jakob Kummerow
2011/10/31 12:44:34
nit: s/exists/exist/
Steven
2011/10/31 14:28:29
Done.
| |
574 // (which may be non-writable) and have no distinct initialization step. However | |
575 // V8 allows const declarations in global code with distinct creation and | |
576 // initialization steps which are represented by non-writable properties in the | |
577 // global object. As a result also these bindings need to be checked for | |
578 // initialization. | |
579 // | |
580 // The following enum specifies a flag that indicates if the binding needs a | |
581 // distinct initialization step (NEEDS_INITIALIZATION) or if the binding is | |
582 // immediately initialized upon creation (CREATED_INITIALIZED). | |
583 enum InitializationFlag { | |
584 NEEDS_INITIALIZATION, | |
585 CREATED_INITIALIZED | |
586 }; | |
587 | |
588 | |
552 enum ClearExceptionFlag { | 589 enum ClearExceptionFlag { |
553 KEEP_EXCEPTION, | 590 KEEP_EXCEPTION, |
554 CLEAR_EXCEPTION | 591 CLEAR_EXCEPTION |
555 }; | 592 }; |
556 | 593 |
557 | 594 |
558 } } // namespace v8::internal | 595 } } // namespace v8::internal |
559 | 596 |
560 #endif // V8_V8GLOBALS_H_ | 597 #endif // V8_V8GLOBALS_H_ |
OLD | NEW |