Upgrade V8 to version 4.9.385.28
https://chromium.googlesource.com/v8/v8/+/4.9.385.28
FPIIM-449
Change-Id: I4b2e74289d4bf3667f2f3dc8aa2e541f63e26eb4
diff --git a/src/objects-printer.cc b/src/objects-printer.cc
index 9805490..db71650 100644
--- a/src/objects-printer.cc
+++ b/src/objects-printer.cc
@@ -2,13 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "src/v8.h"
+#include "src/objects.h"
#include "src/disasm.h"
#include "src/disassembler.h"
-#include "src/heap/objects-visiting.h"
-#include "src/jsregexp.h"
+#include "src/interpreter/bytecodes.h"
+#include "src/objects-inl.h"
#include "src/ostreams.h"
+#include "src/regexp/jsregexp.h"
namespace v8 {
namespace internal {
@@ -32,7 +33,7 @@
void HeapObject::PrintHeader(std::ostream& os, const char* id) { // NOLINT
- os << "" << reinterpret_cast<void*>(this) << ": [" << id << "]\n";
+ os << reinterpret_cast<void*>(this) << ": [" << id << "]\n";
}
@@ -60,30 +61,28 @@
HeapNumber::cast(this)->HeapNumberPrint(os);
os << ">";
break;
+ case SIMD128_VALUE_TYPE:
+ Simd128Value::cast(this)->Simd128ValuePrint(os);
+ break;
case FIXED_DOUBLE_ARRAY_TYPE:
FixedDoubleArray::cast(this)->FixedDoubleArrayPrint(os);
break;
- case CONSTANT_POOL_ARRAY_TYPE:
- ConstantPoolArray::cast(this)->ConstantPoolArrayPrint(os);
- break;
case FIXED_ARRAY_TYPE:
FixedArray::cast(this)->FixedArrayPrint(os);
break;
case BYTE_ARRAY_TYPE:
ByteArray::cast(this)->ByteArrayPrint(os);
break;
+ case BYTECODE_ARRAY_TYPE:
+ BytecodeArray::cast(this)->BytecodeArrayPrint(os);
+ break;
+ case TRANSITION_ARRAY_TYPE:
+ TransitionArray::cast(this)->TransitionArrayPrint(os);
+ break;
case FREE_SPACE_TYPE:
FreeSpace::cast(this)->FreeSpacePrint(os);
break;
-#define PRINT_EXTERNAL_ARRAY(Type, type, TYPE, ctype, size) \
- case EXTERNAL_##TYPE##_ARRAY_TYPE: \
- External##Type##Array::cast(this)->External##Type##ArrayPrint(os); \
- break;
-
- TYPED_ARRAYS(PRINT_EXTERNAL_ARRAY)
-#undef PRINT_EXTERNAL_ARRAY
-
#define PRINT_FIXED_TYPED_ARRAY(Type, type, TYPE, ctype, size) \
case Fixed##Type##Array::kInstanceType: \
Fixed##Type##Array::cast(this)->FixedTypedArrayPrint(os); \
@@ -99,15 +98,21 @@
case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
case JS_ARRAY_TYPE:
case JS_GENERATOR_OBJECT_TYPE:
- case JS_REGEXP_TYPE:
+ case JS_PROMISE_TYPE:
JSObject::cast(this)->JSObjectPrint(os);
break;
+ case JS_REGEXP_TYPE:
+ JSRegExp::cast(this)->JSRegExpPrint(os);
+ break;
case ODDBALL_TYPE:
Oddball::cast(this)->to_string()->Print(os);
break;
case JS_MODULE_TYPE:
JSModule::cast(this)->JSModulePrint(os);
break;
+ case JS_BOUND_FUNCTION_TYPE:
+ JSBoundFunction::cast(this)->JSBoundFunctionPrint(os);
+ break;
case JS_FUNCTION_TYPE:
JSFunction::cast(this)->JSFunctionPrint(os);
break;
@@ -117,12 +122,8 @@
case JS_GLOBAL_OBJECT_TYPE:
JSGlobalObject::cast(this)->JSGlobalObjectPrint(os);
break;
- case JS_BUILTINS_OBJECT_TYPE:
- JSBuiltinsObject::cast(this)->JSBuiltinsObjectPrint(os);
- break;
case JS_VALUE_TYPE:
- os << "Value wrapper around:";
- JSValue::cast(this)->value()->Print(os);
+ JSValue::cast(this)->JSValuePrint(os);
break;
case JS_DATE_TYPE:
JSDate::cast(this)->JSDatePrint(os);
@@ -133,9 +134,6 @@
case JS_PROXY_TYPE:
JSProxy::cast(this)->JSProxyPrint(os);
break;
- case JS_FUNCTION_PROXY_TYPE:
- JSFunctionProxy::cast(this)->JSFunctionProxyPrint(os);
- break;
case JS_SET_TYPE:
JSSet::cast(this)->JSSetPrint(os);
break;
@@ -148,6 +146,9 @@
case JS_MAP_ITERATOR_TYPE:
JSMapIterator::cast(this)->JSMapIteratorPrint(os);
break;
+ case JS_ITERATOR_RESULT_TYPE:
+ JSIteratorResult::cast(this)->JSIteratorResultPrint(os);
+ break;
case JS_WEAK_MAP_TYPE:
JSWeakMap::cast(this)->JSWeakMapPrint(os);
break;
@@ -196,26 +197,73 @@
}
+void Simd128Value::Simd128ValuePrint(std::ostream& os) { // NOLINT
+#define PRINT_SIMD128_VALUE(TYPE, Type, type, lane_count, lane_type) \
+ if (Is##Type()) return Type::cast(this)->Type##Print(os);
+ SIMD128_TYPES(PRINT_SIMD128_VALUE)
+#undef PRINT_SIMD128_VALUE
+ UNREACHABLE();
+}
+
+
+void Float32x4::Float32x4Print(std::ostream& os) { // NOLINT
+ char arr[100];
+ Vector<char> buffer(arr, arraysize(arr));
+ os << std::string(DoubleToCString(get_lane(0), buffer)) << ", "
+ << std::string(DoubleToCString(get_lane(1), buffer)) << ", "
+ << std::string(DoubleToCString(get_lane(2), buffer)) << ", "
+ << std::string(DoubleToCString(get_lane(3), buffer));
+}
+
+
+#define SIMD128_INT_PRINT_FUNCTION(type, lane_count) \
+ void type::type##Print(std::ostream& os) { \
+ char arr[100]; \
+ Vector<char> buffer(arr, arraysize(arr)); \
+ os << std::string(IntToCString(get_lane(0), buffer)); \
+ for (int i = 1; i < lane_count; i++) { \
+ os << ", " << std::string(IntToCString(get_lane(i), buffer)); \
+ } \
+ }
+SIMD128_INT_PRINT_FUNCTION(Int32x4, 4)
+SIMD128_INT_PRINT_FUNCTION(Uint32x4, 4)
+SIMD128_INT_PRINT_FUNCTION(Int16x8, 8)
+SIMD128_INT_PRINT_FUNCTION(Uint16x8, 8)
+SIMD128_INT_PRINT_FUNCTION(Int8x16, 16)
+SIMD128_INT_PRINT_FUNCTION(Uint8x16, 16)
+#undef SIMD128_INT_PRINT_FUNCTION
+
+
+#define SIMD128_BOOL_PRINT_FUNCTION(type, lane_count) \
+ void type::type##Print(std::ostream& os) { \
+ char arr[100]; \
+ Vector<char> buffer(arr, arraysize(arr)); \
+ os << std::string(get_lane(0) ? "true" : "false"); \
+ for (int i = 1; i < lane_count; i++) { \
+ os << ", " << std::string(get_lane(i) ? "true" : "false"); \
+ } \
+ }
+SIMD128_BOOL_PRINT_FUNCTION(Bool32x4, 4)
+SIMD128_BOOL_PRINT_FUNCTION(Bool16x8, 8)
+SIMD128_BOOL_PRINT_FUNCTION(Bool8x16, 16)
+#undef SIMD128_BOOL_PRINT_FUNCTION
+
+
void ByteArray::ByteArrayPrint(std::ostream& os) { // NOLINT
os << "byte array, data starts at " << GetDataStartAddress();
}
+void BytecodeArray::BytecodeArrayPrint(std::ostream& os) { // NOLINT
+ Disassemble(os);
+}
+
+
void FreeSpace::FreeSpacePrint(std::ostream& os) { // NOLINT
os << "free space, size " << Size();
}
-#define EXTERNAL_ARRAY_PRINTER(Type, type, TYPE, ctype, size) \
- void External##Type##Array::External##Type##ArrayPrint(std::ostream& os) { \
- os << "external " #type " array"; \
- }
-
-TYPED_ARRAYS(EXTERNAL_ARRAY_PRINTER)
-
-#undef EXTERNAL_ARRAY_PRINTER
-
-
template <class Traits>
void FixedTypedArray<Traits>::FixedTypedArrayPrint(
std::ostream& os) { // NOLINT
@@ -227,33 +275,35 @@
if (HasFastProperties()) {
DescriptorArray* descs = map()->instance_descriptors();
for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) {
- os << " ";
+ os << "\n ";
descs->GetKey(i)->NamePrint(os);
os << ": ";
switch (descs->GetType(i)) {
- case FIELD: {
+ case DATA: {
FieldIndex index = FieldIndex::ForDescriptor(map(), i);
if (IsUnboxedDoubleField(index)) {
os << "<unboxed double> " << RawFastDoublePropertyAt(index);
} else {
os << Brief(RawFastPropertyAt(index));
}
- os << " (field at offset " << index.property_index() << ")\n";
+ os << " (data field at offset " << index.property_index() << ")";
break;
}
- case ACCESSOR_FIELD: {
+ case ACCESSOR: {
FieldIndex index = FieldIndex::ForDescriptor(map(), i);
- os << " (accessor at offset " << index.property_index() << ")\n";
+ os << " (accessor field at offset " << index.property_index() << ")";
break;
}
- case CONSTANT:
- os << Brief(descs->GetConstant(i)) << " (constant)\n";
+ case DATA_CONSTANT:
+ os << Brief(descs->GetConstant(i)) << " (data constant)";
break;
- case CALLBACKS:
- os << Brief(descs->GetCallbacksObject(i)) << " (callbacks)\n";
+ case ACCESSOR_CONSTANT:
+ os << Brief(descs->GetCallbacksObject(i)) << " (accessor constant)";
break;
}
}
+ } else if (IsJSGlobalObject()) {
+ global_dictionary()->Print(os);
} else {
property_dictionary()->Print(os);
}
@@ -264,7 +314,7 @@
static void DoPrintElements(std::ostream& os, Object* object) { // NOLINT
T* p = T::cast(object);
for (int i = 0; i < p->length(); i++) {
- os << " " << i << ": " << p->get_scalar(i) << "\n";
+ os << "\n " << i << ": " << p->get_scalar(i);
}
}
@@ -280,7 +330,7 @@
// Print in array notation for non-sparse arrays.
FixedArray* p = FixedArray::cast(elements());
for (int i = 0; i < p->length(); i++) {
- os << " " << i << ": " << Brief(p->get(i)) << "\n";
+ os << "\n " << i << ": " << Brief(p->get(i));
}
break;
}
@@ -290,13 +340,12 @@
if (elements()->length() > 0) {
FixedDoubleArray* p = FixedDoubleArray::cast(elements());
for (int i = 0; i < p->length(); i++) {
- os << " " << i << ": ";
+ os << "\n " << i << ": ";
if (p->is_the_hole(i)) {
os << "<the hole>";
} else {
os << p->get_scalar(i);
}
- os << "\n";
}
}
break;
@@ -309,19 +358,6 @@
break; \
}
- PRINT_ELEMENTS(EXTERNAL_UINT8_CLAMPED_ELEMENTS, ExternalUint8ClampedArray)
- PRINT_ELEMENTS(EXTERNAL_INT8_ELEMENTS, ExternalInt8Array)
- PRINT_ELEMENTS(EXTERNAL_UINT8_ELEMENTS,
- ExternalUint8Array)
- PRINT_ELEMENTS(EXTERNAL_INT16_ELEMENTS, ExternalInt16Array)
- PRINT_ELEMENTS(EXTERNAL_UINT16_ELEMENTS,
- ExternalUint16Array)
- PRINT_ELEMENTS(EXTERNAL_INT32_ELEMENTS, ExternalInt32Array)
- PRINT_ELEMENTS(EXTERNAL_UINT32_ELEMENTS,
- ExternalUint32Array)
- PRINT_ELEMENTS(EXTERNAL_FLOAT32_ELEMENTS, ExternalFloat32Array)
- PRINT_ELEMENTS(EXTERNAL_FLOAT64_ELEMENTS, ExternalFloat64Array)
-
PRINT_ELEMENTS(UINT8_ELEMENTS, FixedUint8Array)
PRINT_ELEMENTS(UINT8_CLAMPED_ELEMENTS, FixedUint8ClampedArray)
PRINT_ELEMENTS(INT8_ELEMENTS, FixedInt8Array)
@@ -337,57 +373,61 @@
case DICTIONARY_ELEMENTS:
elements()->Print(os);
break;
- case SLOPPY_ARGUMENTS_ELEMENTS: {
+ case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
+ case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: {
FixedArray* p = FixedArray::cast(elements());
- os << " parameter map:";
+ os << "\n parameter map:";
for (int i = 2; i < p->length(); i++) {
os << " " << (i - 2) << ":" << Brief(p->get(i));
}
os << "\n context: " << Brief(p->get(0))
- << "\n arguments: " << Brief(p->get(1)) << "\n";
+ << "\n arguments: " << Brief(p->get(1));
break;
}
}
}
-void JSObject::JSObjectPrint(std::ostream& os) { // NOLINT
- HeapObject::PrintHeader(os, "JSObject");
+static void JSObjectPrintHeader(std::ostream& os, JSObject* obj,
+ const char* id) { // NOLINT
+ obj->PrintHeader(os, id);
// Don't call GetElementsKind, its validation code can cause the printer to
// fail when debugging.
- PrototypeIterator iter(GetIsolate(), this);
- os << " - map = " << reinterpret_cast<void*>(map()) << " ["
- << ElementsKindToString(this->map()->elements_kind())
- << "]\n - prototype = " << reinterpret_cast<void*>(iter.GetCurrent())
- << "\n {\n";
- PrintProperties(os);
- PrintTransitions(os);
- PrintElements(os);
- os << " }\n";
+ PrototypeIterator iter(obj->GetIsolate(), obj);
+ os << " - map = " << reinterpret_cast<void*>(obj->map()) << " ["
+ << ElementsKindToString(obj->map()->elements_kind())
+ << "]\n - prototype = " << reinterpret_cast<void*>(iter.GetCurrent());
+}
+
+
+static void JSObjectPrintBody(std::ostream& os, JSObject* obj, // NOLINT
+ bool print_elements = true) {
+ os << "\n {";
+ obj->PrintProperties(os);
+ obj->PrintTransitions(os);
+ if (print_elements) obj->PrintElements(os);
+ os << "\n }\n";
+}
+
+
+void JSObject::JSObjectPrint(std::ostream& os) { // NOLINT
+ JSObjectPrintHeader(os, this, "JSObject");
+ JSObjectPrintBody(os, this);
+}
+
+
+void JSRegExp::JSRegExpPrint(std::ostream& os) { // NOLINT
+ JSObjectPrintHeader(os, this, "JSRegExp");
+ os << "\n - data = " << Brief(data());
+ JSObjectPrintBody(os, this);
}
void JSModule::JSModulePrint(std::ostream& os) { // NOLINT
- HeapObject::PrintHeader(os, "JSModule");
- os << " - map = " << reinterpret_cast<void*>(map()) << "\n"
- << " - context = ";
- context()->Print(os);
- os << " - scope_info = " << Brief(scope_info())
- << ElementsKindToString(this->map()->elements_kind()) << " {\n";
- PrintProperties(os);
- PrintElements(os);
- os << " }\n";
-}
-
-
-static const char* TypeToString(InstanceType type) {
- switch (type) {
-#define TYPE_TO_STRING(TYPE) case TYPE: return #TYPE;
- INSTANCE_TYPE_LIST(TYPE_TO_STRING)
-#undef TYPE_TO_STRING
- }
- UNREACHABLE();
- return "UNKNOWN"; // Keep the compiler happy.
+ JSObjectPrintHeader(os, this, "JSModule");
+ os << "\n - context = " << Brief(context());
+ os << " - scope_info = " << Brief(scope_info());
+ JSObjectPrintBody(os, this);
}
@@ -399,44 +439,55 @@
os << " (" << PrivateSymbolToName() << ")";
}
os << "\n - private: " << is_private();
- os << "\n - own: " << is_own();
os << "\n";
}
void Map::MapPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "Map");
- os << " - type: " << TypeToString(instance_type()) << "\n";
+ os << " - type: " << instance_type() << "\n";
os << " - instance size: " << instance_size() << "\n";
- os << " - inobject properties: " << inobject_properties() << "\n";
- os << " - elements kind: " << ElementsKindToString(elements_kind());
- os << "\n - pre-allocated property fields: "
- << pre_allocated_property_fields() << "\n";
+ if (IsJSObjectMap()) {
+ os << " - inobject properties: " << GetInObjectProperties() << "\n";
+ }
+ os << " - elements kind: " << ElementsKindToString(elements_kind()) << "\n";
os << " - unused property fields: " << unused_property_fields() << "\n";
if (is_deprecated()) os << " - deprecated_map\n";
+ if (is_stable()) os << " - stable_map\n";
if (is_dictionary_map()) os << " - dictionary_map\n";
- if (is_prototype_map()) os << " - prototype_map\n";
if (is_hidden_prototype()) os << " - hidden_prototype\n";
if (has_named_interceptor()) os << " - named_interceptor\n";
if (has_indexed_interceptor()) os << " - indexed_interceptor\n";
if (is_undetectable()) os << " - undetectable\n";
- if (has_instance_call_handler()) os << " - instance_call_handler\n";
+ if (is_callable()) os << " - callable\n";
+ if (is_constructor()) os << " - constructor\n";
if (is_access_check_needed()) os << " - access_check_needed\n";
if (!is_extensible()) os << " - non-extensible\n";
- os << " - back pointer: " << Brief(GetBackPointer());
+ if (is_observed()) os << " - observed\n";
+ if (is_strong()) os << " - strong_map\n";
+ if (is_prototype_map()) {
+ os << " - prototype_map\n";
+ os << " - prototype info: " << Brief(prototype_info());
+ } else {
+ os << " - back pointer: " << Brief(GetBackPointer());
+ }
os << "\n - instance descriptors " << (owns_descriptors() ? "(own) " : "")
<< "#" << NumberOfOwnDescriptors() << ": "
<< Brief(instance_descriptors());
if (FLAG_unbox_double_fields) {
os << "\n - layout descriptor: " << Brief(layout_descriptor());
}
- if (HasTransitionArray()) {
- os << "\n - transitions: " << Brief(transitions());
+ int nof_transitions = TransitionArray::NumberOfTransitions(raw_transitions());
+ if (nof_transitions > 0) {
+ os << "\n - transitions #" << nof_transitions << ": "
+ << Brief(raw_transitions());
+ TransitionArray::PrintTransitions(os, raw_transitions(), false);
}
os << "\n - prototype: " << Brief(prototype());
- os << "\n - constructor: " << Brief(constructor());
+ os << "\n - constructor: " << Brief(GetConstructor());
os << "\n - code cache: " << Brief(code_cache());
os << "\n - dependent code: " << Brief(dependent_code());
+ os << "\n - construction counter: " << construction_counter();
os << "\n";
}
@@ -495,37 +546,104 @@
}
-void ConstantPoolArray::ConstantPoolArrayPrint(std::ostream& os) { // NOLINT
- HeapObject::PrintHeader(os, "ConstantPoolArray");
- os << " - length: " << length();
- for (int i = 0; i <= last_index(INT32, SMALL_SECTION); i++) {
- if (i < last_index(INT64, SMALL_SECTION)) {
- os << "\n [" << i << "]: double: " << get_int64_entry_as_double(i);
- } else if (i <= last_index(CODE_PTR, SMALL_SECTION)) {
- os << "\n [" << i << "]: code target pointer: "
- << reinterpret_cast<void*>(get_code_ptr_entry(i));
- } else if (i <= last_index(HEAP_PTR, SMALL_SECTION)) {
- os << "\n [" << i << "]: heap pointer: "
- << reinterpret_cast<void*>(get_heap_ptr_entry(i));
- } else if (i <= last_index(INT32, SMALL_SECTION)) {
- os << "\n [" << i << "]: int32: " << get_int32_entry(i);
- }
+void TransitionArray::TransitionArrayPrint(std::ostream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "TransitionArray");
+ os << " - capacity: " << length();
+ for (int i = 0; i < length(); i++) {
+ os << "\n [" << i << "]: " << Brief(get(i));
+ if (i == kNextLinkIndex) os << " (next link)";
+ if (i == kPrototypeTransitionsIndex) os << " (prototype transitions)";
+ if (i == kTransitionLengthIndex) os << " (number of transitions)";
}
- if (is_extended_layout()) {
- os << "\n Extended section:";
- for (int i = first_extended_section_index();
- i <= last_index(INT32, EXTENDED_SECTION); i++) {
- if (i < last_index(INT64, EXTENDED_SECTION)) {
- os << "\n [" << i << "]: double: " << get_int64_entry_as_double(i);
- } else if (i <= last_index(CODE_PTR, EXTENDED_SECTION)) {
- os << "\n [" << i << "]: code target pointer: "
- << reinterpret_cast<void*>(get_code_ptr_entry(i));
- } else if (i <= last_index(HEAP_PTR, EXTENDED_SECTION)) {
- os << "\n [" << i << "]: heap pointer: "
- << reinterpret_cast<void*>(get_heap_ptr_entry(i));
- } else if (i <= last_index(INT32, EXTENDED_SECTION)) {
- os << "\n [" << i << "]: int32: " << get_int32_entry(i);
+ os << "\n";
+}
+
+
+void TypeFeedbackMetadata::Print() {
+ OFStream os(stdout);
+ TypeFeedbackMetadataPrint(os);
+ os << std::flush;
+}
+
+
+void TypeFeedbackMetadata::TypeFeedbackMetadataPrint(
+ std::ostream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "TypeFeedbackMetadata");
+ os << " - length: " << length();
+ if (length() == 0) {
+ os << " (empty)\n";
+ return;
+ }
+
+ TypeFeedbackMetadataIterator iter(this);
+ while (iter.HasNext()) {
+ FeedbackVectorSlot slot = iter.Next();
+ FeedbackVectorSlotKind kind = iter.kind();
+ os << "\n Slot " << slot << " " << kind;
+ }
+ os << "\n";
+}
+
+
+void TypeFeedbackVector::Print() {
+ OFStream os(stdout);
+ TypeFeedbackVectorPrint(os);
+ os << std::flush;
+}
+
+
+void TypeFeedbackVector::TypeFeedbackVectorPrint(std::ostream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "TypeFeedbackVector");
+ os << " - length: " << length();
+ if (length() == 0) {
+ os << " (empty)\n";
+ return;
+ }
+
+ TypeFeedbackMetadataIterator iter(metadata());
+ while (iter.HasNext()) {
+ FeedbackVectorSlot slot = iter.Next();
+ FeedbackVectorSlotKind kind = iter.kind();
+
+ os << "\n Slot " << slot << " " << kind << " ";
+ switch (kind) {
+ case FeedbackVectorSlotKind::LOAD_IC: {
+ LoadICNexus nexus(this, slot);
+ os << Code::ICState2String(nexus.StateFromFeedback());
+ break;
}
+ case FeedbackVectorSlotKind::KEYED_LOAD_IC: {
+ KeyedLoadICNexus nexus(this, slot);
+ os << Code::ICState2String(nexus.StateFromFeedback());
+ break;
+ }
+ case FeedbackVectorSlotKind::CALL_IC: {
+ CallICNexus nexus(this, slot);
+ os << Code::ICState2String(nexus.StateFromFeedback());
+ break;
+ }
+ case FeedbackVectorSlotKind::STORE_IC: {
+ StoreICNexus nexus(this, slot);
+ os << Code::ICState2String(nexus.StateFromFeedback());
+ break;
+ }
+ case FeedbackVectorSlotKind::KEYED_STORE_IC: {
+ KeyedStoreICNexus nexus(this, slot);
+ os << Code::ICState2String(nexus.StateFromFeedback());
+ break;
+ }
+ case FeedbackVectorSlotKind::GENERAL:
+ break;
+ case FeedbackVectorSlotKind::INVALID:
+ case FeedbackVectorSlotKind::KINDS_NUMBER:
+ UNREACHABLE();
+ break;
+ }
+
+ int entry_size = iter.entry_size();
+ for (int i = 0; i < entry_size; i++) {
+ int index = GetIndex(slot) + i;
+ os << "\n [" << index << "]: " << Brief(get(index));
}
}
os << "\n";
@@ -533,20 +651,21 @@
void JSValue::JSValuePrint(std::ostream& os) { // NOLINT
- HeapObject::PrintHeader(os, "ValueObject");
- value()->Print(os);
+ JSObjectPrintHeader(os, this, "JSValue");
+ os << "\n - value = " << Brief(value());
+ JSObjectPrintBody(os, this);
}
void JSMessageObject::JSMessageObjectPrint(std::ostream& os) { // NOLINT
- HeapObject::PrintHeader(os, "JSMessageObject");
- os << " - type: " << Brief(type());
- os << "\n - arguments: " << Brief(arguments());
+ JSObjectPrintHeader(os, this, "JSMessageObject");
+ os << "\n - type: " << type();
+ os << "\n - arguments: " << Brief(argument());
os << "\n - start_position: " << start_position();
os << "\n - end_position: " << end_position();
os << "\n - script: " << Brief(script());
os << "\n - stack_frames: " << Brief(stack_frames());
- os << "\n";
+ JSObjectPrintBody(os, this);
}
@@ -594,17 +713,15 @@
void JSDate::JSDatePrint(std::ostream& os) { // NOLINT
- HeapObject::PrintHeader(os, "JSDate");
- os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
- os << " - value = ";
- value()->Print(os);
+ JSObjectPrintHeader(os, this, "JSDate");
+ os << "\n - value = " << Brief(value());
if (!year()->IsSmi()) {
- os << " - time = NaN\n";
+ os << "\n - time = NaN\n";
} else {
// TODO(svenpanne) Add some basic formatting to our streams.
- Vector<char> buf = Vector<char>::New(100);
+ ScopedVector<char> buf(100);
SNPrintF(
- buf, " - time = %s %04d/%02d/%02d %02d:%02d:%02d\n",
+ buf, "\n - time = %s %04d/%02d/%02d %02d:%02d:%02d\n",
weekdays[weekday()->IsSmi() ? Smi::cast(weekday())->value() + 1 : 0],
year()->IsSmi() ? Smi::cast(year())->value() : -1,
month()->IsSmi() ? Smi::cast(month())->value() : -1,
@@ -614,46 +731,34 @@
sec()->IsSmi() ? Smi::cast(sec())->value() : -1);
os << buf.start();
}
+ JSObjectPrintBody(os, this);
}
void JSProxy::JSProxyPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "JSProxy");
- os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
- os << " - handler = ";
- handler()->Print(os);
+ os << " - map = " << reinterpret_cast<void*>(map());
+ os << "\n - target = ";
+ target()->ShortPrint(os);
+ os << "\n - handler = ";
+ handler()->ShortPrint(os);
os << "\n - hash = ";
- hash()->Print(os);
- os << "\n";
-}
-
-
-void JSFunctionProxy::JSFunctionProxyPrint(std::ostream& os) { // NOLINT
- HeapObject::PrintHeader(os, "JSFunctionProxy");
- os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
- os << " - handler = ";
- handler()->Print(os);
- os << "\n - call_trap = ";
- call_trap()->Print(os);
- os << "\n - construct_trap = ";
- construct_trap()->Print(os);
+ hash()->ShortPrint(os);
os << "\n";
}
void JSSet::JSSetPrint(std::ostream& os) { // NOLINT
- HeapObject::PrintHeader(os, "JSSet");
- os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
+ JSObjectPrintHeader(os, this, "JSSet");
os << " - table = " << Brief(table());
- os << "\n";
+ JSObjectPrintBody(os, this);
}
void JSMap::JSMapPrint(std::ostream& os) { // NOLINT
- HeapObject::PrintHeader(os, "JSMap");
- os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
+ JSObjectPrintHeader(os, this, "JSMap");
os << " - table = " << Brief(table());
- os << "\n";
+ JSObjectPrintBody(os, this);
}
@@ -661,8 +766,7 @@
void
OrderedHashTableIterator<Derived, TableType>::OrderedHashTableIteratorPrint(
std::ostream& os) { // NOLINT
- os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
- os << " - table = " << Brief(table());
+ os << "\n - table = " << Brief(table());
os << "\n - index = " << Brief(index());
os << "\n - kind = " << Brief(kind());
os << "\n";
@@ -680,82 +784,91 @@
void JSSetIterator::JSSetIteratorPrint(std::ostream& os) { // NOLINT
- HeapObject::PrintHeader(os, "JSSetIterator");
+ JSObjectPrintHeader(os, this, "JSSetIterator");
OrderedHashTableIteratorPrint(os);
}
void JSMapIterator::JSMapIteratorPrint(std::ostream& os) { // NOLINT
- HeapObject::PrintHeader(os, "JSMapIterator");
+ JSObjectPrintHeader(os, this, "JSMapIterator");
OrderedHashTableIteratorPrint(os);
}
-void JSWeakMap::JSWeakMapPrint(std::ostream& os) { // NOLINT
- HeapObject::PrintHeader(os, "JSWeakMap");
- os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
- os << " - table = " << Brief(table());
+void JSIteratorResult::JSIteratorResultPrint(std::ostream& os) { // NOLINT
+ JSObjectPrintHeader(os, this, "JSIteratorResult");
+ os << "\n - done = " << Brief(done());
+ os << "\n - value = " << Brief(value());
os << "\n";
}
+void JSWeakMap::JSWeakMapPrint(std::ostream& os) { // NOLINT
+ JSObjectPrintHeader(os, this, "JSWeakMap");
+ os << "\n - table = " << Brief(table());
+ JSObjectPrintBody(os, this);
+}
+
+
void JSWeakSet::JSWeakSetPrint(std::ostream& os) { // NOLINT
- HeapObject::PrintHeader(os, "JSWeakSet");
- os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
- os << " - table = " << Brief(table());
- os << "\n";
+ JSObjectPrintHeader(os, this, "JSWeakSet");
+ os << "\n - table = " << Brief(table());
+ JSObjectPrintBody(os, this);
}
void JSArrayBuffer::JSArrayBufferPrint(std::ostream& os) { // NOLINT
- HeapObject::PrintHeader(os, "JSArrayBuffer");
- os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
- os << " - backing_store = " << backing_store() << "\n";
- os << " - byte_length = " << Brief(byte_length());
- os << "\n";
+ JSObjectPrintHeader(os, this, "JSArrayBuffer");
+ os << "\n - backing_store = " << backing_store();
+ os << "\n - byte_length = " << Brief(byte_length());
+ if (was_neutered()) os << " - neutered\n";
+ JSObjectPrintBody(os, this, !was_neutered());
}
void JSTypedArray::JSTypedArrayPrint(std::ostream& os) { // NOLINT
- HeapObject::PrintHeader(os, "JSTypedArray");
- os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
- os << " - buffer = " << Brief(buffer());
+ JSObjectPrintHeader(os, this, "JSTypedArray");
+ os << "\n - buffer = " << Brief(buffer());
os << "\n - byte_offset = " << Brief(byte_offset());
os << "\n - byte_length = " << Brief(byte_length());
os << "\n - length = " << Brief(length());
- os << "\n";
- PrintElements(os);
+ if (WasNeutered()) os << " - neutered\n";
+ JSObjectPrintBody(os, this, !WasNeutered());
}
void JSDataView::JSDataViewPrint(std::ostream& os) { // NOLINT
- HeapObject::PrintHeader(os, "JSDataView");
- os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
- os << " - buffer =" << Brief(buffer());
+ JSObjectPrintHeader(os, this, "JSDataView");
+ os << "\n - buffer =" << Brief(buffer());
os << "\n - byte_offset = " << Brief(byte_offset());
os << "\n - byte_length = " << Brief(byte_length());
- os << "\n";
+ if (WasNeutered()) os << " - neutered\n";
+ JSObjectPrintBody(os, this, !WasNeutered());
+}
+
+
+void JSBoundFunction::JSBoundFunctionPrint(std::ostream& os) { // NOLINT
+ JSObjectPrintHeader(os, this, "JSBoundFunction");
+ os << "\n - bound_target_function = " << Brief(bound_target_function());
+ os << "\n - bound_this = " << Brief(bound_this());
+ os << "\n - bound_arguments = " << Brief(bound_arguments());
+ JSObjectPrintBody(os, this);
}
void JSFunction::JSFunctionPrint(std::ostream& os) { // NOLINT
- HeapObject::PrintHeader(os, "Function");
- os << " - map = " << reinterpret_cast<void*>(map()) << "\n";
- os << " - initial_map = ";
+ 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 - context = " << Brief(context());
- if (shared()->bound()) {
- os << "\n - bindings = " << Brief(function_bindings());
- } else {
- os << "\n - literals = " << Brief(literals());
+ os << "\n - name = " << Brief(shared()->name());
+ if (shared()->is_generator()) {
+ os << "\n - generator";
}
+ os << "\n - context = " << Brief(context());
+ os << "\n - literals = " << Brief(literals());
os << "\n - code = " << Brief(code());
- os << "\n";
- PrintProperties(os);
- PrintElements(os);
- os << "\n";
+ JSObjectPrintBody(os, this);
}
@@ -772,10 +885,8 @@
String* source = String::cast(Script::cast(script())->source());
int start = start_position();
int length = end_position() - start;
- SmartArrayPointer<char> source_string =
- source->ToCString(DISALLOW_NULLS,
- FAST_STRING_TRAVERSAL,
- start, length, NULL);
+ base::SmartArrayPointer<char> source_string = source->ToCString(
+ DISALLOW_NULLS, FAST_STRING_TRAVERSAL, start, length, NULL);
os << source_string.get();
}
// Script files are often large, hard to read.
@@ -789,7 +900,10 @@
os << "\n - length = " << length();
os << "\n - optimized_code_map = " << Brief(optimized_code_map());
os << "\n - feedback_vector = ";
- feedback_vector()->FixedArrayPrint(os);
+ feedback_vector()->TypeFeedbackVectorPrint(os);
+ if (HasBytecodeArray()) {
+ os << "\n - bytecode_array = " << bytecode_array();
+ }
os << "\n";
}
@@ -810,19 +924,18 @@
}
-void JSBuiltinsObject::JSBuiltinsObjectPrint(std::ostream& os) { // NOLINT
- os << "builtins ";
- JSObjectPrint(os);
-}
-
-
void Cell::CellPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "Cell");
+ os << " - value: " << Brief(value());
+ os << "\n";
}
void PropertyCell::PropertyCellPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "PropertyCell");
+ os << " - value: " << Brief(value());
+ os << "\n - details: " << property_details();
+ os << "\n";
}
@@ -833,6 +946,7 @@
} else {
os << "\n - value: " << Brief(value());
}
+ os << "\n";
}
@@ -848,6 +962,7 @@
void Foreign::ForeignPrint(std::ostream& os) { // NOLINT
os << "foreign address : " << foreign_address();
+ os << "\n";
}
@@ -855,7 +970,7 @@
std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "ExecutableAccessorInfo");
os << "\n - name: " << Brief(name());
- os << "\n - flag: " << Brief(flag());
+ os << "\n - flag: " << flag();
os << "\n - getter: " << Brief(getter());
os << "\n - setter: " << Brief(setter());
os << "\n - data: " << Brief(data());
@@ -863,24 +978,6 @@
}
-void DeclaredAccessorInfo::DeclaredAccessorInfoPrint(
- std::ostream& os) { // NOLINT
- HeapObject::PrintHeader(os, "DeclaredAccessorInfo");
- os << "\n - name: " << Brief(name());
- os << "\n - flag: " << Brief(flag());
- os << "\n - descriptor: " << Brief(descriptor());
- os << "\n";
-}
-
-
-void DeclaredAccessorDescriptor::DeclaredAccessorDescriptorPrint(
- std::ostream& os) { // NOLINT
- HeapObject::PrintHeader(os, "DeclaredAccessorDescriptor");
- os << "\n - internal field: " << Brief(serialized_data());
- os << "\n";
-}
-
-
void Box::BoxPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "Box");
os << "\n - value: " << Brief(value());
@@ -888,6 +985,24 @@
}
+void PrototypeInfo::PrototypeInfoPrint(std::ostream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "PrototypeInfo");
+ os << "\n - prototype users: " << Brief(prototype_users());
+ os << "\n - registry slot: " << registry_slot();
+ os << "\n - validity cell: " << Brief(validity_cell());
+ os << "\n";
+}
+
+
+void SloppyBlockWithEvalContextExtension::
+ SloppyBlockWithEvalContextExtensionPrint(std::ostream& os) { // NOLINT
+ HeapObject::PrintHeader(os, "SloppyBlockWithEvalContextExtension");
+ os << "\n - scope_info: " << Brief(scope_info());
+ os << "\n - extension: " << Brief(extension());
+ os << "\n";
+}
+
+
void AccessorPair::AccessorPairPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "AccessorPair");
os << "\n - getter: " << Brief(getter());
@@ -900,6 +1015,7 @@
HeapObject::PrintHeader(os, "AccessCheckInfo");
os << "\n - named_callback: " << Brief(named_callback());
os << "\n - indexed_callback: " << Brief(indexed_callback());
+ os << "\n - callback: " << Brief(callback());
os << "\n - data: " << Brief(data());
os << "\n";
}
@@ -944,6 +1060,7 @@
os << "\n - hidden_prototype: " << (hidden_prototype() ? "true" : "false");
os << "\n - undetectable: " << (undetectable() ? "true" : "false");
os << "\n - need_access_check: " << (needs_access_check() ? "true" : "false");
+ os << "\n - instantiated: " << (instantiated() ? "true" : "false");
os << "\n";
}
@@ -959,21 +1076,6 @@
}
-void SignatureInfo::SignatureInfoPrint(std::ostream& os) { // NOLINT
- HeapObject::PrintHeader(os, "SignatureInfo");
- os << "\n - receiver: " << Brief(receiver());
- os << "\n - args: " << Brief(args());
- os << "\n";
-}
-
-
-void TypeSwitchInfo::TypeSwitchInfoPrint(std::ostream& os) { // NOLINT
- HeapObject::PrintHeader(os, "TypeSwitchInfo");
- os << "\n - types: " << Brief(types());
- os << "\n";
-}
-
-
void AllocationSite::AllocationSitePrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "AllocationSite");
os << " - weak_next: " << Brief(weak_next());
@@ -1013,17 +1115,18 @@
HeapObject::PrintHeader(os, "Script");
os << "\n - source: " << Brief(source());
os << "\n - name: " << Brief(name());
- os << "\n - line_offset: " << Brief(line_offset());
- os << "\n - column_offset: " << Brief(column_offset());
- os << "\n - type: " << Brief(type());
- os << "\n - id: " << Brief(id());
+ os << "\n - line_offset: " << line_offset();
+ os << "\n - column_offset: " << column_offset();
+ os << "\n - type: " << type();
+ os << "\n - id: " << id();
os << "\n - context data: " << Brief(context_data());
os << "\n - wrapper: " << Brief(wrapper());
os << "\n - compilation type: " << compilation_type();
os << "\n - line ends: " << Brief(line_ends());
os << "\n - eval from shared: " << Brief(eval_from_shared());
os << "\n - eval from instructions offset: "
- << Brief(eval_from_instructions_offset());
+ << eval_from_instructions_offset();
+ os << "\n - shared function infos: " << Brief(shared_function_infos());
os << "\n";
}
@@ -1031,7 +1134,6 @@
void DebugInfo::DebugInfoPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "DebugInfo");
os << "\n - shared: " << Brief(shared());
- os << "\n - original_code: " << Brief(original_code());
os << "\n - code: " << Brief(code());
os << "\n - break_points: ";
break_points()->Print(os);
@@ -1040,9 +1142,9 @@
void BreakPointInfo::BreakPointInfoPrint(std::ostream& os) { // NOLINT
HeapObject::PrintHeader(os, "BreakPointInfo");
- os << "\n - code_position: " << code_position()->value();
- os << "\n - source_position: " << source_position()->value();
- os << "\n - statement_position: " << statement_position()->value();
+ os << "\n - code_position: " << code_position();
+ os << "\n - source_position: " << source_position();
+ os << "\n - statement_position: " << statement_position();
os << "\n - break_point_objects: " << Brief(break_point_objects());
os << "\n";
}
@@ -1149,11 +1251,11 @@
void DescriptorArray::PrintDescriptors(std::ostream& os) { // NOLINT
HandleScope scope(GetIsolate());
- os << "Descriptor array " << number_of_descriptors() << "\n";
+ os << "Descriptor array #" << number_of_descriptors();
for (int i = 0; i < number_of_descriptors(); i++) {
Descriptor desc;
Get(i, &desc);
- os << " " << i << ": " << desc << "\n";
+ os << "\n " << i << ": " << desc;
}
os << "\n";
}
@@ -1161,57 +1263,69 @@
void TransitionArray::Print() {
OFStream os(stdout);
- this->PrintTransitions(os);
- os << std::flush;
+ TransitionArray::PrintTransitions(os, this);
+ os << "\n" << std::flush;
}
-void TransitionArray::PrintTransitions(std::ostream& os,
+void TransitionArray::PrintTransitions(std::ostream& os, Object* transitions,
bool print_header) { // NOLINT
+ int num_transitions = NumberOfTransitions(transitions);
if (print_header) {
- os << "Transition array " << number_of_transitions() << "\n";
+ os << "Transition array #" << num_transitions << ":";
}
- for (int i = 0; i < number_of_transitions(); i++) {
- Name* key = GetKey(i);
- Map* target = GetTarget(i);
- os << " ";
+ for (int i = 0; i < num_transitions; i++) {
+ Name* key = GetKey(transitions, i);
+ Map* target = GetTarget(transitions, i);
+ os << "\n ";
#ifdef OBJECT_PRINT
key->NamePrint(os);
#else
key->ShortPrint(os);
#endif
os << ": ";
- if (key == GetHeap()->nonextensible_symbol()) {
- os << " (transition to non-extensible)";
- } else if (key == GetHeap()->sealed_symbol()) {
- os << " (transition to sealed)";
- } else if (key == GetHeap()->frozen_symbol()) {
- os << " (transition to frozen)";
- } else if (key == GetHeap()->elements_transition_symbol()) {
- os << " (transition to " << ElementsKindToString(target->elements_kind())
+ Heap* heap = key->GetHeap();
+ if (key == heap->nonextensible_symbol()) {
+ os << "(transition to non-extensible)";
+ } else if (key == heap->sealed_symbol()) {
+ os << "(transition to sealed)";
+ } else if (key == heap->frozen_symbol()) {
+ os << "(transition to frozen)";
+ } else if (key == heap->elements_transition_symbol()) {
+ os << "(transition to " << ElementsKindToString(target->elements_kind())
<< ")";
- } else if (key == GetHeap()->observed_symbol()) {
+ } else if (key == heap->strict_function_transition_symbol()) {
+ os << " (transition to strict function)";
+ } else if (key == heap->strong_function_transition_symbol()) {
+ os << " (transition to strong function)";
+ } else if (key == heap->observed_symbol()) {
os << " (transition to Object.observe)";
} else {
PropertyDetails details = GetTargetDetails(key, target);
- os << " (transition to ";
- if (details.location() == IN_DESCRIPTOR) {
+ os << "(transition to ";
+ if (details.location() == kDescriptor) {
os << "immutable ";
}
- os << (details.kind() == DATA ? "data" : "accessor");
- if (details.location() == IN_DESCRIPTOR) {
- os << " " << Brief(GetTargetValue(i));
+ os << (details.kind() == kData ? "data" : "accessor");
+ if (details.location() == kDescriptor) {
+ Object* value =
+ target->instance_descriptors()->GetValue(target->LastAdded());
+ os << " " << Brief(value);
}
os << "), attrs: " << details.attributes();
}
- os << " -> " << Brief(target) << "\n";
+ os << " -> " << Brief(target);
}
}
void JSObject::PrintTransitions(std::ostream& os) { // NOLINT
- if (!map()->HasTransitionArray()) return;
- map()->transitions()->PrintTransitions(os, false);
+ Object* transitions = map()->raw_transitions();
+ int num_transitions = TransitionArray::NumberOfTransitions(transitions);
+ if (num_transitions == 0) return;
+ os << "\n - transitions";
+ TransitionArray::PrintTransitions(os, transitions, false);
}
#endif // defined(DEBUG) || defined(OBJECT_PRINT)
-} } // namespace v8::internal
+} // namespace internal
+} // namespace v8