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 5114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5125 } | 5125 } |
5126 } | 5126 } |
5127 | 5127 |
5128 | 5128 |
5129 int SharedFunctionInfo::profiler_ticks() { | 5129 int SharedFunctionInfo::profiler_ticks() { |
5130 if (code()->kind() != Code::FUNCTION) return 0; | 5130 if (code()->kind() != Code::FUNCTION) return 0; |
5131 return code()->profiler_ticks(); | 5131 return code()->profiler_ticks(); |
5132 } | 5132 } |
5133 | 5133 |
5134 | 5134 |
5135 LanguageMode SharedFunctionInfo::language_mode() { | 5135 StrictMode SharedFunctionInfo::strict_mode() { |
5136 int hints = compiler_hints(); | 5136 return BooleanBit::get(compiler_hints(), kStrictModeFunction) |
5137 if (BooleanBit::get(hints, kExtendedModeFunction)) { | 5137 ? STRICT : SLOPPY; |
5138 ASSERT(BooleanBit::get(hints, kStrictModeFunction)); | |
5139 return EXTENDED_MODE; | |
5140 } | |
5141 return BooleanBit::get(hints, kStrictModeFunction) | |
5142 ? STRICT_MODE : SLOPPY_MODE; | |
5143 } | 5138 } |
5144 | 5139 |
5145 | 5140 |
5146 void SharedFunctionInfo::set_language_mode(LanguageMode language_mode) { | 5141 void SharedFunctionInfo::set_strict_mode(StrictMode strict_mode) { |
5147 // We only allow language mode transitions that go set the same language mode | 5142 // We only allow mode transitions from sloppy to strict. |
5148 // again or go up in the chain: | 5143 ASSERT(this->strict_mode() == SLOPPY || this->strict_mode() == strict_mode); |
5149 // SLOPPY_MODE -> STRICT_MODE -> EXTENDED_MODE. | |
5150 ASSERT(this->language_mode() == SLOPPY_MODE || | |
5151 this->language_mode() == language_mode || | |
5152 language_mode == EXTENDED_MODE); | |
5153 int hints = compiler_hints(); | 5144 int hints = compiler_hints(); |
5154 hints = BooleanBit::set( | 5145 hints = BooleanBit::set(hints, kStrictModeFunction, strict_mode == STRICT); |
5155 hints, kStrictModeFunction, language_mode != SLOPPY_MODE); | |
5156 hints = BooleanBit::set( | |
5157 hints, kExtendedModeFunction, language_mode == EXTENDED_MODE); | |
5158 set_compiler_hints(hints); | 5146 set_compiler_hints(hints); |
5159 } | 5147 } |
5160 | 5148 |
5161 | 5149 |
5162 bool SharedFunctionInfo::is_sloppy_mode() { | |
5163 return !BooleanBit::get(compiler_hints(), kStrictModeFunction); | |
5164 } | |
5165 | |
5166 BOOL_GETTER(SharedFunctionInfo, compiler_hints, is_extended_mode, | |
5167 kExtendedModeFunction) | |
5168 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, native, kNative) | 5150 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, native, kNative) |
5169 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, inline_builtin, | 5151 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, inline_builtin, |
5170 kInlineBuiltin) | 5152 kInlineBuiltin) |
5171 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, | 5153 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, |
5172 name_should_print_as_anonymous, | 5154 name_should_print_as_anonymous, |
5173 kNameShouldPrintAsAnonymous) | 5155 kNameShouldPrintAsAnonymous) |
5174 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, bound, kBoundFunction) | 5156 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, bound, kBoundFunction) |
5175 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_anonymous, kIsAnonymous) | 5157 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_anonymous, kIsAnonymous) |
5176 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_function, kIsFunction) | 5158 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_function, kIsFunction) |
5177 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_optimize, | 5159 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_optimize, |
(...skipping 1582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6760 #undef READ_UINT32_FIELD | 6742 #undef READ_UINT32_FIELD |
6761 #undef WRITE_UINT32_FIELD | 6743 #undef WRITE_UINT32_FIELD |
6762 #undef READ_SHORT_FIELD | 6744 #undef READ_SHORT_FIELD |
6763 #undef WRITE_SHORT_FIELD | 6745 #undef WRITE_SHORT_FIELD |
6764 #undef READ_BYTE_FIELD | 6746 #undef READ_BYTE_FIELD |
6765 #undef WRITE_BYTE_FIELD | 6747 #undef WRITE_BYTE_FIELD |
6766 | 6748 |
6767 } } // namespace v8::internal | 6749 } } // namespace v8::internal |
6768 | 6750 |
6769 #endif // V8_OBJECTS_INL_H_ | 6751 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |