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

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

Issue 894683003: Introduce LanguageMode, drop StrictMode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebased (w/ conflicts) 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.h » ('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 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 uint32_t index) { 1190 uint32_t index) {
1191 return GetPropertyWithHandler( 1191 return GetPropertyWithHandler(
1192 proxy, receiver, proxy->GetIsolate()->factory()->Uint32ToString(index)); 1192 proxy, receiver, proxy->GetIsolate()->factory()->Uint32ToString(index));
1193 } 1193 }
1194 1194
1195 1195
1196 MaybeHandle<Object> JSProxy::SetElementWithHandler(Handle<JSProxy> proxy, 1196 MaybeHandle<Object> JSProxy::SetElementWithHandler(Handle<JSProxy> proxy,
1197 Handle<JSReceiver> receiver, 1197 Handle<JSReceiver> receiver,
1198 uint32_t index, 1198 uint32_t index,
1199 Handle<Object> value, 1199 Handle<Object> value,
1200 StrictMode strict_mode) { 1200 LanguageMode language_mode) {
1201 Isolate* isolate = proxy->GetIsolate(); 1201 Isolate* isolate = proxy->GetIsolate();
1202 Handle<String> name = isolate->factory()->Uint32ToString(index); 1202 Handle<String> name = isolate->factory()->Uint32ToString(index);
1203 return SetPropertyWithHandler(proxy, receiver, name, value, strict_mode); 1203 return SetPropertyWithHandler(proxy, receiver, name, value, language_mode);
1204 } 1204 }
1205 1205
1206 1206
1207 Maybe<bool> JSProxy::HasElementWithHandler(Handle<JSProxy> proxy, 1207 Maybe<bool> JSProxy::HasElementWithHandler(Handle<JSProxy> proxy,
1208 uint32_t index) { 1208 uint32_t index) {
1209 Isolate* isolate = proxy->GetIsolate(); 1209 Isolate* isolate = proxy->GetIsolate();
1210 Handle<String> name = isolate->factory()->Uint32ToString(index); 1210 Handle<String> name = isolate->factory()->Uint32ToString(index);
1211 return HasPropertyWithHandler(proxy, name); 1211 return HasPropertyWithHandler(proxy, name);
1212 } 1212 }
1213 1213
(...skipping 4583 matching lines...) Expand 10 before | Expand all | Expand 10 after
5797 kOptimizationDisabled, 5797 kOptimizationDisabled,
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 StrictMode SharedFunctionInfo::strict_mode() { 5807 LanguageMode SharedFunctionInfo::language_mode() {
5808 STATIC_ASSERT(LANGUAGE_END == 2);
5808 return BooleanBit::get(compiler_hints(), kStrictModeFunction) 5809 return BooleanBit::get(compiler_hints(), kStrictModeFunction)
5809 ? STRICT : SLOPPY; 5810 ? STRICT : SLOPPY;
5810 } 5811 }
5811 5812
5812 5813
5813 void SharedFunctionInfo::set_strict_mode(StrictMode strict_mode) { 5814 void SharedFunctionInfo::set_language_mode(LanguageMode language_mode) {
5814 // We only allow mode transitions from sloppy to strict. 5815 STATIC_ASSERT(LANGUAGE_END == 2);
5815 DCHECK(this->strict_mode() == SLOPPY || this->strict_mode() == strict_mode); 5816 // We only allow language mode transitions that set the same language mode
5817 // again or go up in the chain:
5818 DCHECK(is_sloppy(this->language_mode()) || is_strict(language_mode));
5816 int hints = compiler_hints(); 5819 int hints = compiler_hints();
5817 hints = BooleanBit::set(hints, kStrictModeFunction, strict_mode == STRICT); 5820 hints = BooleanBit::set(hints, kStrictModeFunction, is_strict(language_mode));
5818 set_compiler_hints(hints); 5821 set_compiler_hints(hints);
5819 } 5822 }
5820 5823
5821 5824
5822 FunctionKind SharedFunctionInfo::kind() { 5825 FunctionKind SharedFunctionInfo::kind() {
5823 return FunctionKindBits::decode(compiler_hints()); 5826 return FunctionKindBits::decode(compiler_hints());
5824 } 5827 }
5825 5828
5826 5829
5827 void SharedFunctionInfo::set_kind(FunctionKind kind) { 5830 void SharedFunctionInfo::set_kind(FunctionKind kind) {
(...skipping 1773 matching lines...) Expand 10 before | Expand all | Expand 10 after
7601 #undef READ_SHORT_FIELD 7604 #undef READ_SHORT_FIELD
7602 #undef WRITE_SHORT_FIELD 7605 #undef WRITE_SHORT_FIELD
7603 #undef READ_BYTE_FIELD 7606 #undef READ_BYTE_FIELD
7604 #undef WRITE_BYTE_FIELD 7607 #undef WRITE_BYTE_FIELD
7605 #undef NOBARRIER_READ_BYTE_FIELD 7608 #undef NOBARRIER_READ_BYTE_FIELD
7606 #undef NOBARRIER_WRITE_BYTE_FIELD 7609 #undef NOBARRIER_WRITE_BYTE_FIELD
7607 7610
7608 } } // namespace v8::internal 7611 } } // namespace v8::internal
7609 7612
7610 #endif // V8_OBJECTS_INL_H_ 7613 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698