Chromium Code Reviews| Index: src/objects-inl.h |
| diff --git a/src/objects-inl.h b/src/objects-inl.h |
| index 1dde60df546fc85ec110f2a5f5ef47381589dd99..3cab332c766e1a870c63553ee5e8e21d920ffd31 100644 |
| --- a/src/objects-inl.h |
| +++ b/src/objects-inl.h |
| @@ -1197,10 +1197,10 @@ MaybeHandle<Object> JSProxy::SetElementWithHandler(Handle<JSProxy> proxy, |
| Handle<JSReceiver> receiver, |
| uint32_t index, |
| Handle<Object> value, |
| - StrictMode strict_mode) { |
| + LanguageMode language_mode) { |
| Isolate* isolate = proxy->GetIsolate(); |
| Handle<String> name = isolate->factory()->Uint32ToString(index); |
| - return SetPropertyWithHandler(proxy, receiver, name, value, strict_mode); |
| + return SetPropertyWithHandler(proxy, receiver, name, value, language_mode); |
| } |
| @@ -5804,17 +5804,20 @@ void SharedFunctionInfo::set_optimization_disabled(bool disable) { |
| } |
| -StrictMode SharedFunctionInfo::strict_mode() { |
| +LanguageMode SharedFunctionInfo::language_mode() { |
| + STATIC_ASSERT(LANGUAGE_END == 2); |
| return BooleanBit::get(compiler_hints(), kStrictModeFunction) |
| ? STRICT : SLOPPY; |
| } |
| -void SharedFunctionInfo::set_strict_mode(StrictMode strict_mode) { |
| - // We only allow mode transitions from sloppy to strict. |
| - DCHECK(this->strict_mode() == SLOPPY || this->strict_mode() == strict_mode); |
| +void SharedFunctionInfo::set_language_mode(LanguageMode language_mode) { |
| + STATIC_ASSERT(LANGUAGE_END == 2); |
| + // We only allow language mode transitions that set the same language mode |
| + // again or go up in the chain: |
| + DCHECK(!is_strict(this->language_mode()) || is_strict(language_mode)); |
|
rossberg
2015/02/03 12:26:20
Maybe abstract that into an is_stricter_than predi
marja
2015/02/03 14:45:02
That seems overkill; this is now easier to read af
rossberg
2015/02/03 15:14:29
The reason I thought this would be useful is that
|
| int hints = compiler_hints(); |
| - hints = BooleanBit::set(hints, kStrictModeFunction, strict_mode == STRICT); |
| + hints = BooleanBit::set(hints, kStrictModeFunction, is_strict(language_mode)); |
| set_compiler_hints(hints); |
| } |