OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef V8_COMPILER_JS_OPERATOR_H_ | 5 #ifndef V8_COMPILER_JS_OPERATOR_H_ |
6 #define V8_COMPILER_JS_OPERATOR_H_ | 6 #define V8_COMPILER_JS_OPERATOR_H_ |
7 | 7 |
8 #include "src/runtime/runtime.h" | 8 #include "src/runtime/runtime.h" |
9 #include "src/unique.h" | 9 #include "src/unique.h" |
10 | 10 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace internal { | 12 namespace internal { |
13 namespace compiler { | 13 namespace compiler { |
14 | 14 |
15 // Forward declarations. | 15 // Forward declarations. |
16 class Operator; | 16 class Operator; |
17 struct JSOperatorGlobalCache; | 17 struct JSOperatorGlobalCache; |
18 | 18 |
19 | 19 |
20 // Defines the arity and the call flags for a JavaScript function call. This is | 20 // Defines the arity and the call flags for a JavaScript function call. This is |
21 // used as a parameter by JSCallFunction operators. | 21 // used as a parameter by JSCallFunction operators. |
22 class CallFunctionParameters final { | 22 class CallFunctionParameters final { |
23 public: | 23 public: |
24 CallFunctionParameters(size_t arity, CallFunctionFlags flags, | 24 CallFunctionParameters(size_t arity, CallFunctionFlags flags, |
25 LanguageMode language_mode) | 25 LanguageMode language_mode) |
26 : bit_field_(ArityField::encode(static_cast<unsigned>(arity)) | | 26 : bit_field_(ArityField::encode(arity) | FlagsField::encode(flags) | |
27 FlagsField::encode(flags) | | |
28 LanguageModeField::encode(language_mode)) {} | 27 LanguageModeField::encode(language_mode)) {} |
29 | 28 |
30 size_t arity() const { return ArityField::decode(bit_field_); } | 29 size_t arity() const { return ArityField::decode(bit_field_); } |
31 CallFunctionFlags flags() const { return FlagsField::decode(bit_field_); } | 30 CallFunctionFlags flags() const { return FlagsField::decode(bit_field_); } |
32 LanguageMode language_mode() const { | 31 LanguageMode language_mode() const { |
33 return LanguageModeField::decode(bit_field_); | 32 return LanguageModeField::decode(bit_field_); |
34 } | 33 } |
35 | 34 |
36 bool operator==(CallFunctionParameters const& that) const { | 35 bool operator==(CallFunctionParameters const& that) const { |
37 return this->bit_field_ == that.bit_field_; | 36 return this->bit_field_ == that.bit_field_; |
38 } | 37 } |
39 bool operator!=(CallFunctionParameters const& that) const { | 38 bool operator!=(CallFunctionParameters const& that) const { |
40 return !(*this == that); | 39 return !(*this == that); |
41 } | 40 } |
42 | 41 |
43 private: | 42 private: |
44 friend size_t hash_value(CallFunctionParameters const& p) { | 43 friend size_t hash_value(CallFunctionParameters const& p) { |
45 return p.bit_field_; | 44 return p.bit_field_; |
46 } | 45 } |
47 | 46 |
48 typedef BitField<unsigned, 0, 28> ArityField; | 47 typedef BitField<size_t, 0, 28> ArityField; |
49 typedef BitField<CallFunctionFlags, 28, 2> FlagsField; | 48 typedef BitField<CallFunctionFlags, 28, 2> FlagsField; |
50 typedef BitField<LanguageMode, 30, 2> LanguageModeField; | 49 typedef BitField<LanguageMode, 30, 2> LanguageModeField; |
51 | 50 |
52 const uint32_t bit_field_; | 51 const uint32_t bit_field_; |
53 }; | 52 }; |
54 | 53 |
55 size_t hash_value(CallFunctionParameters const&); | 54 size_t hash_value(CallFunctionParameters const&); |
56 | 55 |
57 std::ostream& operator<<(std::ostream&, CallFunctionParameters const&); | 56 std::ostream& operator<<(std::ostream&, CallFunctionParameters const&); |
58 | 57 |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 Zone* const zone_; | 333 Zone* const zone_; |
335 | 334 |
336 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); | 335 DISALLOW_COPY_AND_ASSIGN(JSOperatorBuilder); |
337 }; | 336 }; |
338 | 337 |
339 } // namespace compiler | 338 } // namespace compiler |
340 } // namespace internal | 339 } // namespace internal |
341 } // namespace v8 | 340 } // namespace v8 |
342 | 341 |
343 #endif // V8_COMPILER_JS_OPERATOR_H_ | 342 #endif // V8_COMPILER_JS_OPERATOR_H_ |
OLD | NEW |