Commit 0fa79982 authored by Camillo Bruni's avatar Camillo Bruni Committed by Commit Bot

[printing] Improve JSFunction printing

Change-Id: Ia209def2faef1f765f74dc153fd8b4800c25be17
Reviewed-on: https://chromium-review.googlesource.com/521063
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Reviewed-by: 's avatarMythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45969}
parent cbf5738a
......@@ -2873,7 +2873,7 @@ IGNITION_HANDLER(CreateObjectLiteral, InterpreterAssembler) {
{
// If we can't do a fast clone, call into the runtime.
Node* index = BytecodeOperandIdx(0);
Node* constant_elements = LoadConstantPoolEntry(index);
Node* boilerplate_description = LoadConstantPoolEntry(index);
Node* context = GetContext();
Node* flags_raw = DecodeWordFromWord32<CreateObjectLiteralFlags::FlagsBits>(
......@@ -2881,7 +2881,7 @@ IGNITION_HANDLER(CreateObjectLiteral, InterpreterAssembler) {
Node* flags = SmiTag(flags_raw);
Node* result = CallRuntime(Runtime::kCreateObjectLiteral, context, closure,
literal_index, constant_elements, flags);
literal_index, boilerplate_description, flags);
StoreRegister(result, BytecodeOperandReg(3));
// TODO(klaasb) build a single dispatch once the call is inlined
Dispatch();
......
......@@ -1022,25 +1022,6 @@ void JSBoundFunction::JSBoundFunctionPrint(std::ostream& os) { // NOLINT
}
void JSFunction::JSFunctionPrint(std::ostream& os) { // NOLINT
JSObjectPrintHeader(os, this, "Function");
os << "\n - initial_map = ";
if (has_initial_map()) os << Brief(initial_map());
os << "\n - shared_info = " << Brief(shared());
os << "\n - name = " << Brief(shared()->name());
os << "\n - formal_parameter_count = "
<< shared()->internal_formal_parameter_count();
if (IsGeneratorFunction(shared()->kind())) {
os << "\n - generator";
} else if (IsAsyncFunction(shared()->kind())) {
os << "\n - async";
}
os << "\n - context = " << Brief(context());
os << "\n - feedback vector cell = " << Brief(feedback_vector_cell());
os << "\n - code = " << Brief(code());
JSObjectPrintBody(os, this);
}
namespace {
std::ostream& operator<<(std::ostream& os, FunctionKind kind) {
......@@ -1070,6 +1051,27 @@ std::ostream& operator<<(std::ostream& os, FunctionKind kind) {
} // namespace
void JSFunction::JSFunctionPrint(std::ostream& os) { // NOLINT
JSObjectPrintHeader(os, this, "Function");
os << "\n - initial_map = ";
if (has_initial_map()) os << Brief(initial_map());
os << "\n - shared_info = " << Brief(shared());
os << "\n - name = " << Brief(shared()->name());
os << "\n - formal_parameter_count = "
<< shared()->internal_formal_parameter_count();
os << "\n - kind = " << shared()->kind();
os << "\n - context = " << Brief(context());
os << "\n - feedback vector cell = " << Brief(feedback_vector_cell());
os << "\n - code = " << Brief(code());
if (IsInterpreted()) {
os << "\n - interpreted";
if (shared()->HasBytecodeArray()) {
os << "\n - bytecode = " << shared()->bytecode_array();
}
}
JSObjectPrintBody(os, this);
}
void SharedFunctionInfo::SharedFunctionInfoPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "SharedFunctionInfo");
os << "\n - name = ";
......@@ -1086,6 +1088,9 @@ void SharedFunctionInfo::SharedFunctionInfoPrint(std::ostream& os) { // NOLINT
os << "\n - instance class name = ";
instance_class_name()->Print(os);
os << "\n - code = " << Brief(code());
if (HasBytecodeArray()) {
os << "\n - bytecode_array = " << bytecode_array();
}
if (HasSourceCode()) {
os << "\n - source code = ";
String* source = String::cast(Script::cast(script())->source());
......@@ -1116,9 +1121,6 @@ void SharedFunctionInfo::SharedFunctionInfoPrint(std::ostream& os) { // NOLINT
os << "\n - length = " << length();
os << "\n - feedback_metadata = ";
feedback_metadata()->FeedbackMetadataPrint(os);
if (HasBytecodeArray()) {
os << "\n - bytecode_array = " << bytecode_array();
}
os << "\n";
}
......
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