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 #ifndef V8_CODE_STUB_ASSEMBLER_H_ | 5 #ifndef V8_CODE_STUB_ASSEMBLER_H_ |
6 #define V8_CODE_STUB_ASSEMBLER_H_ | 6 #define V8_CODE_STUB_ASSEMBLER_H_ |
7 | 7 |
8 #include <functional> | 8 #include <functional> |
9 | 9 |
10 #include "src/compiler/code-assembler.h" | 10 #include "src/compiler/code-assembler.h" |
11 #include "src/objects.h" | 11 #include "src/objects.h" |
12 | 12 |
13 namespace v8 { | 13 namespace v8 { |
14 namespace internal { | 14 namespace internal { |
15 | 15 |
16 class CallInterfaceDescriptor; | 16 class CallInterfaceDescriptor; |
17 class StatsCounter; | 17 class StatsCounter; |
18 class StubCache; | 18 class StubCache; |
19 | 19 |
20 enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol }; | 20 enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol }; |
21 | 21 |
| 22 enum class UnicodeEncoding { |
| 23 // Different unicode encodings in a |word32|: |
| 24 UTF16, // hi 16bits -> trailing surrogate or 0, low 16bits -> lead surrogate |
| 25 UTF32, // full UTF32 code unit / Unicode codepoint |
| 26 }; |
| 27 |
22 // Provides JavaScript-specific "macro-assembler" functionality on top of the | 28 // Provides JavaScript-specific "macro-assembler" functionality on top of the |
23 // CodeAssembler. By factoring the JavaScript-isms out of the CodeAssembler, | 29 // CodeAssembler. By factoring the JavaScript-isms out of the CodeAssembler, |
24 // it's possible to add JavaScript-specific useful CodeAssembler "macros" | 30 // it's possible to add JavaScript-specific useful CodeAssembler "macros" |
25 // without modifying files in the compiler directory (and requiring a review | 31 // without modifying files in the compiler directory (and requiring a review |
26 // from a compiler directory OWNER). | 32 // from a compiler directory OWNER). |
27 class CodeStubAssembler : public compiler::CodeAssembler { | 33 class CodeStubAssembler : public compiler::CodeAssembler { |
28 public: | 34 public: |
29 // Create with CallStub linkage. | 35 // Create with CallStub linkage. |
30 // |result_size| specifies the number of results returned by the stub. | 36 // |result_size| specifies the number of results returned by the stub. |
31 // TODO(rmcilroy): move result_size to the CallInterfaceDescriptor. | 37 // TODO(rmcilroy): move result_size to the CallInterfaceDescriptor. |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 PrimitiveType primitive_type, | 446 PrimitiveType primitive_type, |
441 char const* method_name); | 447 char const* method_name); |
442 | 448 |
443 // String helpers. | 449 // String helpers. |
444 // Load a character from a String (might flatten a ConsString). | 450 // Load a character from a String (might flatten a ConsString). |
445 compiler::Node* StringCharCodeAt(compiler::Node* string, | 451 compiler::Node* StringCharCodeAt(compiler::Node* string, |
446 compiler::Node* smi_index); | 452 compiler::Node* smi_index); |
447 // Return the single character string with only {code}. | 453 // Return the single character string with only {code}. |
448 compiler::Node* StringFromCharCode(compiler::Node* code); | 454 compiler::Node* StringFromCharCode(compiler::Node* code); |
449 | 455 |
| 456 compiler::Node* StringFromCodePoint(compiler::Node* codepoint, |
| 457 UnicodeEncoding encoding); |
| 458 |
450 // Type conversion helpers. | 459 // Type conversion helpers. |
451 // Convert a String to a Number. | 460 // Convert a String to a Number. |
452 compiler::Node* StringToNumber(compiler::Node* context, | 461 compiler::Node* StringToNumber(compiler::Node* context, |
453 compiler::Node* input); | 462 compiler::Node* input); |
454 // Convert an object to a name. | 463 // Convert an object to a name. |
455 compiler::Node* ToName(compiler::Node* context, compiler::Node* input); | 464 compiler::Node* ToName(compiler::Node* context, compiler::Node* input); |
456 // Convert a Non-Number object to a Number. | 465 // Convert a Non-Number object to a Number. |
457 compiler::Node* NonNumberToNumber(compiler::Node* context, | 466 compiler::Node* NonNumberToNumber(compiler::Node* context, |
458 compiler::Node* input); | 467 compiler::Node* input); |
459 // Convert any object to a Number. | 468 // Convert any object to a Number. |
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 Label* bailout); | 838 Label* bailout); |
830 | 839 |
831 static const int kElementLoopUnrollThreshold = 8; | 840 static const int kElementLoopUnrollThreshold = 8; |
832 }; | 841 }; |
833 | 842 |
834 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); | 843 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); |
835 | 844 |
836 } // namespace internal | 845 } // namespace internal |
837 } // namespace v8 | 846 } // namespace v8 |
838 #endif // V8_CODE_STUB_ASSEMBLER_H_ | 847 #endif // V8_CODE_STUB_ASSEMBLER_H_ |
OLD | NEW |