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: Code review + fixes 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
« no previous file with comments | « src/objects.cc ('k') | src/parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5802 matching lines...) Expand 10 before | Expand all | Expand 10 after
5813 disable)); 5813 disable));
5814 // If disabling optimizations we reflect that in the code object so 5814 // If disabling optimizations we reflect that in the code object so
5815 // it will not be counted as optimizable code. 5815 // it will not be counted as optimizable code.
5816 if ((code()->kind() == Code::FUNCTION) && disable) { 5816 if ((code()->kind() == Code::FUNCTION) && disable) {
5817 code()->set_optimizable(false); 5817 code()->set_optimizable(false);
5818 } 5818 }
5819 } 5819 }
5820 5820
5821 5821
5822 LanguageMode SharedFunctionInfo::language_mode() { 5822 LanguageMode SharedFunctionInfo::language_mode() {
5823 STATIC_ASSERT(LANGUAGE_END == 2); 5823 STATIC_ASSERT(LANGUAGE_END == 3);
5824 return BooleanBit::get(compiler_hints(), kStrictModeFunction) 5824 return construct_language_mode(
5825 ? STRICT : SLOPPY; 5825 BooleanBit::get(compiler_hints(), kStrictModeFunction),
5826 BooleanBit::get(compiler_hints(), kStrongModeFunction));
5826 } 5827 }
5827 5828
5828 5829
5829 void SharedFunctionInfo::set_language_mode(LanguageMode language_mode) { 5830 void SharedFunctionInfo::set_language_mode(LanguageMode language_mode) {
5830 STATIC_ASSERT(LANGUAGE_END == 2); 5831 STATIC_ASSERT(LANGUAGE_END == 3);
5831 // We only allow language mode transitions that set the same language mode 5832 // We only allow language mode transitions that set the same language mode
5832 // again or go up in the chain: 5833 // again or go up in the chain:
5833 DCHECK(is_sloppy(this->language_mode()) || is_strict(language_mode)); 5834 DCHECK(is_sloppy(this->language_mode()) || is_strict(language_mode));
5834 int hints = compiler_hints(); 5835 int hints = compiler_hints();
5835 hints = BooleanBit::set(hints, kStrictModeFunction, is_strict(language_mode)); 5836 hints = BooleanBit::set(hints, kStrictModeFunction, is_strict(language_mode));
5837 hints = BooleanBit::set(hints, kStrongModeFunction, is_strong(language_mode));
5836 set_compiler_hints(hints); 5838 set_compiler_hints(hints);
5837 } 5839 }
5838 5840
5839 5841
5840 FunctionKind SharedFunctionInfo::kind() { 5842 FunctionKind SharedFunctionInfo::kind() {
5841 return FunctionKindBits::decode(compiler_hints()); 5843 return FunctionKindBits::decode(compiler_hints());
5842 } 5844 }
5843 5845
5844 5846
5845 void SharedFunctionInfo::set_kind(FunctionKind kind) { 5847 void SharedFunctionInfo::set_kind(FunctionKind kind) {
(...skipping 1773 matching lines...) Expand 10 before | Expand all | Expand 10 after
7619 #undef READ_SHORT_FIELD 7621 #undef READ_SHORT_FIELD
7620 #undef WRITE_SHORT_FIELD 7622 #undef WRITE_SHORT_FIELD
7621 #undef READ_BYTE_FIELD 7623 #undef READ_BYTE_FIELD
7622 #undef WRITE_BYTE_FIELD 7624 #undef WRITE_BYTE_FIELD
7623 #undef NOBARRIER_READ_BYTE_FIELD 7625 #undef NOBARRIER_READ_BYTE_FIELD
7624 #undef NOBARRIER_WRITE_BYTE_FIELD 7626 #undef NOBARRIER_WRITE_BYTE_FIELD
7625 7627
7626 } } // namespace v8::internal 7628 } } // namespace v8::internal
7627 7629
7628 #endif // V8_OBJECTS_INL_H_ 7630 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698