Index: src/code-stub-assembler.h |
diff --git a/src/code-stub-assembler.h b/src/code-stub-assembler.h |
index f29701020791ffe5f67d9099c2236a2b4836d204..a3460f797e5385cfe76e29f55449a478f48181c1 100644 |
--- a/src/code-stub-assembler.h |
+++ b/src/code-stub-assembler.h |
@@ -17,6 +17,8 @@ class CallInterfaceDescriptor; |
class StatsCounter; |
class StubCache; |
+enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol }; |
+ |
// Provides JavaScript-specific "macro-assembler" functionality on top of the |
// CodeAssembler. By factoring the JavaScript-isms out of the CodeAssembler, |
// it's possible to add JavaScript-specific useful CodeAssembler "macros" |
@@ -251,6 +253,12 @@ class CodeStubAssembler : public compiler::CodeAssembler { |
// or returns the {value} converted to a String otherwise. |
compiler::Node* ToThisString(compiler::Node* context, compiler::Node* value, |
char const* method_name); |
+ // Throws a TypeError for {method_name} if {value} is neither of the given |
+ // {primitive_type} nor a JSValue wrapping a value of {primitive_type}, or |
+ // returns the {value} (or wrapped value) otherwise. |
+ compiler::Node* ToThisValue(compiler::Node* context, compiler::Node* value, |
+ PrimitiveType primitive_type, |
+ char const* method_name); |
// String helpers. |
// Load a character from a String (might flatten a ConsString). |