Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 472 const uint32_t kHoleNanUpper32 = 0x7FFFFFFF; | 472 const uint32_t kHoleNanUpper32 = 0x7FFFFFFF; |
| 473 const uint32_t kHoleNanLower32 = 0xFFFFFFFF; | 473 const uint32_t kHoleNanLower32 = 0xFFFFFFFF; |
| 474 const uint32_t kNaNOrInfinityLowerBoundUpper32 = 0x7FF00000; | 474 const uint32_t kNaNOrInfinityLowerBoundUpper32 = 0x7FF00000; |
| 475 | 475 |
| 476 const uint64_t kHoleNanInt64 = | 476 const uint64_t kHoleNanInt64 = |
| 477 (static_cast<uint64_t>(kHoleNanUpper32) << 32) | kHoleNanLower32; | 477 (static_cast<uint64_t>(kHoleNanUpper32) << 32) | kHoleNanLower32; |
| 478 const uint64_t kLastNonNaNInt64 = | 478 const uint64_t kLastNonNaNInt64 = |
| 479 (static_cast<uint64_t>(kNaNOrInfinityLowerBoundUpper32) << 32); | 479 (static_cast<uint64_t>(kNaNOrInfinityLowerBoundUpper32) << 32); |
| 480 | 480 |
| 481 | 481 |
| 482 enum VariableMode { | 482 enum VariableMode { |
|
Sven Panne
2012/08/29 06:24:24
Add a warning comment here that the order of the e
rossberg
2012/08/29 09:23:19
Done.
| |
| 483 // User declared variables: | 483 // User declared variables: |
| 484 VAR, // declared via 'var', and 'function' declarations | 484 VAR, // declared via 'var', and 'function' declarations |
| 485 | 485 |
| 486 CONST, // declared via 'const' declarations | 486 CONST, // declared via 'const' declarations |
| 487 | 487 |
| 488 LET, // declared via 'let' declarations | |
| 489 | |
| 488 CONST_HARMONY, // declared via 'const' declarations in harmony mode | 490 CONST_HARMONY, // declared via 'const' declarations in harmony mode |
| 489 | 491 |
| 490 LET, // declared via 'let' declarations | |
| 491 | |
| 492 // Variables introduced by the compiler: | 492 // Variables introduced by the compiler: |
| 493 DYNAMIC, // always require dynamic lookup (we don't know | 493 DYNAMIC, // always require dynamic lookup (we don't know |
| 494 // the declaration) | 494 // the declaration) |
| 495 | 495 |
| 496 DYNAMIC_GLOBAL, // requires dynamic lookup, but we know that the | 496 DYNAMIC_GLOBAL, // requires dynamic lookup, but we know that the |
| 497 // variable is global unless it has been shadowed | 497 // variable is global unless it has been shadowed |
| 498 // by an eval-introduced variable | 498 // by an eval-introduced variable |
| 499 | 499 |
| 500 DYNAMIC_LOCAL, // requires dynamic lookup, but we know that the | 500 DYNAMIC_LOCAL, // requires dynamic lookup, but we know that the |
| 501 // variable is local and where it is unless it | 501 // variable is local and where it is unless it |
| 502 // has been shadowed by an eval-introduced | 502 // has been shadowed by an eval-introduced |
| 503 // variable | 503 // variable |
| 504 | 504 |
| 505 INTERNAL, // like VAR, but not user-visible (may or may not | 505 INTERNAL, // like VAR, but not user-visible (may or may not |
| 506 // be in a context) | 506 // be in a context) |
| 507 | 507 |
| 508 TEMPORARY // temporary variables (not user-visible), never | 508 TEMPORARY // temporary variables (not user-visible), never |
| 509 // in a context | 509 // in a context |
| 510 }; | 510 }; |
| 511 | 511 |
| 512 | 512 |
| 513 inline bool IsDynamicVariableMode(VariableMode mode) { | |
| 514 return mode >= DYNAMIC && mode <= DYNAMIC_LOCAL; | |
| 515 } | |
| 516 | |
| 517 | |
| 518 inline bool IsDeclaredVariableMode(VariableMode mode) { | |
| 519 return mode >= VAR && mode <= CONST_HARMONY; | |
| 520 } | |
| 521 | |
| 522 | |
| 523 inline bool IsLexicalVariableMode(VariableMode mode) { | |
| 524 return mode >= LET && mode <= CONST_HARMONY; | |
| 525 } | |
| 526 | |
| 527 | |
| 528 inline bool IsImmutableVariableMode(VariableMode mode) { | |
| 529 return mode == CONST || mode == CONST_HARMONY; | |
| 530 } | |
| 531 | |
| 532 | |
| 513 // ES6 Draft Rev3 10.2 specifies declarative environment records with mutable | 533 // ES6 Draft Rev3 10.2 specifies declarative environment records with mutable |
| 514 // and immutable bindings that can be in two states: initialized and | 534 // and immutable bindings that can be in two states: initialized and |
| 515 // uninitialized. In ES5 only immutable bindings have these two states. When | 535 // uninitialized. In ES5 only immutable bindings have these two states. When |
| 516 // accessing a binding, it needs to be checked for initialization. However in | 536 // accessing a binding, it needs to be checked for initialization. However in |
| 517 // the following cases the binding is initialized immediately after creation | 537 // the following cases the binding is initialized immediately after creation |
| 518 // so the initialization check can always be skipped: | 538 // so the initialization check can always be skipped: |
| 519 // 1. Var declared local variables. | 539 // 1. Var declared local variables. |
| 520 // var foo; | 540 // var foo; |
| 521 // 2. A local variable introduced by a function declaration. | 541 // 2. A local variable introduced by a function declaration. |
| 522 // function foo() {} | 542 // function foo() {} |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 549 | 569 |
| 550 enum ClearExceptionFlag { | 570 enum ClearExceptionFlag { |
| 551 KEEP_EXCEPTION, | 571 KEEP_EXCEPTION, |
| 552 CLEAR_EXCEPTION | 572 CLEAR_EXCEPTION |
| 553 }; | 573 }; |
| 554 | 574 |
| 555 | 575 |
| 556 } } // namespace v8::internal | 576 } } // namespace v8::internal |
| 557 | 577 |
| 558 #endif // V8_V8GLOBALS_H_ | 578 #endif // V8_V8GLOBALS_H_ |
| OLD | NEW |