summaryrefslogtreecommitdiff
path: root/deps/v8/src/objects-printer.cc
diff options
context:
space:
mode:
authorMichaƫl Zasso <targos@protonmail.com>2018-01-24 20:16:06 +0100
committerMyles Borins <mylesborins@google.com>2018-01-24 15:02:20 -0800
commit4c4af643e5042d615a60c6bbc05aee9d81b903e5 (patch)
tree3fb0a97988fe4439ae3ae06f26915d1dcf8cab92 /deps/v8/src/objects-printer.cc
parentfa9f31a4fda5a3782c652e56e394465805ebb50f (diff)
downloadandroid-node-v8-4c4af643e5042d615a60c6bbc05aee9d81b903e5.tar.gz
android-node-v8-4c4af643e5042d615a60c6bbc05aee9d81b903e5.tar.bz2
android-node-v8-4c4af643e5042d615a60c6bbc05aee9d81b903e5.zip
deps: update V8 to 6.4.388.40
PR-URL: https://github.com/nodejs/node/pull/17489 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Diffstat (limited to 'deps/v8/src/objects-printer.cc')
-rw-r--r--deps/v8/src/objects-printer.cc271
1 files changed, 167 insertions, 104 deletions
diff --git a/deps/v8/src/objects-printer.cc b/deps/v8/src/objects-printer.cc
index 33928a5aa7..2ac24f823d 100644
--- a/deps/v8/src/objects-printer.cc
+++ b/deps/v8/src/objects-printer.cc
@@ -16,6 +16,7 @@
#include "src/ostreams.h"
#include "src/regexp/jsregexp.h"
#include "src/transitions-inl.h"
+#include "src/wasm/wasm-objects-inl.h"
namespace v8 {
namespace internal {
@@ -97,6 +98,9 @@ void HeapObject::HeapObjectPrint(std::ostream& os) { // NOLINT
case BYTECODE_ARRAY_TYPE:
BytecodeArray::cast(this)->BytecodeArrayPrint(os);
break;
+ case DESCRIPTOR_ARRAY_TYPE:
+ DescriptorArray::cast(this)->PrintDescriptors(os);
+ break;
case TRANSITION_ARRAY_TYPE:
TransitionArray::cast(this)->TransitionArrayPrint(os);
break;
@@ -171,6 +175,9 @@ void HeapObject::HeapObjectPrint(std::ostream& os) { // NOLINT
case CODE_TYPE:
Code::cast(this)->CodePrint(os);
break;
+ case CODE_DATA_CONTAINER_TYPE:
+ CodeDataContainer::cast(this)->CodeDataContainerPrint(os);
+ break;
case JS_PROXY_TYPE:
JSProxy::cast(this)->JSProxyPrint(os);
break;
@@ -382,7 +389,7 @@ void PrintFixedArrayElements(std::ostream& os, T* array) {
void PrintDictionaryElements(std::ostream& os, FixedArrayBase* elements) {
// Print some internal fields
- SeededNumberDictionary* dict = SeededNumberDictionary::cast(elements);
+ NumberDictionary* dict = NumberDictionary::cast(elements);
if (dict->requires_slow_elements()) {
os << "\n - requires_slow_elements";
} else {
@@ -487,6 +494,10 @@ static void JSObjectPrintHeader(std::ostream& os, JSObject* obj,
<< ElementsKindToString(obj->map()->elements_kind());
if (obj->elements()->IsCowArray()) os << " (COW)";
os << "]";
+ Object* hash = obj->GetHash();
+ if (hash->IsSmi()) {
+ os << "\n - hash = " << Brief(hash);
+ }
if (obj->GetEmbedderFieldCount() > 0) {
os << "\n - embedder fields: " << obj->GetEmbedderFieldCount();
}
@@ -569,7 +580,7 @@ void Map::MapPrint(std::ostream& os) { // NOLINT
os << "\n - inobject properties: " << GetInObjectProperties();
}
os << "\n - elements kind: " << ElementsKindToString(elements_kind());
- os << "\n - unused property fields: " << unused_property_fields();
+ os << "\n - unused property fields: " << UnusedPropertyFields();
os << "\n - enum length: ";
if (EnumLength() == kInvalidEnumCacheSentinel) {
os << "invalid";
@@ -587,6 +598,10 @@ void Map::MapPrint(std::ostream& os) { // NOLINT
if (is_undetectable()) os << "\n - undetectable";
if (is_callable()) os << "\n - callable";
if (is_constructor()) os << "\n - constructor";
+ if (has_prototype_slot()) {
+ os << "\n - has_prototype_slot";
+ if (has_non_instance_prototype()) os << " (non-instance prototype)";
+ }
if (is_access_check_needed()) os << "\n - access_check_needed";
if (!is_extensible()) os << "\n - non-extensible";
if (is_prototype_map()) {
@@ -742,74 +757,8 @@ void FeedbackVector::FeedbackVectorPrint(std::ostream& os) { // NOLINT
FeedbackSlot slot = iter.Next();
FeedbackSlotKind kind = iter.kind();
- os << "\n Slot " << slot << " " << kind;
- os << " ";
- switch (kind) {
- case FeedbackSlotKind::kLoadProperty: {
- LoadICNexus nexus(this, slot);
- os << Code::ICState2String(nexus.StateFromFeedback());
- break;
- }
- case FeedbackSlotKind::kLoadGlobalInsideTypeof:
- case FeedbackSlotKind::kLoadGlobalNotInsideTypeof: {
- LoadGlobalICNexus nexus(this, slot);
- os << Code::ICState2String(nexus.StateFromFeedback());
- break;
- }
- case FeedbackSlotKind::kLoadKeyed: {
- KeyedLoadICNexus nexus(this, slot);
- os << Code::ICState2String(nexus.StateFromFeedback());
- break;
- }
- case FeedbackSlotKind::kCall: {
- CallICNexus nexus(this, slot);
- os << Code::ICState2String(nexus.StateFromFeedback());
- break;
- }
- case FeedbackSlotKind::kStoreNamedSloppy:
- case FeedbackSlotKind::kStoreNamedStrict:
- case FeedbackSlotKind::kStoreOwnNamed:
- case FeedbackSlotKind::kStoreGlobalSloppy:
- case FeedbackSlotKind::kStoreGlobalStrict: {
- StoreICNexus nexus(this, slot);
- os << Code::ICState2String(nexus.StateFromFeedback());
- break;
- }
- case FeedbackSlotKind::kStoreKeyedSloppy:
- case FeedbackSlotKind::kStoreKeyedStrict: {
- KeyedStoreICNexus nexus(this, slot);
- os << Code::ICState2String(nexus.StateFromFeedback());
- break;
- }
- case FeedbackSlotKind::kBinaryOp: {
- BinaryOpICNexus nexus(this, slot);
- os << Code::ICState2String(nexus.StateFromFeedback());
- break;
- }
- case FeedbackSlotKind::kCompareOp: {
- CompareICNexus nexus(this, slot);
- os << Code::ICState2String(nexus.StateFromFeedback());
- break;
- }
- case FeedbackSlotKind::kForIn: {
- ForInICNexus nexus(this, slot);
- os << Code::ICState2String(nexus.StateFromFeedback());
- break;
- }
- case FeedbackSlotKind::kStoreDataPropertyInLiteral: {
- StoreDataPropertyInLiteralICNexus nexus(this, slot);
- os << Code::ICState2String(nexus.StateFromFeedback());
- break;
- }
- case FeedbackSlotKind::kCreateClosure:
- case FeedbackSlotKind::kLiteral:
- case FeedbackSlotKind::kTypeProfile:
- break;
- case FeedbackSlotKind::kInvalid:
- case FeedbackSlotKind::kKindsNumber:
- UNREACHABLE();
- break;
- }
+ os << "\n Slot " << slot << " " << kind << " ";
+ FeedbackSlotPrint(os, slot, kind);
int entry_size = iter.entry_size();
for (int i = 0; i < entry_size; i++) {
@@ -820,6 +769,85 @@ void FeedbackVector::FeedbackVectorPrint(std::ostream& os) { // NOLINT
os << "\n";
}
+void FeedbackVector::FeedbackSlotPrint(std::ostream& os,
+ FeedbackSlot slot) { // NOLINT
+ FeedbackSlotPrint(os, slot, GetKind(slot));
+}
+
+void FeedbackVector::FeedbackSlotPrint(std::ostream& os, FeedbackSlot slot,
+ FeedbackSlotKind kind) { // NOLINT
+ switch (kind) {
+ case FeedbackSlotKind::kLoadProperty: {
+ LoadICNexus nexus(this, slot);
+ os << Code::ICState2String(nexus.StateFromFeedback());
+ break;
+ }
+ case FeedbackSlotKind::kLoadGlobalInsideTypeof:
+ case FeedbackSlotKind::kLoadGlobalNotInsideTypeof: {
+ LoadGlobalICNexus nexus(this, slot);
+ os << Code::ICState2String(nexus.StateFromFeedback());
+ break;
+ }
+ case FeedbackSlotKind::kLoadKeyed: {
+ KeyedLoadICNexus nexus(this, slot);
+ os << Code::ICState2String(nexus.StateFromFeedback());
+ break;
+ }
+ case FeedbackSlotKind::kCall: {
+ CallICNexus nexus(this, slot);
+ os << Code::ICState2String(nexus.StateFromFeedback());
+ break;
+ }
+ case FeedbackSlotKind::kStoreNamedSloppy:
+ case FeedbackSlotKind::kStoreNamedStrict:
+ case FeedbackSlotKind::kStoreOwnNamed:
+ case FeedbackSlotKind::kStoreGlobalSloppy:
+ case FeedbackSlotKind::kStoreGlobalStrict: {
+ StoreICNexus nexus(this, slot);
+ os << Code::ICState2String(nexus.StateFromFeedback());
+ break;
+ }
+ case FeedbackSlotKind::kStoreKeyedSloppy:
+ case FeedbackSlotKind::kStoreKeyedStrict: {
+ KeyedStoreICNexus nexus(this, slot);
+ os << Code::ICState2String(nexus.StateFromFeedback());
+ break;
+ }
+ case FeedbackSlotKind::kBinaryOp: {
+ BinaryOpICNexus nexus(this, slot);
+ os << "BinaryOp:" << nexus.GetBinaryOperationFeedback();
+ break;
+ }
+ case FeedbackSlotKind::kCompareOp: {
+ CompareICNexus nexus(this, slot);
+ os << "CompareOp:" << nexus.GetCompareOperationFeedback();
+ break;
+ }
+ case FeedbackSlotKind::kForIn: {
+ ForInICNexus nexus(this, slot);
+ os << "ForIn:" << nexus.GetForInFeedback();
+ break;
+ }
+ case FeedbackSlotKind::kInstanceOf: {
+ InstanceOfICNexus nexus(this, slot);
+ os << Code::ICState2String(nexus.StateFromFeedback());
+ break;
+ }
+ case FeedbackSlotKind::kStoreDataPropertyInLiteral: {
+ StoreDataPropertyInLiteralICNexus nexus(this, slot);
+ os << Code::ICState2String(nexus.StateFromFeedback());
+ break;
+ }
+ case FeedbackSlotKind::kCreateClosure:
+ case FeedbackSlotKind::kLiteral:
+ case FeedbackSlotKind::kTypeProfile:
+ break;
+ case FeedbackSlotKind::kInvalid:
+ case FeedbackSlotKind::kKindsNumber:
+ UNREACHABLE();
+ break;
+ }
+}
void JSValue::JSValuePrint(std::ostream& os) { // NOLINT
JSObjectPrintHeader(os, this, "JSValue");
@@ -915,8 +943,6 @@ void JSProxy::JSProxyPrint(std::ostream& os) { // NOLINT
target()->ShortPrint(os);
os << "\n - handler = ";
handler()->ShortPrint(os);
- os << "\n - hash = ";
- hash()->ShortPrint(os);
os << "\n";
}
@@ -1062,8 +1088,19 @@ std::ostream& operator<<(std::ostream& os, FunctionKind kind) {
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 - function prototype = ";
+ if (has_prototype_slot()) {
+ if (has_prototype()) {
+ os << Brief(prototype());
+ if (map()->has_non_instance_prototype()) {
+ os << " (non-instance prototype)";
+ }
+ }
+ os << "\n - initial_map = ";
+ if (has_initial_map()) os << Brief(initial_map());
+ } else {
+ os << "<no-prototype-slot>";
+ }
os << "\n - shared_info = " << Brief(shared());
os << "\n - name = " << Brief(shared()->name());
os << "\n - formal_parameter_count = "
@@ -1077,6 +1114,14 @@ void JSFunction::JSFunctionPrint(std::ostream& os) { // NOLINT
os << "\n - bytecode = " << shared()->bytecode_array();
}
}
+ if (WasmExportedFunction::IsWasmExportedFunction(this)) {
+ WasmExportedFunction* function = WasmExportedFunction::cast(this);
+ os << "\n - WASM instance "
+ << reinterpret_cast<void*>(function->instance());
+ os << "\n context "
+ << reinterpret_cast<void*>(function->instance()->wasm_context()->get());
+ os << "\n - WASM function index " << function->function_index();
+ }
shared()->PrintSourceCode(os);
JSObjectPrintBody(os, this);
os << "\n - feedback vector: ";
@@ -1094,7 +1139,7 @@ void SharedFunctionInfo::PrintSourceCode(std::ostream& os) {
int start = start_position();
int length = end_position() - start;
std::unique_ptr<char[]> source_string = source->ToCString(
- DISALLOW_NULLS, FAST_STRING_TRAVERSAL, start, length, NULL);
+ DISALLOW_NULLS, FAST_STRING_TRAVERSAL, start, length, nullptr);
os << source_string.get();
}
}
@@ -1108,6 +1153,9 @@ void SharedFunctionInfo::SharedFunctionInfoPrint(std::ostream& os) { // NOLINT
os << "<no-shared-name>";
}
os << "\n - kind = " << kind();
+ if (needs_home_object()) {
+ os << "\n - needs_home_object";
+ }
os << "\n - function_map_index = " << function_map_index();
os << "\n - formal_parameter_count = " << internal_formal_parameter_count();
os << "\n - expected_nof_properties = " << expected_nof_properties();
@@ -1157,7 +1205,6 @@ void JSGlobalProxy::JSGlobalProxyPrint(std::ostream& os) { // NOLINT
if (!GetIsolate()->bootstrapper()->IsActive()) {
os << "\n - native context = " << Brief(native_context());
}
- os << "\n - hash = " << Brief(hash());
JSObjectPrintBody(os, this);
}
@@ -1246,11 +1293,16 @@ void Code::CodePrint(std::ostream& os) { // NOLINT
os << "\n";
#ifdef ENABLE_DISASSEMBLER
if (FLAG_use_verbose_printer) {
- Disassemble(NULL, os);
+ Disassemble(nullptr, os);
}
#endif
}
+void CodeDataContainer::CodeDataContainerPrint(std::ostream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "CodeDataContainer");
+ os << "\n - kind_specific_flags: " << kind_specific_flags();
+ os << "\n";
+}
void Foreign::ForeignPrint(std::ostream& os) { // NOLINT
os << "foreign address : " << reinterpret_cast<void*>(foreign_address());
@@ -1261,7 +1313,7 @@ void Foreign::ForeignPrint(std::ostream& os) { // NOLINT
void AccessorInfo::AccessorInfoPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "AccessorInfo");
os << "\n - name: " << Brief(name());
- os << "\n - flag: " << flag();
+ os << "\n - flags: " << flags();
os << "\n - getter: " << Brief(getter());
os << "\n - setter: " << Brief(setter());
os << "\n - js_getter: " << Brief(js_getter());
@@ -1340,6 +1392,7 @@ void Module::ModulePrint(std::ostream& os) { // NOLINT
os << "\n - exports: " << Brief(exports());
os << "\n - requested_modules: " << Brief(requested_modules());
os << "\n - script: " << Brief(script());
+ os << "\n - import_meta: " << Brief(import_meta());
os << "\n - status: " << status();
os << "\n - exception: " << Brief(exception());
os << "\n";
@@ -1358,6 +1411,7 @@ void PrototypeInfo::PrototypeInfoPrint(std::ostream& os) { // NOLINT
os << "\n - registry slot: " << registry_slot();
os << "\n - validity cell: " << Brief(validity_cell());
os << "\n - object create map: " << Brief(object_create_map());
+ os << "\n - should_be_fast_map: " << should_be_fast_map();
os << "\n";
}
@@ -1584,8 +1638,7 @@ void PreParsedScopeData::PreParsedScopeDataPrint(std::ostream& os) { // NOLINT
#endif // OBJECT_PRINT
-#if V8_TRACE_MAPS
-
+// TODO(cbruni): remove once the new maptracer is in place.
void Name::NameShortPrint() {
if (this->IsString()) {
PrintF("%s", String::cast(this)->ToCString().get());
@@ -1600,7 +1653,7 @@ void Name::NameShortPrint() {
}
}
-
+// TODO(cbruni): remove once the new maptracer is in place.
int Name::NameShortPrint(Vector<char> str) {
if (this->IsString()) {
return SNPrintF(str, "%s", String::cast(this)->ToCString().get());
@@ -1615,31 +1668,20 @@ int Name::NameShortPrint(Vector<char> str) {
}
}
-#endif // V8_TRACE_MAPS
-
-#if defined(DEBUG) || defined(OBJECT_PRINT)
-// This method is only meant to be called from gdb for debugging purposes.
-// Since the string can also be in two-byte encoding, non-Latin1 characters
-// will be ignored in the output.
-char* String::ToAsciiArray() {
- // Static so that subsequent calls frees previously allocated space.
- // This also means that previous results will be overwritten.
- static char* buffer = NULL;
- if (buffer != NULL) delete[] buffer;
- buffer = new char[length() + 1];
- WriteToFlat(this, reinterpret_cast<uint8_t*>(buffer), 0, length());
- buffer[length()] = 0;
- return buffer;
-}
-
-
-void DescriptorArray::Print() {
- OFStream os(stdout);
- this->PrintDescriptors(os);
- os << std::flush;
+void Map::PrintMapDetails(std::ostream& os, JSObject* holder) {
+ DisallowHeapAllocation no_gc;
+#ifdef OBJECT_PRINT
+ this->MapPrint(os);
+#else
+ os << "Map=" << reinterpret_cast<void*>(this);
+#endif
+ os << "\n";
+ instance_descriptors()->PrintDescriptors(os);
+ if (is_dictionary_map() && holder != nullptr) {
+ os << holder->property_dictionary() << "\n";
+ }
}
-
void DescriptorArray::PrintDescriptors(std::ostream& os) { // NOLINT
HandleScope scope(GetIsolate());
os << "Descriptor array #" << number_of_descriptors() << ":";
@@ -1680,6 +1722,26 @@ void DescriptorArray::PrintDescriptorDetails(std::ostream& os, int descriptor,
}
}
+#if defined(DEBUG) || defined(OBJECT_PRINT)
+// This method is only meant to be called from gdb for debugging purposes.
+// Since the string can also be in two-byte encoding, non-Latin1 characters
+// will be ignored in the output.
+char* String::ToAsciiArray() {
+ // Static so that subsequent calls frees previously allocated space.
+ // This also means that previous results will be overwritten.
+ static char* buffer = nullptr;
+ if (buffer != nullptr) delete[] buffer;
+ buffer = new char[length() + 1];
+ WriteToFlat(this, reinterpret_cast<uint8_t*>(buffer), 0, length());
+ buffer[length()] = 0;
+ return buffer;
+}
+
+void DescriptorArray::Print() {
+ OFStream os(stdout);
+ this->PrintDescriptors(os);
+ os << std::flush;
+}
// static
void TransitionsAccessor::PrintOneTransition(std::ostream& os, Name* key,
Map* target, Object* raw_target) {
@@ -1722,6 +1784,7 @@ void TransitionArray::Print() {
Print(os);
}
+// TODO(ishell): unify with TransitionArrayPrint().
void TransitionArray::Print(std::ostream& os) {
int num_transitions = number_of_transitions();
os << "Transition array #" << num_transitions << ":";