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 ASSERT(this->language_mode() == CLASSIC_MODE || |
Rico
2011/11/15 08:25:07
add comment here stating that the allowed transiti
Steven
2011/11/15 13:33:30
Done.
| |
3491 strict_mode_flag == kNonStrictMode); | 3496 this->language_mode() == language_mode || |
3492 bool value = strict_mode_flag == kStrictMode; | 3497 language_mode == EXTENDED_MODE); |
3493 set_compiler_hints( | 3498 int hints = compiler_hints(); |
3494 BooleanBit::set(compiler_hints(), kStrictModeFunction, value)); | 3499 hints = BooleanBit::set( |
3500 hints, kStrictModeFunction, language_mode != CLASSIC_MODE); | |
3501 hints = BooleanBit::set( | |
3502 hints, kExtendedModeFunction, language_mode == EXTENDED_MODE); | |
3503 set_compiler_hints(hints); | |
3495 } | 3504 } |
3496 | 3505 |
3497 | 3506 |
3498 BOOL_GETTER(SharedFunctionInfo, compiler_hints, strict_mode, | 3507 bool SharedFunctionInfo::is_classic_mode() { |
3499 kStrictModeFunction) | 3508 return !BooleanBit::get(compiler_hints(), kStrictModeFunction); |
3509 } | |
3510 | |
3511 BOOL_GETTER(SharedFunctionInfo, compiler_hints, is_extended_mode, | |
3512 kExtendedModeFunction) | |
3500 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, native, kNative) | 3513 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, native, kNative) |
3501 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, | 3514 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, |
3502 name_should_print_as_anonymous, | 3515 name_should_print_as_anonymous, |
3503 kNameShouldPrintAsAnonymous) | 3516 kNameShouldPrintAsAnonymous) |
3504 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, bound, kBoundFunction) | 3517 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, bound, kBoundFunction) |
3505 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_anonymous, kIsAnonymous) | 3518 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_anonymous, kIsAnonymous) |
3506 | 3519 |
3507 ACCESSORS(CodeCache, default_cache, FixedArray, kDefaultCacheOffset) | 3520 ACCESSORS(CodeCache, default_cache, FixedArray, kDefaultCacheOffset) |
3508 ACCESSORS(CodeCache, normal_type_cache, Object, kNormalTypeCacheOffset) | 3521 ACCESSORS(CodeCache, normal_type_cache, Object, kNormalTypeCacheOffset) |
3509 | 3522 |
(...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4618 #undef WRITE_INT_FIELD | 4631 #undef WRITE_INT_FIELD |
4619 #undef READ_SHORT_FIELD | 4632 #undef READ_SHORT_FIELD |
4620 #undef WRITE_SHORT_FIELD | 4633 #undef WRITE_SHORT_FIELD |
4621 #undef READ_BYTE_FIELD | 4634 #undef READ_BYTE_FIELD |
4622 #undef WRITE_BYTE_FIELD | 4635 #undef WRITE_BYTE_FIELD |
4623 | 4636 |
4624 | 4637 |
4625 } } // namespace v8::internal | 4638 } } // namespace v8::internal |
4626 | 4639 |
4627 #endif // V8_OBJECTS_INL_H_ | 4640 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |