Commit 8b78db70 authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[printing] Print SharedFunctionInfo's kind and language mode.

BUG=

Change-Id: I7efa4df72c6860120e3e9c090fcd666737b43749
Reviewed-on: https://chromium-review.googlesource.com/444786
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#43286}
parent a85f27d8
...@@ -1003,12 +1003,42 @@ void JSFunction::JSFunctionPrint(std::ostream& os) { // NOLINT ...@@ -1003,12 +1003,42 @@ void JSFunction::JSFunctionPrint(std::ostream& os) { // NOLINT
JSObjectPrintBody(os, this); JSObjectPrintBody(os, this);
} }
namespace {
std::ostream& operator<<(std::ostream& os, FunctionKind kind) {
os << "[";
if (kind == FunctionKind::kNormalFunction) {
os << " NormalFunction";
} else {
#define PRINT_FLAG(name) \
if (static_cast<int>(kind) & static_cast<int>(FunctionKind::k##name)) { \
os << " " << #name; \
}
PRINT_FLAG(ArrowFunction)
PRINT_FLAG(GeneratorFunction)
PRINT_FLAG(ConciseMethod)
PRINT_FLAG(DefaultConstructor)
PRINT_FLAG(DerivedConstructor)
PRINT_FLAG(BaseConstructor)
PRINT_FLAG(GetterFunction)
PRINT_FLAG(SetterFunction)
PRINT_FLAG(AsyncFunction)
PRINT_FLAG(Module)
#undef PRINT_FLAG
}
return os << " ]";
}
} // namespace
void SharedFunctionInfo::SharedFunctionInfoPrint(std::ostream& os) { // NOLINT void SharedFunctionInfo::SharedFunctionInfoPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "SharedFunctionInfo"); HeapObject::PrintHeader(os, "SharedFunctionInfo");
os << "\n - name = " << Brief(name()); os << "\n - name = " << Brief(name());
os << "\n - kind = " << kind();
os << "\n - formal_parameter_count = " << internal_formal_parameter_count(); os << "\n - formal_parameter_count = " << internal_formal_parameter_count();
os << "\n - expected_nof_properties = " << expected_nof_properties(); os << "\n - expected_nof_properties = " << expected_nof_properties();
os << "\n - language_mode = " << language_mode();
os << "\n - ast_node_count = " << ast_node_count(); os << "\n - ast_node_count = " << ast_node_count();
os << "\n - instance class name = "; os << "\n - instance class name = ";
instance_class_name()->Print(os); instance_class_name()->Print(os);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment