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