| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 #include "src/interpreter/bytecode-flags.h" | 5 #include "src/interpreter/bytecode-flags.h" |
| 6 | 6 |
| 7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| 11 namespace interpreter { | 11 namespace interpreter { |
| 12 | 12 |
| 13 // static | 13 // static |
| 14 uint8_t CreateArrayLiteralFlags::Encode(bool use_fast_shallow_clone, |
| 15 int runtime_flags) { |
| 16 uint8_t result = FlagsBits::encode(runtime_flags); |
| 17 result |= FastShallowCloneBit::encode(use_fast_shallow_clone); |
| 18 return result; |
| 19 } |
| 20 |
| 21 // static |
| 14 uint8_t CreateObjectLiteralFlags::Encode(bool fast_clone_supported, | 22 uint8_t CreateObjectLiteralFlags::Encode(bool fast_clone_supported, |
| 15 int properties_count, | 23 int properties_count, |
| 16 int runtime_flags) { | 24 int runtime_flags) { |
| 17 uint8_t result = FlagsBits::encode(runtime_flags); | 25 uint8_t result = FlagsBits::encode(runtime_flags); |
| 18 if (fast_clone_supported) { | 26 if (fast_clone_supported) { |
| 19 STATIC_ASSERT( | 27 STATIC_ASSERT( |
| 20 FastCloneShallowObjectStub::kMaximumClonedProperties <= | 28 FastCloneShallowObjectStub::kMaximumClonedProperties <= |
| 21 1 << CreateObjectLiteralFlags::FastClonePropertiesCountBits::kShift); | 29 1 << CreateObjectLiteralFlags::FastClonePropertiesCountBits::kShift); |
| 22 DCHECK_LE(properties_count, | 30 DCHECK_LE(properties_count, |
| 23 FastCloneShallowObjectStub::kMaximumClonedProperties); | 31 FastCloneShallowObjectStub::kMaximumClonedProperties); |
| 24 result |= CreateObjectLiteralFlags::FastClonePropertiesCountBits::encode( | 32 result |= CreateObjectLiteralFlags::FastClonePropertiesCountBits::encode( |
| 25 properties_count); | 33 properties_count); |
| 26 } | 34 } |
| 27 return result; | 35 return result; |
| 28 } | 36 } |
| 29 | 37 |
| 30 // static | 38 // static |
| 31 uint8_t CreateClosureFlags::Encode(bool pretenure, bool is_function_scope) { | 39 uint8_t CreateClosureFlags::Encode(bool pretenure, bool is_function_scope) { |
| 32 uint8_t result = PretenuredBit::encode(pretenure); | 40 uint8_t result = PretenuredBit::encode(pretenure); |
| 33 if (!FLAG_always_opt && !FLAG_prepare_always_opt && | 41 if (!FLAG_always_opt && !FLAG_prepare_always_opt && |
| 34 pretenure == NOT_TENURED && is_function_scope) { | 42 pretenure == NOT_TENURED && is_function_scope) { |
| 35 result |= FastNewClosureBit::encode(true); | 43 result |= FastNewClosureBit::encode(true); |
| 36 } | 44 } |
| 37 return result; | 45 return result; |
| 38 } | 46 } |
| 39 | 47 |
| 40 } // namespace interpreter | 48 } // namespace interpreter |
| 41 } // namespace internal | 49 } // namespace internal |
| 42 } // namespace v8 | 50 } // namespace v8 |
| OLD | NEW |