Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/objects-inl.h

Issue 898983002: Add strong mode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 5787 matching lines...) Expand 10 before | Expand all | Expand 10 after
5798 disable)); 5798 disable));
5799 // If disabling optimizations we reflect that in the code object so 5799 // If disabling optimizations we reflect that in the code object so
5800 // it will not be counted as optimizable code. 5800 // it will not be counted as optimizable code.
5801 if ((code()->kind() == Code::FUNCTION) && disable) { 5801 if ((code()->kind() == Code::FUNCTION) && disable) {
5802 code()->set_optimizable(false); 5802 code()->set_optimizable(false);
5803 } 5803 }
5804 } 5804 }
5805 5805
5806 5806
5807 LanguageMode SharedFunctionInfo::language_mode() { 5807 LanguageMode SharedFunctionInfo::language_mode() {
5808 STATIC_ASSERT(LANGUAGE_END == 2); 5808 STATIC_ASSERT(LANGUAGE_END == 3);
5809 return BooleanBit::get(compiler_hints(), kStrictModeFunction) 5809 return construct_language_mode(
5810 ? STRICT : SLOPPY; 5810 BooleanBit::get(compiler_hints(), kStrictModeFunction),
5811 BooleanBit::get(compiler_hints(), kSaneModeFunction));
5811 } 5812 }
5812 5813
5813 5814
5814 void SharedFunctionInfo::set_language_mode(LanguageMode language_mode) { 5815 void SharedFunctionInfo::set_language_mode(LanguageMode language_mode) {
5815 STATIC_ASSERT(LANGUAGE_END == 2); 5816 STATIC_ASSERT(LANGUAGE_END == 3);
5816 // We only allow language mode transitions that set the same language mode 5817 // We only allow language mode transitions that set the same language mode
5817 // again or go up in the chain: 5818 // again or go up in the chain:
5818 DCHECK(is_sloppy(this->language_mode()) || is_strict(language_mode)); 5819 DCHECK(is_sloppy(this->language_mode()) || is_strict(language_mode));
5819 int hints = compiler_hints(); 5820 int hints = compiler_hints();
5820 hints = BooleanBit::set(hints, kStrictModeFunction, is_strict(language_mode)); 5821 hints = BooleanBit::set(hints, kStrictModeFunction, is_strict(language_mode));
5822 hints = BooleanBit::set(hints, kSaneModeFunction, is_sane(language_mode));
5821 set_compiler_hints(hints); 5823 set_compiler_hints(hints);
5822 } 5824 }
5823 5825
5824 5826
5825 FunctionKind SharedFunctionInfo::kind() { 5827 FunctionKind SharedFunctionInfo::kind() {
5826 return FunctionKindBits::decode(compiler_hints()); 5828 return FunctionKindBits::decode(compiler_hints());
5827 } 5829 }
5828 5830
5829 5831
5830 void SharedFunctionInfo::set_kind(FunctionKind kind) { 5832 void SharedFunctionInfo::set_kind(FunctionKind kind) {
(...skipping 1773 matching lines...) Expand 10 before | Expand all | Expand 10 after
7604 #undef READ_SHORT_FIELD 7606 #undef READ_SHORT_FIELD
7605 #undef WRITE_SHORT_FIELD 7607 #undef WRITE_SHORT_FIELD
7606 #undef READ_BYTE_FIELD 7608 #undef READ_BYTE_FIELD
7607 #undef WRITE_BYTE_FIELD 7609 #undef WRITE_BYTE_FIELD
7608 #undef NOBARRIER_READ_BYTE_FIELD 7610 #undef NOBARRIER_READ_BYTE_FIELD
7609 #undef NOBARRIER_WRITE_BYTE_FIELD 7611 #undef NOBARRIER_WRITE_BYTE_FIELD
7610 7612
7611 } } // namespace v8::internal 7613 } } // namespace v8::internal
7612 7614
7613 #endif // V8_OBJECTS_INL_H_ 7615 #endif // V8_OBJECTS_INL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698