| 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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 PrimitiveType primitive_type, | 443 PrimitiveType primitive_type, |
| 438 char const* method_name); | 444 char const* method_name); |
| 439 | 445 |
| 440 // String helpers. | 446 // String helpers. |
| 441 // Load a character from a String (might flatten a ConsString). | 447 // Load a character from a String (might flatten a ConsString). |
| 442 compiler::Node* StringCharCodeAt(compiler::Node* string, | 448 compiler::Node* StringCharCodeAt(compiler::Node* string, |
| 443 compiler::Node* smi_index); | 449 compiler::Node* smi_index); |
| 444 // Return the single character string with only {code}. | 450 // Return the single character string with only {code}. |
| 445 compiler::Node* StringFromCharCode(compiler::Node* code); | 451 compiler::Node* StringFromCharCode(compiler::Node* code); |
| 446 | 452 |
| 453 compiler::Node* StringFromCodePoint(compiler::Node* codepoint, |
| 454 UnicodeEncoding encoding); |
| 455 |
| 447 // Type conversion helpers. | 456 // Type conversion helpers. |
| 448 // Convert a String to a Number. | 457 // Convert a String to a Number. |
| 449 compiler::Node* StringToNumber(compiler::Node* context, | 458 compiler::Node* StringToNumber(compiler::Node* context, |
| 450 compiler::Node* input); | 459 compiler::Node* input); |
| 451 // Convert an object to a name. | 460 // Convert an object to a name. |
| 452 compiler::Node* ToName(compiler::Node* context, compiler::Node* input); | 461 compiler::Node* ToName(compiler::Node* context, compiler::Node* input); |
| 453 // Convert a Non-Number object to a Number. | 462 // Convert a Non-Number object to a Number. |
| 454 compiler::Node* NonNumberToNumber(compiler::Node* context, | 463 compiler::Node* NonNumberToNumber(compiler::Node* context, |
| 455 compiler::Node* input); | 464 compiler::Node* input); |
| 456 // Convert any object to a Number. | 465 // Convert any object to a Number. |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 Label* bailout); | 806 Label* bailout); |
| 798 | 807 |
| 799 static const int kElementLoopUnrollThreshold = 8; | 808 static const int kElementLoopUnrollThreshold = 8; |
| 800 }; | 809 }; |
| 801 | 810 |
| 802 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); | 811 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); |
| 803 | 812 |
| 804 } // namespace internal | 813 } // namespace internal |
| 805 } // namespace v8 | 814 } // namespace v8 |
| 806 #endif // V8_CODE_STUB_ASSEMBLER_H_ | 815 #endif // V8_CODE_STUB_ASSEMBLER_H_ |
| OLD | NEW |