Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Unified Diff: src/compiler/access-builder.cc

Issue 1514863002: [turbofan] Make FieldAccess::name usable in practice. Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix comment. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/access-builder.h ('k') | src/compiler/js-native-context-specialization.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/access-builder.cc
diff --git a/src/compiler/access-builder.cc b/src/compiler/access-builder.cc
index 3b4ef5b471f89a82c94f880c4cc17aa8b13a5345..8206a0072dafc0a977e69831f901b142dcd47b60 100644
--- a/src/compiler/access-builder.cc
+++ b/src/compiler/access-builder.cc
@@ -16,9 +16,8 @@ namespace compiler {
// static
FieldAccess AccessBuilder::ForMap() {
- FieldAccess access = {kTaggedBase, HeapObject::kMapOffset,
- MaybeHandle<Name>(), Type::Any(),
- MachineType::AnyTagged()};
+ FieldAccess access = {kTaggedBase, HeapObject::kMapOffset, "HeapObject::map",
+ Type::Any(), MachineType::AnyTagged()};
return access;
}
@@ -26,7 +25,7 @@ FieldAccess AccessBuilder::ForMap() {
// static
FieldAccess AccessBuilder::ForHeapNumberValue() {
FieldAccess access = {kTaggedBase, HeapNumber::kValueOffset,
- MaybeHandle<Name>(), TypeCache().Get().kFloat64,
+ "HeapNumber::value", TypeCache().Get().kFloat64,
MachineType::Float64()};
return access;
}
@@ -35,7 +34,7 @@ FieldAccess AccessBuilder::ForHeapNumberValue() {
// static
FieldAccess AccessBuilder::ForJSObjectProperties() {
FieldAccess access = {kTaggedBase, JSObject::kPropertiesOffset,
- MaybeHandle<Name>(), Type::Internal(),
+ "JSObject::properties", Type::Internal(),
MachineType::AnyTagged()};
return access;
}
@@ -44,7 +43,7 @@ FieldAccess AccessBuilder::ForJSObjectProperties() {
// static
FieldAccess AccessBuilder::ForJSObjectElements() {
FieldAccess access = {kTaggedBase, JSObject::kElementsOffset,
- MaybeHandle<Name>(), Type::Internal(),
+ "JSObject::elements", Type::Internal(),
MachineType::AnyTagged()};
return access;
}
@@ -54,7 +53,7 @@ FieldAccess AccessBuilder::ForJSObjectElements() {
FieldAccess AccessBuilder::ForJSObjectInObjectProperty(Handle<Map> map,
int index) {
int const offset = map->GetInObjectPropertyOffset(index);
- FieldAccess access = {kTaggedBase, offset, MaybeHandle<Name>(),
+ FieldAccess access = {kTaggedBase, offset, "JSObject::field[n]",
Type::Tagged(), MachineType::AnyTagged()};
return access;
}
@@ -63,7 +62,7 @@ FieldAccess AccessBuilder::ForJSObjectInObjectProperty(Handle<Map> map,
// static
FieldAccess AccessBuilder::ForJSFunctionContext() {
FieldAccess access = {kTaggedBase, JSFunction::kContextOffset,
- MaybeHandle<Name>(), Type::Internal(),
+ "JSFunction::context", Type::Internal(),
MachineType::AnyTagged()};
return access;
}
@@ -72,7 +71,8 @@ FieldAccess AccessBuilder::ForJSFunctionContext() {
// static
FieldAccess AccessBuilder::ForJSFunctionSharedFunctionInfo() {
FieldAccess access = {kTaggedBase, JSFunction::kSharedFunctionInfoOffset,
- Handle<Name>(), Type::Any(), MachineType::AnyTagged()};
+ "JSFunction::shared", Type::Any(),
+ MachineType::AnyTagged()};
return access;
}
@@ -80,7 +80,7 @@ FieldAccess AccessBuilder::ForJSFunctionSharedFunctionInfo() {
// static
FieldAccess AccessBuilder::ForJSArrayLength(ElementsKind elements_kind) {
TypeCache const& type_cache = TypeCache::Get();
- FieldAccess access = {kTaggedBase, JSArray::kLengthOffset, Handle<Name>(),
+ FieldAccess access = {kTaggedBase, JSArray::kLengthOffset, "JSArray::length",
type_cache.kJSArrayLengthType,
MachineType::AnyTagged()};
if (IsFastDoubleElementsKind(elements_kind)) {
@@ -95,7 +95,7 @@ FieldAccess AccessBuilder::ForJSArrayLength(ElementsKind elements_kind) {
// static
FieldAccess AccessBuilder::ForJSArrayBufferBackingStore() {
FieldAccess access = {kTaggedBase, JSArrayBuffer::kBackingStoreOffset,
- MaybeHandle<Name>(), Type::UntaggedPointer(),
+ "JSArrayBuffer::backing_store", Type::UntaggedPointer(),
MachineType::Pointer()};
return access;
}
@@ -104,7 +104,7 @@ FieldAccess AccessBuilder::ForJSArrayBufferBackingStore() {
// static
FieldAccess AccessBuilder::ForJSArrayBufferBitField() {
FieldAccess access = {kTaggedBase, JSArrayBuffer::kBitFieldOffset,
- MaybeHandle<Name>(), TypeCache::Get().kInt8,
+ "JSArrayBuffer::bit_field", TypeCache::Get().kInt8,
MachineType::Int8()};
return access;
}
@@ -113,7 +113,7 @@ FieldAccess AccessBuilder::ForJSArrayBufferBitField() {
// static
FieldAccess AccessBuilder::ForJSArrayBufferViewBuffer() {
FieldAccess access = {kTaggedBase, JSArrayBufferView::kBufferOffset,
- MaybeHandle<Name>(), Type::TaggedPointer(),
+ "JSArrayBufferView::buffer", Type::TaggedPointer(),
MachineType::AnyTagged()};
return access;
}
@@ -123,7 +123,7 @@ FieldAccess AccessBuilder::ForJSArrayBufferViewBuffer() {
FieldAccess AccessBuilder::ForJSDateField(JSDate::FieldIndex index) {
FieldAccess access = {
kTaggedBase, JSDate::kValueOffset + index * kPointerSize,
- MaybeHandle<Name>(), Type::Number(), MachineType::AnyTagged()};
+ "JSDate::field[n]", Type::Number(), MachineType::AnyTagged()};
return access;
}
@@ -131,7 +131,7 @@ FieldAccess AccessBuilder::ForJSDateField(JSDate::FieldIndex index) {
// static
FieldAccess AccessBuilder::ForFixedArrayLength() {
FieldAccess access = {
- kTaggedBase, FixedArray::kLengthOffset, MaybeHandle<Name>(),
+ kTaggedBase, FixedArray::kLengthOffset, "FixedArray::length",
TypeCache::Get().kFixedArrayLengthType, MachineType::AnyTagged()};
return access;
}
@@ -140,7 +140,7 @@ FieldAccess AccessBuilder::ForFixedArrayLength() {
// static
FieldAccess AccessBuilder::ForDescriptorArrayEnumCache() {
FieldAccess access = {kTaggedBase, DescriptorArray::kEnumCacheOffset,
- Handle<Name>(), Type::TaggedPointer(),
+ "DescriptorArray::enum_cache", Type::TaggedPointer(),
MachineType::AnyTagged()};
return access;
}
@@ -148,16 +148,17 @@ FieldAccess AccessBuilder::ForDescriptorArrayEnumCache() {
// static
FieldAccess AccessBuilder::ForDescriptorArrayEnumCacheBridgeCache() {
- FieldAccess access = {
- kTaggedBase, DescriptorArray::kEnumCacheBridgeCacheOffset, Handle<Name>(),
- Type::TaggedPointer(), MachineType::AnyTagged()};
+ FieldAccess access = {kTaggedBase,
+ DescriptorArray::kEnumCacheBridgeCacheOffset,
+ "DescriptorArray::enum_cache_bridge_cache",
+ Type::TaggedPointer(), MachineType::AnyTagged()};
return access;
}
// static
FieldAccess AccessBuilder::ForMapBitField3() {
- FieldAccess access = {kTaggedBase, Map::kBitField3Offset, Handle<Name>(),
+ FieldAccess access = {kTaggedBase, Map::kBitField3Offset, "Map::bit_field3",
TypeCache::Get().kInt32, MachineType::Int32()};
return access;
}
@@ -165,23 +166,25 @@ FieldAccess AccessBuilder::ForMapBitField3() {
// static
FieldAccess AccessBuilder::ForMapDescriptors() {
- FieldAccess access = {kTaggedBase, Map::kDescriptorsOffset, Handle<Name>(),
- Type::TaggedPointer(), MachineType::AnyTagged()};
+ FieldAccess access = {kTaggedBase, Map::kDescriptorsOffset,
+ "Map::descriptors", Type::TaggedPointer(),
+ MachineType::AnyTagged()};
return access;
}
// static
FieldAccess AccessBuilder::ForMapInstanceType() {
- FieldAccess access = {kTaggedBase, Map::kInstanceTypeOffset, Handle<Name>(),
- TypeCache::Get().kUint8, MachineType::Uint8()};
+ FieldAccess access = {kTaggedBase, Map::kInstanceTypeOffset,
+ "Map::instance_type", TypeCache::Get().kUint8,
+ MachineType::Uint8()};
return access;
}
// static
FieldAccess AccessBuilder::ForMapPrototype() {
- FieldAccess access = {kTaggedBase, Map::kPrototypeOffset, Handle<Name>(),
+ FieldAccess access = {kTaggedBase, Map::kPrototypeOffset, "Map::prototype",
Type::TaggedPointer(), MachineType::AnyTagged()};
return access;
}
@@ -189,7 +192,7 @@ FieldAccess AccessBuilder::ForMapPrototype() {
// static
FieldAccess AccessBuilder::ForStringLength() {
- FieldAccess access = {kTaggedBase, String::kLengthOffset, Handle<Name>(),
+ FieldAccess access = {kTaggedBase, String::kLengthOffset, "String::length",
TypeCache::Get().kStringLengthType,
MachineType::AnyTagged()};
return access;
@@ -199,7 +202,7 @@ FieldAccess AccessBuilder::ForStringLength() {
// static
FieldAccess AccessBuilder::ForJSGlobalObjectGlobalProxy() {
FieldAccess access = {kTaggedBase, JSGlobalObject::kGlobalProxyOffset,
- Handle<Name>(), Type::Receiver(),
+ "JSGlobalObject::global_proxy", Type::Receiver(),
MachineType::AnyTagged()};
return access;
}
@@ -208,7 +211,7 @@ FieldAccess AccessBuilder::ForJSGlobalObjectGlobalProxy() {
// static
FieldAccess AccessBuilder::ForJSGlobalObjectNativeContext() {
FieldAccess access = {kTaggedBase, JSGlobalObject::kNativeContextOffset,
- Handle<Name>(), Type::Internal(),
+ "JSGlobalObject::native_context", Type::Internal(),
MachineType::AnyTagged()};
return access;
}
@@ -216,7 +219,7 @@ FieldAccess AccessBuilder::ForJSGlobalObjectNativeContext() {
// static
FieldAccess AccessBuilder::ForValue() {
- FieldAccess access = {kTaggedBase, JSValue::kValueOffset, Handle<Name>(),
+ FieldAccess access = {kTaggedBase, JSValue::kValueOffset, "JSValue::value",
Type::Any(), MachineType::AnyTagged()};
return access;
}
@@ -226,7 +229,7 @@ FieldAccess AccessBuilder::ForValue() {
FieldAccess AccessBuilder::ForArgumentsLength() {
int offset =
JSObject::kHeaderSize + Heap::kArgumentsLengthIndex * kPointerSize;
- FieldAccess access = {kTaggedBase, offset, Handle<Name>(), Type::Any(),
+ FieldAccess access = {kTaggedBase, offset, "Arguments::length", Type::Any(),
MachineType::AnyTagged()};
return access;
}
@@ -236,7 +239,7 @@ FieldAccess AccessBuilder::ForArgumentsLength() {
FieldAccess AccessBuilder::ForArgumentsCallee() {
int offset =
JSObject::kHeaderSize + Heap::kArgumentsCalleeIndex * kPointerSize;
- FieldAccess access = {kTaggedBase, offset, Handle<Name>(), Type::Any(),
+ FieldAccess access = {kTaggedBase, offset, "Arguments::callee", Type::Any(),
MachineType::AnyTagged()};
return access;
}
@@ -245,7 +248,7 @@ FieldAccess AccessBuilder::ForArgumentsCallee() {
// static
FieldAccess AccessBuilder::ForFixedArraySlot(size_t index) {
int offset = FixedArray::OffsetOfElementAt(static_cast<int>(index));
- FieldAccess access = {kTaggedBase, offset, Handle<Name>(), Type::Any(),
+ FieldAccess access = {kTaggedBase, offset, "FixedArray::slot[n]", Type::Any(),
MachineType::AnyTagged()};
return access;
}
@@ -256,7 +259,7 @@ FieldAccess AccessBuilder::ForContextSlot(size_t index) {
int offset = Context::kHeaderSize + static_cast<int>(index) * kPointerSize;
DCHECK_EQ(offset,
Context::SlotOffset(static_cast<int>(index)) + kHeapObjectTag);
- FieldAccess access = {kTaggedBase, offset, Handle<Name>(), Type::Any(),
+ FieldAccess access = {kTaggedBase, offset, "Context::slot[n]", Type::Any(),
MachineType::AnyTagged()};
return access;
}
@@ -270,8 +273,8 @@ FieldAccess AccessBuilder::ForPropertyCellValue() {
// static
FieldAccess AccessBuilder::ForPropertyCellValue(Type* type) {
- FieldAccess access = {kTaggedBase, PropertyCell::kValueOffset, Handle<Name>(),
- type, MachineType::AnyTagged()};
+ FieldAccess access = {kTaggedBase, PropertyCell::kValueOffset,
+ "PropertyCall::value", type, MachineType::AnyTagged()};
return access;
}
@@ -279,7 +282,8 @@ FieldAccess AccessBuilder::ForPropertyCellValue(Type* type) {
// static
FieldAccess AccessBuilder::ForSharedFunctionInfoTypeFeedbackVector() {
FieldAccess access = {kTaggedBase, SharedFunctionInfo::kFeedbackVectorOffset,
- Handle<Name>(), Type::Any(), MachineType::AnyTagged()};
+ "SharedFunctionInfo::feedback_vector", Type::Any(),
+ MachineType::AnyTagged()};
return access;
}
@@ -356,7 +360,7 @@ ElementAccess AccessBuilder::ForTypedArrayElement(ExternalArrayType type,
// static
FieldAccess AccessBuilder::ForStatsCounter() {
- FieldAccess access = {kUntaggedBase, 0, MaybeHandle<Name>(),
+ FieldAccess access = {kUntaggedBase, 0, "##StatsCounter##",
TypeCache::Get().kInt32, MachineType::Int32()};
return access;
}
@@ -365,7 +369,7 @@ FieldAccess AccessBuilder::ForStatsCounter() {
// static
FieldAccess AccessBuilder::ForFrameCallerFramePtr() {
FieldAccess access = {kUntaggedBase, StandardFrameConstants::kCallerFPOffset,
- MaybeHandle<Name>(), Type::Internal(),
+ "##FrameCallerFP##", Type::Internal(),
MachineType::Pointer()};
return access;
}
@@ -374,11 +378,27 @@ FieldAccess AccessBuilder::ForFrameCallerFramePtr() {
// static
FieldAccess AccessBuilder::ForFrameMarker() {
FieldAccess access = {kUntaggedBase, StandardFrameConstants::kMarkerOffset,
- MaybeHandle<Name>(), Type::Tagged(),
+ "##FrameMarker##", Type::Tagged(),
MachineType::AnyTagged()};
return access;
}
+
+// static
+const char* AccessBuilder::GetNameForTracing(Handle<Name> name, Zone* zone) {
+#ifdef OBJECT_PRINT
+ if (FLAG_trace_turbo || FLAG_trace_turbo_graph) {
+ std::ostringstream os;
+ name->Print(os);
+ char* result = zone->NewArray<char>(os.str().length() + 1);
+ Vector<char> vector(result, os.str().length() + 1);
+ SNPrintF(vector, "%s", os.str().c_str());
+ return result;
+ }
+#endif
+ return nullptr;
+}
+
} // namespace compiler
} // namespace internal
} // namespace v8
« no previous file with comments | « src/compiler/access-builder.h ('k') | src/compiler/js-native-context-specialization.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698