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