Commit 185fd388 authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[cleanup] Remove unused code.

Change-Id: If90c13658713cbfdf06200e49773e67495dce85b
Reviewed-on: https://chromium-review.googlesource.com/1225754Reviewed-by: 's avatarMichael Stanton <mvstanton@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55891}
parent 7af52329
......@@ -4869,25 +4869,6 @@ Handle<Map> Map::ReconfigureElementsKind(Isolate* isolate, Handle<Map> map,
return mu.ReconfigureElementsKind(new_elements_kind);
}
// Generalize all fields and update the transition tree.
Handle<Map> Map::GeneralizeAllFields(Isolate* isolate, Handle<Map> map) {
Handle<FieldType> any_type = FieldType::Any(isolate);
Handle<DescriptorArray> descriptors(map->instance_descriptors(), isolate);
for (int i = 0; i < map->NumberOfOwnDescriptors(); ++i) {
PropertyDetails details = descriptors->GetDetails(i);
if (details.location() == kField) {
DCHECK_EQ(kData, details.kind());
MapUpdater mu(isolate, map);
map = mu.ReconfigureToDataField(i, details.attributes(),
PropertyConstness::kMutable,
Representation::Tagged(), any_type);
}
}
return map;
}
// static
MaybeHandle<Map> Map::TryUpdate(Isolate* isolate, Handle<Map> old_map) {
DisallowHeapAllocation no_allocation;
......@@ -8124,144 +8105,6 @@ Maybe<bool> JSProxy::GetOwnPropertyDescriptor(Isolate* isolate,
}
bool JSObject::ReferencesObjectFromElements(FixedArray* elements,
ElementsKind kind,
Object* object) {
Isolate* isolate = GetIsolate();
if (IsObjectElementsKind(kind) || kind == FAST_STRING_WRAPPER_ELEMENTS) {
int length = IsJSArray() ? Smi::ToInt(JSArray::cast(this)->length())
: elements->length();
for (int i = 0; i < length; ++i) {
Object* element = elements->get(i);
if (!element->IsTheHole(isolate) && element == object) return true;
}
} else {
DCHECK(kind == DICTIONARY_ELEMENTS || kind == SLOW_STRING_WRAPPER_ELEMENTS);
Object* key = NumberDictionary::cast(elements)->SlowReverseLookup(object);
if (!key->IsUndefined(isolate)) return true;
}
return false;
}
// Check whether this object references another object.
bool JSObject::ReferencesObject(Object* obj) {
Map* map_of_this = map();
Heap* heap = GetHeap();
DisallowHeapAllocation no_allocation;
// Is the object the constructor for this object?
if (map_of_this->GetConstructor() == obj) {
return true;
}
// Is the object the prototype for this object?
if (map_of_this->prototype() == obj) {
return true;
}
// Check if the object is among the named properties.
Object* key = SlowReverseLookup(obj);
if (!key->IsUndefined(heap->isolate())) {
return true;
}
// Check if the object is among the indexed properties.
ElementsKind kind = GetElementsKind();
switch (kind) {
// Raw pixels and external arrays do not reference other
// objects.
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype) \
case TYPE##_ELEMENTS: \
break;
TYPED_ARRAYS(TYPED_ARRAY_CASE)
#undef TYPED_ARRAY_CASE
case PACKED_DOUBLE_ELEMENTS:
case HOLEY_DOUBLE_ELEMENTS:
break;
case PACKED_SMI_ELEMENTS:
case HOLEY_SMI_ELEMENTS:
break;
case PACKED_ELEMENTS:
case HOLEY_ELEMENTS:
case DICTIONARY_ELEMENTS:
case FAST_STRING_WRAPPER_ELEMENTS:
case SLOW_STRING_WRAPPER_ELEMENTS: {
FixedArray* elements = FixedArray::cast(this->elements());
if (ReferencesObjectFromElements(elements, kind, obj)) return true;
break;
}
case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: {
SloppyArgumentsElements* elements =
SloppyArgumentsElements::cast(this->elements());
// Check the mapped parameters.
for (uint32_t i = 0; i < elements->parameter_map_length(); ++i) {
Object* value = elements->get_mapped_entry(i);
if (!value->IsTheHole(heap->isolate()) && value == obj) return true;
}
// Check the arguments.
FixedArray* arguments = elements->arguments();
kind = arguments->IsNumberDictionary() ? DICTIONARY_ELEMENTS
: HOLEY_ELEMENTS;
if (ReferencesObjectFromElements(arguments, kind, obj)) return true;
break;
}
case NO_ELEMENTS:
break;
}
// For functions check the context.
if (IsJSFunction()) {
// Get the constructor function for arguments array.
Map* arguments_map =
heap->isolate()->context()->native_context()->sloppy_arguments_map();
JSFunction* arguments_function =
JSFunction::cast(arguments_map->GetConstructor());
// Get the context and don't check if it is the native context.
JSFunction* f = JSFunction::cast(this);
Context* context = f->context();
if (context->IsNativeContext()) {
return false;
}
// Check the non-special context slots.
for (int i = Context::MIN_CONTEXT_SLOTS; i < context->length(); i++) {
// Only check JS objects.
if (context->get(i)->IsJSObject()) {
JSObject* ctxobj = JSObject::cast(context->get(i));
// If it is an arguments array check the content.
if (ctxobj->map()->GetConstructor() == arguments_function) {
if (ctxobj->ReferencesObject(obj)) {
return true;
}
} else if (ctxobj == obj) {
return true;
}
}
}
// Check the context extension (if any) if it can have references.
if (context->has_extension() && !context->IsCatchContext() &&
!context->IsModuleContext()) {
// With harmony scoping, a JSFunction may have a script context.
// TODO(mvstanton): walk into the ScopeInfo.
if (context->IsScriptContext()) {
return false;
}
return context->extension_object()->ReferencesObject(obj);
}
}
// No references to object.
return false;
}
Maybe<bool> JSReceiver::SetIntegrityLevel(Handle<JSReceiver> receiver,
IntegrityLevel level,
ShouldThrow should_throw) {
......@@ -10484,11 +10327,6 @@ Handle<FixedArray> ArrayList::Elements(Isolate* isolate,
return result;
}
bool ArrayList::IsFull() {
int capacity = length();
return kFirstIndex + Length() == capacity;
}
namespace {
Handle<FixedArray> EnsureSpaceInFixedArray(Isolate* isolate,
......@@ -11125,32 +10963,6 @@ std::unique_ptr<char[]> String::ToCString(AllowNullsFlag allow_nulls,
}
const uc16* String::GetTwoByteData(unsigned start) {
DCHECK(!IsOneByteRepresentationUnderneath());
switch (StringShape(this).representation_tag()) {
case kSeqStringTag:
return SeqTwoByteString::cast(this)->SeqTwoByteStringGetData(start);
case kExternalStringTag:
return ExternalTwoByteString::cast(this)->
ExternalTwoByteStringGetData(start);
case kSlicedStringTag: {
SlicedString* slice = SlicedString::cast(this);
return slice->parent()->GetTwoByteData(start + slice->offset());
}
case kConsStringTag:
case kThinStringTag:
UNREACHABLE();
}
UNREACHABLE();
}
const uc16* SeqTwoByteString::SeqTwoByteStringGetData(unsigned start) {
return reinterpret_cast<uc16*>(
reinterpret_cast<char*>(this) - kHeapObjectTag + kHeaderSize) + start;
}
void Relocatable::PostGarbageCollectionProcessing(Isolate* isolate) {
Relocatable* current = isolate->relocatable_top();
while (current != nullptr) {
......@@ -14468,11 +14280,6 @@ void Code::FlushICache() const {
Assembler::FlushICache(raw_instruction_start(), raw_instruction_size());
}
void Code::CopyFrom(Heap* heap, const CodeDesc& desc) {
CopyFromNoFlush(heap, desc);
FlushICache();
}
void Code::CopyFromNoFlush(Heap* heap, const CodeDesc& desc) {
// Copy code.
CopyBytes(reinterpret_cast<byte*>(raw_instruction_start()), desc.buffer,
......@@ -15404,38 +15211,6 @@ bool DependentCode::Compact() {
return new_count < old_count;
}
bool DependentCode::Contains(DependencyGroup group, MaybeObject* code) {
if (this->length() == 0 || this->group() > group) {
// There is no such group.
return false;
}
if (this->group() < group) {
// The group comes later in the list.
return next_link()->Contains(group, code);
}
DCHECK_EQ(group, this->group());
int count = this->count();
for (int i = 0; i < count; i++) {
if (object_at(i) == code) return true;
}
return false;
}
bool DependentCode::IsEmpty(DependencyGroup group) {
if (this->length() == 0 || this->group() > group) {
// There is no such group.
return true;
}
if (this->group() < group) {
// The group comes later in the list.
return next_link()->IsEmpty(group);
}
DCHECK_EQ(group, this->group());
return count() == 0;
}
bool DependentCode::MarkCodeForDeoptimization(
Isolate* isolate,
DependentCode::DependencyGroup group) {
......@@ -16069,19 +15844,6 @@ void JSObject::TransitionElementsKind(Handle<JSObject> object,
}
// static
bool Map::IsValidElementsTransition(ElementsKind from_kind,
ElementsKind to_kind) {
// Transitions can't go backwards.
if (!IsMoreGeneralElementsKindTransition(from_kind, to_kind)) {
return false;
}
// Transitions from HOLEY -> PACKED are not allowed.
return !IsHoleyElementsKind(from_kind) || IsHoleyElementsKind(to_kind);
}
bool JSArray::HasReadOnlyLength(Handle<JSArray> array) {
Map* map = array->map();
// Fast path: "length" is the first fast property of arrays. Since it's not
......@@ -17531,18 +17293,6 @@ Handle<ObjectHashSet> ObjectHashSet::Add(Isolate* isolate,
return set;
}
Handle<Object> CompilationCacheTable::Lookup(Handle<String> src,
Handle<SharedFunctionInfo> shared,
LanguageMode language_mode) {
Isolate* isolate = GetIsolate();
StringSharedKey key(src, shared, language_mode, kNoSourcePosition);
int entry = FindEntry(isolate, &key);
if (entry == kNotFound) return isolate->factory()->undefined_value();
int index = EntryToIndex(entry);
if (!get(index)->IsFixedArray()) return isolate->factory()->undefined_value();
return Handle<Object>(get(index + 1), isolate);
}
namespace {
const int kLiteralEntryLength = 2;
......@@ -17713,21 +17463,6 @@ Handle<Object> CompilationCacheTable::LookupRegExp(Handle<String> src,
return Handle<Object>(get(EntryToIndex(entry) + 1), isolate);
}
Handle<CompilationCacheTable> CompilationCacheTable::Put(
Handle<CompilationCacheTable> cache, Handle<String> src,
Handle<SharedFunctionInfo> shared, LanguageMode language_mode,
Handle<Object> value) {
Isolate* isolate = cache->GetIsolate();
StringSharedKey key(src, shared, language_mode, kNoSourcePosition);
Handle<Object> k = key.AsHandle(isolate);
cache = EnsureCapacity(isolate, cache, 1);
int entry = cache->FindInsertionEntry(key.Hash());
cache->set(EntryToIndex(entry), *k);
cache->set(EntryToIndex(entry) + 1, *value);
cache->ElementAdded();
return cache;
}
Handle<CompilationCacheTable> CompilationCacheTable::PutScript(
Handle<CompilationCacheTable> cache, Handle<String> src,
Handle<Context> native_context, LanguageMode language_mode,
......
......@@ -305,9 +305,6 @@ class Code : public HeapObject, public NeverReadOnlySpaceObject {
// object has been moved by delta bytes.
void Relocate(intptr_t delta);
// Migrate code described by desc.
void CopyFrom(Heap* heap, const CodeDesc& desc);
// Migrate code from desc without flushing the instruction cache.
void CopyFromNoFlush(Heap* heap, const CodeDesc& desc);
......@@ -620,9 +617,6 @@ class DependentCode : public WeakFixedArray {
Handle<HeapObject> object,
DependencyGroup group);
bool Contains(DependencyGroup group, MaybeObject* code);
bool IsEmpty(DependencyGroup group);
void DeoptimizeDependentCodeGroup(Isolate* isolate, DependencyGroup group);
bool MarkCodeForDeoptimization(Isolate* isolate, DependencyGroup group);
......
......@@ -69,9 +69,6 @@ class CompilationCacheTable
: public HashTable<CompilationCacheTable, CompilationCacheShape>,
public NeverReadOnlySpaceObject {
public:
// Find cached value for a string key, otherwise return null.
Handle<Object> Lookup(Handle<String> src, Handle<SharedFunctionInfo> shared,
LanguageMode language_mode);
MaybeHandle<SharedFunctionInfo> LookupScript(Handle<String> src,
Handle<Context> native_context,
LanguageMode language_mode);
......@@ -79,11 +76,6 @@ class CompilationCacheTable
Handle<Context> native_context,
LanguageMode language_mode, int position);
Handle<Object> LookupRegExp(Handle<String> source, JSRegExp::Flags flags);
static Handle<CompilationCacheTable> Put(Handle<CompilationCacheTable> cache,
Handle<String> src,
Handle<SharedFunctionInfo> shared,
LanguageMode language_mode,
Handle<Object> value);
static Handle<CompilationCacheTable> PutScript(
Handle<CompilationCacheTable> cache, Handle<String> src,
Handle<Context> native_context, LanguageMode language_mode,
......
......@@ -442,7 +442,6 @@ class ArrayList : public FixedArray {
// Return a copy of the list of size Length() without the first entry. The
// number returned by Length() is stored in the first entry.
static Handle<FixedArray> Elements(Isolate* isolate, Handle<ArrayList> array);
bool IsFull();
DECL_CAST(ArrayList)
private:
......
......@@ -403,9 +403,6 @@ class Map : public HeapObject {
inline bool has_fixed_typed_array_elements() const;
inline bool has_dictionary_elements() const;
static bool IsValidElementsTransition(ElementsKind from_kind,
ElementsKind to_kind);
// Returns true if the current map doesn't have DICTIONARY_ELEMENTS but if a
// map with DICTIONARY_ELEMENTS was found in the prototype chain.
bool DictionaryElementsInPrototypeChainOnly(Isolate* isolate);
......@@ -471,8 +468,6 @@ class Map : public HeapObject {
bool InstancesNeedRewriting(Map* target, int target_number_of_fields,
int target_inobject, int target_unused,
int* old_number_of_fields) const;
// TODO(ishell): moveit!
static Handle<Map> GeneralizeAllFields(Isolate* isolate, Handle<Map> map);
V8_WARN_UNUSED_RESULT static Handle<FieldType> GeneralizeFieldType(
Representation rep1, Handle<FieldType> type1, Representation rep2,
Handle<FieldType> type2, Isolate* isolate);
......
......@@ -370,9 +370,6 @@ class String : public Name {
// Limit for truncation in short printing.
static const int kMaxShortPrintLength = 1024;
// Support for regular expressions.
const uc16* GetTwoByteData(unsigned start);
// Helper function for flattening strings.
template <typename sinkchar>
static void WriteToFlat(String* source, sinkchar* sink, int from, int to);
......@@ -556,9 +553,6 @@ class SeqTwoByteString : public SeqString {
// is deterministic.
void clear_padding();
// For regexp code.
const uint16_t* SeqTwoByteStringGetData(unsigned start);
DECL_CAST(SeqTwoByteString)
// Garbage collection support. This method is called by the
......
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