| 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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 (static_cast<uint64_t>(kHoleNanUpper32) << 32) | kHoleNanLower32; | 458 (static_cast<uint64_t>(kHoleNanUpper32) << 32) | kHoleNanLower32; |
| 459 const uint64_t kLastNonNaNInt64 = | 459 const uint64_t kLastNonNaNInt64 = |
| 460 (static_cast<uint64_t>(kNaNOrInfinityLowerBoundUpper32) << 32); | 460 (static_cast<uint64_t>(kNaNOrInfinityLowerBoundUpper32) << 32); |
| 461 | 461 |
| 462 | 462 |
| 463 // The order of this enum has to be kept in sync with the predicates below. | 463 // The order of this enum has to be kept in sync with the predicates below. |
| 464 enum VariableMode { | 464 enum VariableMode { |
| 465 // User declared variables: | 465 // User declared variables: |
| 466 VAR, // declared via 'var', and 'function' declarations | 466 VAR, // declared via 'var', and 'function' declarations |
| 467 | 467 |
| 468 CONST, // declared via 'const' declarations | 468 CONST_LEGACY, // declared via legacy 'const' declarations |
| 469 | 469 |
| 470 LET, // declared via 'let' declarations (first lexical) | 470 LET, // declared via 'let' declarations (first lexical) |
| 471 | 471 |
| 472 CONST_HARMONY, // declared via 'const' declarations in harmony mode | 472 CONST, // declared via 'const' declarations |
| 473 | 473 |
| 474 MODULE, // declared via 'module' declaration (last lexical) | 474 MODULE, // declared via 'module' declaration (last lexical) |
| 475 | 475 |
| 476 // Variables introduced by the compiler: | 476 // Variables introduced by the compiler: |
| 477 INTERNAL, // like VAR, but not user-visible (may or may not | 477 INTERNAL, // like VAR, but not user-visible (may or may not |
| 478 // be in a context) | 478 // be in a context) |
| 479 | 479 |
| 480 TEMPORARY, // temporary variables (not user-visible), stack-allocated | 480 TEMPORARY, // temporary variables (not user-visible), stack-allocated |
| 481 // unless the scope as a whole has forced context allocation | 481 // unless the scope as a whole has forced context allocation |
| 482 | 482 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 503 return mode >= VAR && mode <= MODULE; | 503 return mode >= VAR && mode <= MODULE; |
| 504 } | 504 } |
| 505 | 505 |
| 506 | 506 |
| 507 inline bool IsLexicalVariableMode(VariableMode mode) { | 507 inline bool IsLexicalVariableMode(VariableMode mode) { |
| 508 return mode >= LET && mode <= MODULE; | 508 return mode >= LET && mode <= MODULE; |
| 509 } | 509 } |
| 510 | 510 |
| 511 | 511 |
| 512 inline bool IsImmutableVariableMode(VariableMode mode) { | 512 inline bool IsImmutableVariableMode(VariableMode mode) { |
| 513 return mode == CONST || (mode >= CONST_HARMONY && mode <= MODULE); | 513 return (mode >= CONST && mode <= MODULE) || mode == CONST_LEGACY; |
| 514 } | 514 } |
| 515 | 515 |
| 516 | 516 |
| 517 // ES6 Draft Rev3 10.2 specifies declarative environment records with mutable | 517 // ES6 Draft Rev3 10.2 specifies declarative environment records with mutable |
| 518 // and immutable bindings that can be in two states: initialized and | 518 // and immutable bindings that can be in two states: initialized and |
| 519 // uninitialized. In ES5 only immutable bindings have these two states. When | 519 // uninitialized. In ES5 only immutable bindings have these two states. When |
| 520 // accessing a binding, it needs to be checked for initialization. However in | 520 // accessing a binding, it needs to be checked for initialization. However in |
| 521 // the following cases the binding is initialized immediately after creation | 521 // the following cases the binding is initialized immediately after creation |
| 522 // so the initialization check can always be skipped: | 522 // so the initialization check can always be skipped: |
| 523 // 1. Var declared local variables. | 523 // 1. Var declared local variables. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 | 558 |
| 559 | 559 |
| 560 enum MinusZeroMode { | 560 enum MinusZeroMode { |
| 561 TREAT_MINUS_ZERO_AS_ZERO, | 561 TREAT_MINUS_ZERO_AS_ZERO, |
| 562 FAIL_ON_MINUS_ZERO | 562 FAIL_ON_MINUS_ZERO |
| 563 }; | 563 }; |
| 564 | 564 |
| 565 } } // namespace v8::internal | 565 } } // namespace v8::internal |
| 566 | 566 |
| 567 #endif // V8_V8GLOBALS_H_ | 567 #endif // V8_V8GLOBALS_H_ |
| OLD | NEW |