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 3462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3473 kOptimizationDisabled, | 3473 kOptimizationDisabled, |
3474 disable)); | 3474 disable)); |
3475 // If disabling optimizations we reflect that in the code object so | 3475 // If disabling optimizations we reflect that in the code object so |
3476 // it will not be counted as optimizable code. | 3476 // it will not be counted as optimizable code. |
3477 if ((code()->kind() == Code::FUNCTION) && disable) { | 3477 if ((code()->kind() == Code::FUNCTION) && disable) { |
3478 code()->set_optimizable(false); | 3478 code()->set_optimizable(false); |
3479 } | 3479 } |
3480 } | 3480 } |
3481 | 3481 |
3482 | 3482 |
3483 StrictModeFlag SharedFunctionInfo::strict_mode_flag() { | 3483 LanguageMode SharedFunctionInfo::language_mode() { |
3484 return BooleanBit::get(compiler_hints(), kStrictModeFunction) | 3484 int hints = compiler_hints(); |
3485 ? kStrictMode : kNonStrictMode; | 3485 if (BooleanBit::get(hints, kExtendedModeFunction)) { |
| 3486 ASSERT(BooleanBit::get(hints, kStrictModeFunction)); |
| 3487 return EXTENDED_MODE; |
| 3488 } |
| 3489 return BooleanBit::get(hints, kStrictModeFunction) |
| 3490 ? STRICT_MODE : CLASSIC_MODE; |
3486 } | 3491 } |
3487 | 3492 |
3488 | 3493 |
3489 void SharedFunctionInfo::set_strict_mode_flag(StrictModeFlag strict_mode_flag) { | 3494 void SharedFunctionInfo::set_language_mode(LanguageMode language_mode) { |
3490 ASSERT(strict_mode_flag == kStrictMode || | 3495 // We only allow language mode transitions that go set the same language mode |
3491 strict_mode_flag == kNonStrictMode); | 3496 // again or go up in the chain: |
3492 bool value = strict_mode_flag == kStrictMode; | 3497 // CLASSIC_MODE -> STRICT_MODE -> EXTENDED_MODE. |
3493 set_compiler_hints( | 3498 ASSERT(this->language_mode() == CLASSIC_MODE || |
3494 BooleanBit::set(compiler_hints(), kStrictModeFunction, value)); | 3499 this->language_mode() == language_mode || |
| 3500 language_mode == EXTENDED_MODE); |
| 3501 int hints = compiler_hints(); |
| 3502 hints = BooleanBit::set( |
| 3503 hints, kStrictModeFunction, language_mode != CLASSIC_MODE); |
| 3504 hints = BooleanBit::set( |
| 3505 hints, kExtendedModeFunction, language_mode == EXTENDED_MODE); |
| 3506 set_compiler_hints(hints); |
3495 } | 3507 } |
3496 | 3508 |
3497 | 3509 |
3498 BOOL_GETTER(SharedFunctionInfo, compiler_hints, strict_mode, | 3510 bool SharedFunctionInfo::is_classic_mode() { |
3499 kStrictModeFunction) | 3511 return !BooleanBit::get(compiler_hints(), kStrictModeFunction); |
| 3512 } |
| 3513 |
| 3514 BOOL_GETTER(SharedFunctionInfo, compiler_hints, is_extended_mode, |
| 3515 kExtendedModeFunction) |
3500 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, native, kNative) | 3516 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, native, kNative) |
3501 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, | 3517 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, |
3502 name_should_print_as_anonymous, | 3518 name_should_print_as_anonymous, |
3503 kNameShouldPrintAsAnonymous) | 3519 kNameShouldPrintAsAnonymous) |
3504 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, bound, kBoundFunction) | 3520 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, bound, kBoundFunction) |
3505 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_anonymous, kIsAnonymous) | 3521 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_anonymous, kIsAnonymous) |
3506 | 3522 |
3507 ACCESSORS(CodeCache, default_cache, FixedArray, kDefaultCacheOffset) | 3523 ACCESSORS(CodeCache, default_cache, FixedArray, kDefaultCacheOffset) |
3508 ACCESSORS(CodeCache, normal_type_cache, Object, kNormalTypeCacheOffset) | 3524 ACCESSORS(CodeCache, normal_type_cache, Object, kNormalTypeCacheOffset) |
3509 | 3525 |
(...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4618 #undef WRITE_INT_FIELD | 4634 #undef WRITE_INT_FIELD |
4619 #undef READ_SHORT_FIELD | 4635 #undef READ_SHORT_FIELD |
4620 #undef WRITE_SHORT_FIELD | 4636 #undef WRITE_SHORT_FIELD |
4621 #undef READ_BYTE_FIELD | 4637 #undef READ_BYTE_FIELD |
4622 #undef WRITE_BYTE_FIELD | 4638 #undef WRITE_BYTE_FIELD |
4623 | 4639 |
4624 | 4640 |
4625 } } // namespace v8::internal | 4641 } } // namespace v8::internal |
4626 | 4642 |
4627 #endif // V8_OBJECTS_INL_H_ | 4643 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |