| 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 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 // Load a character from a String (might flatten a ConsString). | 471 // Load a character from a String (might flatten a ConsString). |
| 466 compiler::Node* StringCharCodeAt(compiler::Node* string, | 472 compiler::Node* StringCharCodeAt(compiler::Node* string, |
| 467 compiler::Node* smi_index); | 473 compiler::Node* smi_index); |
| 468 // Return the single character string with only {code}. | 474 // Return the single character string with only {code}. |
| 469 compiler::Node* StringFromCharCode(compiler::Node* code); | 475 compiler::Node* StringFromCharCode(compiler::Node* code); |
| 470 // Return a new string object which holds a substring containing the range | 476 // Return a new string object which holds a substring containing the range |
| 471 // [from,to[ of string. |from| and |to| are expected to be tagged. | 477 // [from,to[ of string. |from| and |to| are expected to be tagged. |
| 472 compiler::Node* SubString(compiler::Node* context, compiler::Node* string, | 478 compiler::Node* SubString(compiler::Node* context, compiler::Node* string, |
| 473 compiler::Node* from, compiler::Node* to); | 479 compiler::Node* from, compiler::Node* to); |
| 474 | 480 |
| 481 compiler::Node* StringFromCodePoint(compiler::Node* codepoint, |
| 482 UnicodeEncoding encoding); |
| 483 |
| 475 // Type conversion helpers. | 484 // Type conversion helpers. |
| 476 // Convert a String to a Number. | 485 // Convert a String to a Number. |
| 477 compiler::Node* StringToNumber(compiler::Node* context, | 486 compiler::Node* StringToNumber(compiler::Node* context, |
| 478 compiler::Node* input); | 487 compiler::Node* input); |
| 479 // Convert an object to a name. | 488 // Convert an object to a name. |
| 480 compiler::Node* ToName(compiler::Node* context, compiler::Node* input); | 489 compiler::Node* ToName(compiler::Node* context, compiler::Node* input); |
| 481 // Convert a Non-Number object to a Number. | 490 // Convert a Non-Number object to a Number. |
| 482 compiler::Node* NonNumberToNumber(compiler::Node* context, | 491 compiler::Node* NonNumberToNumber(compiler::Node* context, |
| 483 compiler::Node* input); | 492 compiler::Node* input); |
| 484 // Convert any object to a Number. | 493 // Convert any object to a Number. |
| (...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 Label* bailout); | 863 Label* bailout); |
| 855 | 864 |
| 856 static const int kElementLoopUnrollThreshold = 8; | 865 static const int kElementLoopUnrollThreshold = 8; |
| 857 }; | 866 }; |
| 858 | 867 |
| 859 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); | 868 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); |
| 860 | 869 |
| 861 } // namespace internal | 870 } // namespace internal |
| 862 } // namespace v8 | 871 } // namespace v8 |
| 863 #endif // V8_CODE_STUB_ASSEMBLER_H_ | 872 #endif // V8_CODE_STUB_ASSEMBLER_H_ |
| OLD | NEW |