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