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 }; | |
21 | |
22 // Provides JavaScript-specific "macro-assembler" functionality on top of the | 20 // Provides JavaScript-specific "macro-assembler" functionality on top of the |
23 // CodeAssembler. By factoring the JavaScript-isms out of the CodeAssembler, | 21 // CodeAssembler. By factoring the JavaScript-isms out of the CodeAssembler, |
24 // it's possible to add JavaScript-specific useful CodeAssembler "macros" | 22 // it's possible to add JavaScript-specific useful CodeAssembler "macros" |
25 // without modifying files in the compiler directory (and requiring a review | 23 // without modifying files in the compiler directory (and requiring a review |
26 // from a compiler directory OWNER). | 24 // from a compiler directory OWNER). |
27 class CodeStubAssembler : public compiler::CodeAssembler { | 25 class CodeStubAssembler : public compiler::CodeAssembler { |
28 public: | 26 public: |
29 // Create with CallStub linkage. | 27 // Create with CallStub linkage. |
30 // |result_size| specifies the number of results returned by the stub. | 28 // |result_size| specifies the number of results returned by the stub. |
31 // TODO(rmcilroy): move result_size to the CallInterfaceDescriptor. | 29 // TODO(rmcilroy): move result_size to the CallInterfaceDescriptor. |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 // Conversions. | 244 // Conversions. |
247 compiler::Node* ChangeFloat64ToTagged(compiler::Node* value); | 245 compiler::Node* ChangeFloat64ToTagged(compiler::Node* value); |
248 compiler::Node* ChangeInt32ToTagged(compiler::Node* value); | 246 compiler::Node* ChangeInt32ToTagged(compiler::Node* value); |
249 compiler::Node* ChangeUint32ToTagged(compiler::Node* value); | 247 compiler::Node* ChangeUint32ToTagged(compiler::Node* value); |
250 | 248 |
251 // Type conversions. | 249 // Type conversions. |
252 // Throws a TypeError for {method_name} if {value} is not coercible to Object, | 250 // Throws a TypeError for {method_name} if {value} is not coercible to Object, |
253 // or returns the {value} converted to a String otherwise. | 251 // or returns the {value} converted to a String otherwise. |
254 compiler::Node* ToThisString(compiler::Node* context, compiler::Node* value, | 252 compiler::Node* ToThisString(compiler::Node* context, compiler::Node* value, |
255 char const* method_name); | 253 char const* method_name); |
256 // Throws a TypeError for {method_name} if {value} is neither of the given | |
257 // {primitive_type} nor a JSValue wrapping a value of {primitive_type}, or | |
258 // returns the {value} (or wrapped value) otherwise. | |
259 compiler::Node* ToThisValue(compiler::Node* context, compiler::Node* value, | |
260 PrimitiveType primitive_type, | |
261 char const* method_name); | |
262 | 254 |
263 // String helpers. | 255 // String helpers. |
264 // Load a character from a String (might flatten a ConsString). | 256 // Load a character from a String (might flatten a ConsString). |
265 compiler::Node* StringCharCodeAt(compiler::Node* string, | 257 compiler::Node* StringCharCodeAt(compiler::Node* string, |
266 compiler::Node* smi_index); | 258 compiler::Node* smi_index); |
267 // Return the single character string with only {code}. | 259 // Return the single character string with only {code}. |
268 compiler::Node* StringFromCharCode(compiler::Node* code); | 260 compiler::Node* StringFromCharCode(compiler::Node* code); |
269 | 261 |
270 // Returns a node that is true if the given bit is set in |word32|. | 262 // Returns a node that is true if the given bit is set in |word32|. |
271 template <typename T> | 263 template <typename T> |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 AllocationFlags flags, | 462 AllocationFlags flags, |
471 compiler::Node* top_adddress, | 463 compiler::Node* top_adddress, |
472 compiler::Node* limit_address); | 464 compiler::Node* limit_address); |
473 | 465 |
474 static const int kElementLoopUnrollThreshold = 8; | 466 static const int kElementLoopUnrollThreshold = 8; |
475 }; | 467 }; |
476 | 468 |
477 } // namespace internal | 469 } // namespace internal |
478 } // namespace v8 | 470 } // namespace v8 |
479 #endif // V8_CODE_STUB_ASSEMBLER_H_ | 471 #endif // V8_CODE_STUB_ASSEMBLER_H_ |
OLD | NEW |