Index: src/code-stub-assembler.h |
diff --git a/src/code-stub-assembler.h b/src/code-stub-assembler.h |
index a5a70c10f80908257ab09e2cf29326a24ea5873e..7359ec51bbc1b981de95abb946ef5e9c903a2ebd 100644 |
--- a/src/code-stub-assembler.h |
+++ b/src/code-stub-assembler.h |
@@ -1137,6 +1137,31 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { |
// Debug helpers |
Node* IsDebugActive(); |
+ // Useful tools for PrintF-style debugging CSA builtins. |
+ void ReleasePrint(const char* c_str) { |
+ std::string std_str(c_str); |
+ std_str += '\n'; |
+ Handle<String> str = |
+ factory()->NewStringFromAsciiChecked(std_str.c_str(), TENURED); |
+ CallRuntime(Runtime::kGlobalPrint, NoContextConstant(), HeapConstant(str)); |
+ } |
+ |
+ void ReleaseDebugPrint(Node* object) { |
+ CallRuntime(Runtime::kDebugPrint, NoContextConstant(), object); |
+ } |
+ |
+ void Print(const char* c_str) { |
+#ifdef DEBUG |
+ ReleasePrint(c_str); |
+#endif |
+ } |
+ |
+ void DebugPrint(Node* object) { |
+#ifdef DEBUG |
+ ReleaseDebugPrint(object); |
+#endif |
+ } |
+ |
// TypedArray/ArrayBuffer helpers |
Node* IsDetachedBuffer(Node* buffer); |