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 CanonicalizationMode { kDontCanonicalize, kCanonicalize }; |
20 enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol }; | 21 enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol }; |
21 | 22 |
22 enum class UnicodeEncoding { | 23 enum class UnicodeEncoding { |
23 // Different unicode encodings in a |word32|: | 24 // Different unicode encodings in a |word32|: |
24 UTF16, // hi 16bits -> trailing surrogate or 0, low 16bits -> lead surrogate | 25 UTF16, // hi 16bits -> trailing surrogate or 0, low 16bits -> lead surrogate |
25 UTF32, // full UTF32 code unit / Unicode codepoint | 26 UTF32, // full UTF32 code unit / Unicode codepoint |
26 }; | 27 }; |
27 | 28 |
28 // Provides JavaScript-specific "macro-assembler" functionality on top of the | 29 // Provides JavaScript-specific "macro-assembler" functionality on top of the |
29 // CodeAssembler. By factoring the JavaScript-isms out of the CodeAssembler, | 30 // CodeAssembler. By factoring the JavaScript-isms out of the CodeAssembler, |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 compiler::Node* allocation_site); | 421 compiler::Node* allocation_site); |
421 | 422 |
422 compiler::Node* TruncateTaggedToFloat64(compiler::Node* context, | 423 compiler::Node* TruncateTaggedToFloat64(compiler::Node* context, |
423 compiler::Node* value); | 424 compiler::Node* value); |
424 compiler::Node* TruncateTaggedToWord32(compiler::Node* context, | 425 compiler::Node* TruncateTaggedToWord32(compiler::Node* context, |
425 compiler::Node* value); | 426 compiler::Node* value); |
426 // Truncate the floating point value of a HeapNumber to an Int32. | 427 // Truncate the floating point value of a HeapNumber to an Int32. |
427 compiler::Node* TruncateHeapNumberValueToWord32(compiler::Node* object); | 428 compiler::Node* TruncateHeapNumberValueToWord32(compiler::Node* object); |
428 | 429 |
429 // Conversions. | 430 // Conversions. |
430 compiler::Node* ChangeFloat64ToTagged(compiler::Node* value); | 431 // Returns a tagged representation of the float64 {value}. Might optionally |
| 432 // try to canonicalize to Smi representation if the {value} is in Smi range. |
| 433 compiler::Node* ChangeFloat64ToTagged( |
| 434 compiler::Node* value, |
| 435 CanonicalizationMode mode = CanonicalizationMode::kDontCanonicalize); |
431 compiler::Node* ChangeInt32ToTagged(compiler::Node* value); | 436 compiler::Node* ChangeInt32ToTagged(compiler::Node* value); |
432 compiler::Node* ChangeUint32ToTagged(compiler::Node* value); | 437 compiler::Node* ChangeUint32ToTagged(compiler::Node* value); |
433 | 438 |
434 // Type conversions. | 439 // Type conversions. |
435 // Throws a TypeError for {method_name} if {value} is not coercible to Object, | 440 // Throws a TypeError for {method_name} if {value} is not coercible to Object, |
436 // or returns the {value} converted to a String otherwise. | 441 // or returns the {value} converted to a String otherwise. |
437 compiler::Node* ToThisString(compiler::Node* context, compiler::Node* value, | 442 compiler::Node* ToThisString(compiler::Node* context, compiler::Node* value, |
438 char const* method_name); | 443 char const* method_name); |
439 // Throws a TypeError for {method_name} if {value} is neither of the given | 444 // Throws a TypeError for {method_name} if {value} is neither of the given |
440 // {primitive_type} nor a JSValue wrapping a value of {primitive_type}, or | 445 // {primitive_type} nor a JSValue wrapping a value of {primitive_type}, or |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 Label* bailout); | 840 Label* bailout); |
836 | 841 |
837 static const int kElementLoopUnrollThreshold = 8; | 842 static const int kElementLoopUnrollThreshold = 8; |
838 }; | 843 }; |
839 | 844 |
840 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); | 845 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); |
841 | 846 |
842 } // namespace internal | 847 } // namespace internal |
843 } // namespace v8 | 848 } // namespace v8 |
844 #endif // V8_CODE_STUB_ASSEMBLER_H_ | 849 #endif // V8_CODE_STUB_ASSEMBLER_H_ |
OLD | NEW |