OLD | NEW |
1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 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_ASMJS_ASM_SCANNER_H_ | 5 #ifndef V8_ASMJS_ASM_SCANNER_H_ |
6 #define V8_ASMJS_ASM_SCANNER_H_ | 6 #define V8_ASMJS_ASM_SCANNER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <unordered_map> | 10 #include <unordered_map> |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 90 |
91 // Methods to check if the current token is an asm.js "number" (contains a | 91 // Methods to check if the current token is an asm.js "number" (contains a |
92 // dot) or an "unsigned" (a number without a dot). | 92 // dot) or an "unsigned" (a number without a dot). |
93 bool IsUnsigned() const { return Token() == kUnsigned; } | 93 bool IsUnsigned() const { return Token() == kUnsigned; } |
94 uint64_t AsUnsigned() const { return unsigned_value_; } | 94 uint64_t AsUnsigned() const { return unsigned_value_; } |
95 bool IsDouble() const { return Token() == kDouble; } | 95 bool IsDouble() const { return Token() == kDouble; } |
96 double AsDouble() const { return double_value_; } | 96 double AsDouble() const { return double_value_; } |
97 | 97 |
98 // clang-format off | 98 // clang-format off |
99 enum { | 99 enum { |
100 // [-10000 .. -10000-kMaxIdentifierCount) :: Local identifiers | 100 // [-10000-kMaxIdentifierCount, -10000) :: Local identifiers (counting |
| 101 // backwards) |
101 // [-10000 .. -1) :: Builtin tokens like keywords | 102 // [-10000 .. -1) :: Builtin tokens like keywords |
102 // (also includes some special | 103 // (also includes some special |
103 // ones like end of input) | 104 // ones like end of input) |
104 // 0 .. 255 :: Single char tokens | 105 // 0 .. 255 :: Single char tokens |
105 // 256 .. 256+kMaxIdentifierCount :: Global identifiers | 106 // 256 .. 256+kMaxIdentifierCount :: Global identifiers |
106 kLocalsStart = -10000, | 107 kLocalsStart = -10000, |
107 #define V(name, _junk1, _junk2, _junk3) kToken_##name, | 108 #define V(name, _junk1, _junk2, _junk3) kToken_##name, |
108 STDLIB_MATH_FUNCTION_LIST(V) | 109 STDLIB_MATH_FUNCTION_LIST(V) |
109 STDLIB_ARRAY_TYPE_LIST(V) | 110 STDLIB_ARRAY_TYPE_LIST(V) |
110 #undef V | 111 #undef V |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 150 |
150 // Classify character categories. | 151 // Classify character categories. |
151 bool IsIdentifierStart(uc32 ch); | 152 bool IsIdentifierStart(uc32 ch); |
152 bool IsIdentifierPart(uc32 ch); | 153 bool IsIdentifierPart(uc32 ch); |
153 bool IsNumberStart(uc32 ch); | 154 bool IsNumberStart(uc32 ch); |
154 }; | 155 }; |
155 | 156 |
156 } // namespace internal | 157 } // namespace internal |
157 } // namespace v8 | 158 } // namespace v8 |
158 #endif | 159 #endif |
OLD | NEW |