Commit 2261a0dd authored by Peter Marshall's avatar Peter Marshall Committed by Commit Bot

[cleanup] Replace List with std::vector in IC, Handle code.

Bug: v8:6333
Change-Id: I53d321292b0a2c7b7f72ee90bd119484f163bdc1
Reviewed-on: https://chromium-review.googlesource.com/637913
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47701}
parent 11ba497c
......@@ -5,8 +5,9 @@
#ifndef V8_COLLECTOR_H_
#define V8_COLLECTOR_H_
#include <vector>
#include "src/checks.h"
#include "src/list-inl.h"
#include "src/vector.h"
namespace v8 {
......@@ -32,8 +33,8 @@ class Collector {
virtual ~Collector() {
// Free backing store (in reverse allocation order).
current_chunk_.Dispose();
for (int i = chunks_.length() - 1; i >= 0; i--) {
chunks_.at(i).Dispose();
for (auto rit = chunks_.rbegin(); rit != chunks_.rend(); ++rit) {
rit->Dispose();
}
}
......@@ -86,8 +87,7 @@ class Collector {
void WriteTo(Vector<T> destination) {
DCHECK(size_ <= destination.length());
int position = 0;
for (int i = 0; i < chunks_.length(); i++) {
Vector<T> chunk = chunks_.at(i);
for (const Vector<T>& chunk : chunks_) {
for (int j = 0; j < chunk.length(); j++) {
destination[position] = chunk[j];
position++;
......@@ -111,10 +111,10 @@ class Collector {
// Resets the collector to be empty.
virtual void Reset() {
for (int i = chunks_.length() - 1; i >= 0; i--) {
chunks_.at(i).Dispose();
for (auto rit = chunks_.rbegin(); rit != chunks_.rend(); ++rit) {
rit->Dispose();
}
chunks_.Rewind(0);
chunks_.clear();
index_ = 0;
size_ = 0;
}
......@@ -124,7 +124,7 @@ class Collector {
protected:
static const int kMinCapacity = 16;
List<Vector<T> > chunks_;
std::vector<Vector<T>> chunks_;
Vector<T> current_chunk_; // Block of memory currently being written into.
int index_; // Current index in current chunk.
int size_; // Total number of elements in collector.
......@@ -159,7 +159,7 @@ class Collector {
virtual void NewChunk(int new_capacity) {
Vector<T> new_chunk = Vector<T>::New(new_capacity);
if (index_ > 0) {
chunks_.Add(current_chunk_.SubVector(0, index_));
chunks_.push_back(current_chunk_.SubVector(0, index_));
} else {
current_chunk_.Dispose();
}
......@@ -231,7 +231,8 @@ class SequenceCollector : public Collector<T, growth_factor, max_growth> {
new_chunk[i] = this->current_chunk_[sequence_start_ + i];
}
if (sequence_start_ > 0) {
this->chunks_.Add(this->current_chunk_.SubVector(0, sequence_start_));
this->chunks_.push_back(
this->current_chunk_.SubVector(0, sequence_start_));
} else {
this->current_chunk_.Dispose();
}
......
......@@ -16,7 +16,6 @@
#include "src/dtoa.h"
#include "src/factory.h"
#include "src/handles.h"
#include "src/list-inl.h"
#include "src/strtod.h"
#include "src/utils.h"
......
......@@ -691,7 +691,7 @@ void FeedbackNexus::ConfigureMonomorphic(Handle<Name> name,
void FeedbackNexus::ConfigurePolymorphic(Handle<Name> name,
MapHandles const& maps,
List<Handle<Object>>* handlers) {
ObjectHandles* handlers) {
int receiver_count = static_cast<int>(maps.size());
DCHECK(receiver_count > 1);
Handle<FixedArray> array;
......@@ -782,8 +782,7 @@ MaybeHandle<Object> FeedbackNexus::FindHandlerForMap(Handle<Map> map) const {
return MaybeHandle<Code>();
}
bool FeedbackNexus::FindHandlers(List<Handle<Object>>* code_list,
int length) const {
bool FeedbackNexus::FindHandlers(ObjectHandles* code_list, int length) const {
Object* feedback = GetFeedback();
Isolate* isolate = GetIsolate();
int count = 0;
......@@ -801,7 +800,7 @@ bool FeedbackNexus::FindHandlers(List<Handle<Object>>* code_list,
if (!cell->cleared()) {
Object* code = array->get(i + increment - 1);
DCHECK(IC::IsHandler(code));
code_list->Add(handle(code, isolate));
code_list->push_back(handle(code, isolate));
count++;
}
}
......@@ -810,7 +809,7 @@ bool FeedbackNexus::FindHandlers(List<Handle<Object>>* code_list,
if (!cell->cleared()) {
Object* code = GetFeedbackExtra();
DCHECK(IC::IsHandler(code));
code_list->Add(handle(code, isolate));
code_list->push_back(handle(code, isolate));
count++;
}
}
......@@ -836,15 +835,14 @@ Name* KeyedStoreICNexus::FindFirstName() const {
KeyedAccessStoreMode KeyedStoreICNexus::GetKeyedAccessStoreMode() const {
KeyedAccessStoreMode mode = STANDARD_STORE;
MapHandles maps;
List<Handle<Object>> handlers;
ObjectHandles handlers;
if (GetKeyType() == PROPERTY) return mode;
ExtractMaps(&maps);
FindHandlers(&handlers, static_cast<int>(maps.size()));
for (int i = 0; i < handlers.length(); i++) {
for (const Handle<Object>& maybe_code_handler : handlers) {
// The first handler that isn't the slow handler will have the bits we need.
Handle<Object> maybe_code_handler = handlers.at(i);
Handle<Code> handler;
if (maybe_code_handler->IsTuple3()) {
// Elements transition.
......
......@@ -108,6 +108,8 @@ inline LanguageMode GetLanguageModeFromSlotKind(FeedbackSlotKind kind) {
std::ostream& operator<<(std::ostream& os, FeedbackSlotKind kind);
typedef std::vector<Handle<Object>> ObjectHandles;
class FeedbackMetadata;
// A FeedbackVector has a fixed header with:
......@@ -554,8 +556,7 @@ class FeedbackNexus {
virtual InlineCacheState StateFromFeedback() const = 0;
virtual int ExtractMaps(MapHandles* maps) const;
virtual MaybeHandle<Object> FindHandlerForMap(Handle<Map> map) const;
virtual bool FindHandlers(List<Handle<Object>>* code_list,
int length = -1) const;
virtual bool FindHandlers(ObjectHandles* code_list, int length = -1) const;
virtual Name* FindFirstName() const { return NULL; }
bool IsCleared() {
......@@ -577,7 +578,7 @@ class FeedbackNexus {
Handle<Object> handler);
void ConfigurePolymorphic(Handle<Name> name, MapHandles const& maps,
List<Handle<Object>>* handlers);
ObjectHandles* handlers);
protected:
inline void SetFeedback(Object* feedback,
......@@ -620,8 +621,7 @@ class CallICNexus final : public FeedbackNexus {
MaybeHandle<Object> FindHandlerForMap(Handle<Map> map) const final {
return MaybeHandle<Code>();
}
bool FindHandlers(List<Handle<Object>>* code_list,
int length = -1) const final {
bool FindHandlers(ObjectHandles* code_list, int length = -1) const final {
return length == 0;
}
......@@ -666,8 +666,7 @@ class LoadGlobalICNexus : public FeedbackNexus {
MaybeHandle<Object> FindHandlerForMap(Handle<Map> map) const final {
return MaybeHandle<Code>();
}
bool FindHandlers(List<Handle<Object>>* code_list,
int length = -1) const final {
bool FindHandlers(ObjectHandles* code_list, int length = -1) const final {
return length == 0;
}
......@@ -759,8 +758,7 @@ class BinaryOpICNexus final : public FeedbackNexus {
MaybeHandle<Object> FindHandlerForMap(Handle<Map> map) const final {
return MaybeHandle<Code>();
}
bool FindHandlers(List<Handle<Object>>* code_list,
int length = -1) const final {
bool FindHandlers(ObjectHandles* code_list, int length = -1) const final {
return length == 0;
}
};
......@@ -786,8 +784,7 @@ class CompareICNexus final : public FeedbackNexus {
MaybeHandle<Object> FindHandlerForMap(Handle<Map> map) const final {
return MaybeHandle<Code>();
}
bool FindHandlers(List<Handle<Object>>* code_list,
int length = -1) const final {
bool FindHandlers(ObjectHandles* code_list, int length = -1) const final {
return length == 0;
}
};
......@@ -805,8 +802,7 @@ class ForInICNexus final : public FeedbackNexus {
MaybeHandle<Object> FindHandlerForMap(Handle<Map> map) const final {
return MaybeHandle<Code>();
}
bool FindHandlers(List<Handle<Object>>* code_list,
int length = -1) const final {
bool FindHandlers(ObjectHandles* code_list, int length = -1) const final {
return length == 0;
}
};
......
......@@ -12,7 +12,6 @@
#include "src/assembler.h"
#include "src/base/functional.h"
#include "src/base/platform/platform.h"
#include "src/list-inl.h"
#include "src/ostreams.h"
#include "src/utils.h"
#include "src/wasm/wasm-limits.h"
......@@ -249,8 +248,8 @@ std::ostream& operator<<(std::ostream& os, const Flag& flag) { // NOLINT
// static
List<const char*>* FlagList::argv() {
List<const char*>* args = new List<const char*>(8);
std::vector<const char*>* FlagList::argv() {
std::vector<const char*>* args = new std::vector<const char*>(8);
Flag* args_flag = NULL;
for (size_t i = 0; i < num_flags; ++i) {
Flag* f = &flags[i];
......@@ -264,22 +263,22 @@ List<const char*>* FlagList::argv() {
bool disabled = f->type() == Flag::TYPE_BOOL && !*f->bool_variable();
std::ostringstream os;
os << (disabled ? "--no" : "--") << f->name();
args->Add(StrDup(os.str().c_str()));
args->push_back(StrDup(os.str().c_str()));
}
if (f->type() != Flag::TYPE_BOOL) {
std::ostringstream os;
os << *f;
args->Add(StrDup(os.str().c_str()));
args->push_back(StrDup(os.str().c_str()));
}
}
}
if (args_flag != NULL) {
std::ostringstream os;
os << "--" << args_flag->name();
args->Add(StrDup(os.str().c_str()));
args->push_back(StrDup(os.str().c_str()));
JSArguments jsargs = *args_flag->args_variable();
for (int j = 0; j < jsargs.argc; j++) {
args->Add(StrDup(jsargs[j]));
args->push_back(StrDup(jsargs[j]));
}
}
return args;
......
......@@ -5,6 +5,8 @@
#ifndef V8_FLAGS_H_
#define V8_FLAGS_H_
#include <vector>
#include "src/globals.h"
namespace v8 {
......@@ -24,7 +26,7 @@ class V8_EXPORT_PRIVATE FlagList {
//
// The caller is responsible for disposing the list, as well
// as every element of it.
static List<const char*>* argv();
static std::vector<const char*>* argv();
// Set the flag values by parsing the command line. If remove_flags is
// set, the flags and associated values are removed from (argc,
......
......@@ -11,7 +11,6 @@
#include "src/conversions.h"
#include "src/handles-inl.h"
#include "src/isolate.h"
#include "src/list-inl.h"
#include "src/objects-inl.h"
namespace v8 {
......
......@@ -254,7 +254,7 @@ class GlobalHandles::Node {
void CollectPhantomCallbackData(
Isolate* isolate,
List<PendingPhantomCallback>* pending_phantom_callbacks) {
std::vector<PendingPhantomCallback>* pending_phantom_callbacks) {
DCHECK(weakness_type() == PHANTOM_WEAK ||
weakness_type() == PHANTOM_WEAK_2_EMBEDDER_FIELDS);
DCHECK(state() == PENDING);
......@@ -277,7 +277,7 @@ class GlobalHandles::Node {
typedef v8::WeakCallbackInfo<void> Data;
auto callback = reinterpret_cast<Data::Callback>(weak_callback_);
pending_phantom_callbacks->Add(
pending_phantom_callbacks->push_back(
PendingPhantomCallback(this, callback, parameter(), embedder_fields));
DCHECK(IsInUse());
set_state(NEAR_DEATH);
......@@ -502,9 +502,10 @@ class GlobalHandles::PendingPhantomCallbacksSecondPassTask
// Takes ownership of the contents of pending_phantom_callbacks, leaving it in
// the same state it would be after a call to Clear().
PendingPhantomCallbacksSecondPassTask(
List<PendingPhantomCallback>* pending_phantom_callbacks, Isolate* isolate)
std::vector<PendingPhantomCallback>* pending_phantom_callbacks,
Isolate* isolate)
: CancelableTask(isolate), isolate_(isolate) {
pending_phantom_callbacks_.Swap(pending_phantom_callbacks);
pending_phantom_callbacks_.swap(*pending_phantom_callbacks);
}
void RunInternal() override {
......@@ -520,7 +521,7 @@ class GlobalHandles::PendingPhantomCallbacksSecondPassTask
private:
Isolate* isolate_;
List<PendingPhantomCallback> pending_phantom_callbacks_;
std::vector<PendingPhantomCallback> pending_phantom_callbacks_;
DISALLOW_COPY_AND_ASSIGN(PendingPhantomCallbacksSecondPassTask);
};
......@@ -557,7 +558,7 @@ Handle<Object> GlobalHandles::Create(Object* value) {
result->Acquire(value);
if (isolate_->heap()->InNewSpace(value) &&
!result->is_in_new_space_list()) {
new_space_nodes_.Add(result);
new_space_nodes_.push_back(result);
result->set_in_new_space_list(true);
}
return result->handle();
......@@ -640,8 +641,7 @@ void GlobalHandles::IdentifyWeakHandles(WeakSlotCallback f) {
}
void GlobalHandles::IterateNewSpaceStrongAndDependentRoots(RootVisitor* v) {
for (int i = 0; i < new_space_nodes_.length(); ++i) {
Node* node = new_space_nodes_[i];
for (Node* node : new_space_nodes_) {
if (node->IsStrongRetainer() ||
(node->IsWeakRetainer() && !node->is_independent() &&
node->is_active())) {
......@@ -653,7 +653,7 @@ void GlobalHandles::IterateNewSpaceStrongAndDependentRoots(RootVisitor* v) {
void GlobalHandles::IterateNewSpaceStrongAndDependentRootsAndIdentifyUnmodified(
RootVisitor* v, size_t start, size_t end) {
for (size_t i = start; i < end; ++i) {
Node* node = new_space_nodes_[static_cast<int>(i)];
Node* node = new_space_nodes_[i];
if (node->IsWeak() && !JSObject::IsUnmodifiedApiObject(node->location())) {
node->set_active(true);
}
......@@ -667,8 +667,7 @@ void GlobalHandles::IterateNewSpaceStrongAndDependentRootsAndIdentifyUnmodified(
void GlobalHandles::IdentifyWeakUnmodifiedObjects(
WeakSlotCallback is_unmodified) {
for (int i = 0; i < new_space_nodes_.length(); ++i) {
Node* node = new_space_nodes_[i];
for (Node* node : new_space_nodes_) {
if (node->IsWeak() && !is_unmodified(node->location())) {
node->set_active(true);
}
......@@ -678,8 +677,7 @@ void GlobalHandles::IdentifyWeakUnmodifiedObjects(
void GlobalHandles::MarkNewSpaceWeakUnmodifiedObjectsPending(
WeakSlotCallbackWithHeap is_unscavenged) {
for (int i = 0; i < new_space_nodes_.length(); ++i) {
Node* node = new_space_nodes_[i];
for (Node* node : new_space_nodes_) {
DCHECK(node->is_in_new_space_list());
if ((node->is_independent() || !node->is_active()) && node->IsWeak() &&
is_unscavenged(isolate_->heap(), node->location())) {
......@@ -689,8 +687,7 @@ void GlobalHandles::MarkNewSpaceWeakUnmodifiedObjectsPending(
}
void GlobalHandles::IterateNewSpaceWeakUnmodifiedRoots(RootVisitor* v) {
for (int i = 0; i < new_space_nodes_.length(); ++i) {
Node* node = new_space_nodes_[i];
for (Node* node : new_space_nodes_) {
DCHECK(node->is_in_new_space_list());
if ((node->is_independent() || !node->is_active()) &&
node->IsWeakRetainer()) {
......@@ -709,9 +706,10 @@ void GlobalHandles::IterateNewSpaceWeakUnmodifiedRoots(RootVisitor* v) {
}
void GlobalHandles::InvokeSecondPassPhantomCallbacks(
List<PendingPhantomCallback>* callbacks, Isolate* isolate) {
while (callbacks->length() != 0) {
auto callback = callbacks->RemoveLast();
std::vector<PendingPhantomCallback>* callbacks, Isolate* isolate) {
while (!callbacks->empty()) {
auto callback = callbacks->back();
callbacks->pop_back();
DCHECK(callback.node() == nullptr);
// Fire second pass callback
callback.Invoke(isolate);
......@@ -722,8 +720,7 @@ void GlobalHandles::InvokeSecondPassPhantomCallbacks(
int GlobalHandles::PostScavengeProcessing(
const int initial_post_gc_processing_count) {
int freed_nodes = 0;
for (int i = 0; i < new_space_nodes_.length(); ++i) {
Node* node = new_space_nodes_[i];
for (Node* node : new_space_nodes_) {
DCHECK(node->is_in_new_space_list());
if (!node->IsRetainer()) {
// Free nodes do not have weak callbacks. Do not use them to compute
......@@ -782,9 +779,8 @@ int GlobalHandles::PostMarkSweepProcessing(
void GlobalHandles::UpdateListOfNewSpaceNodes() {
int last = 0;
for (int i = 0; i < new_space_nodes_.length(); ++i) {
Node* node = new_space_nodes_[i];
size_t last = 0;
for (Node* node : new_space_nodes_) {
DCHECK(node->is_in_new_space_list());
if (node->IsRetainer()) {
if (isolate_->heap()->InNewSpace(node->object())) {
......@@ -799,29 +795,28 @@ void GlobalHandles::UpdateListOfNewSpaceNodes() {
isolate_->heap()->IncrementNodesDiedInNewSpace();
}
}
new_space_nodes_.Rewind(last);
new_space_nodes_.Trim();
DCHECK_LE(last, new_space_nodes_.size());
new_space_nodes_.resize(last);
new_space_nodes_.shrink_to_fit();
}
int GlobalHandles::DispatchPendingPhantomCallbacks(
bool synchronous_second_pass) {
int freed_nodes = 0;
List<PendingPhantomCallback> second_pass_callbacks;
std::vector<PendingPhantomCallback> second_pass_callbacks;
{
// The initial pass callbacks must simply clear the nodes.
for (auto i = pending_phantom_callbacks_.begin();
i != pending_phantom_callbacks_.end(); ++i) {
auto callback = i;
for (auto callback : pending_phantom_callbacks_) {
// Skip callbacks that have already been processed once.
if (callback->node() == nullptr) continue;
callback->Invoke(isolate());
if (callback->callback()) second_pass_callbacks.Add(*callback);
if (callback.node() == nullptr) continue;
callback.Invoke(isolate());
if (callback.callback()) second_pass_callbacks.push_back(callback);
freed_nodes++;
}
}
pending_phantom_callbacks_.Clear();
if (second_pass_callbacks.length() > 0) {
pending_phantom_callbacks_.clear();
if (!second_pass_callbacks.empty()) {
if (FLAG_optimize_for_size || FLAG_predictable || synchronous_second_pass) {
isolate()->heap()->CallGCPrologueCallbacks(
GCType::kGCTypeProcessWeakCallbacks, kNoGCCallbackFlags);
......@@ -913,8 +908,7 @@ void GlobalHandles::IterateAllRoots(RootVisitor* v) {
DISABLE_CFI_PERF
void GlobalHandles::IterateAllNewSpaceRoots(RootVisitor* v) {
for (int i = 0; i < new_space_nodes_.length(); ++i) {
Node* node = new_space_nodes_[i];
for (Node* node : new_space_nodes_) {
if (node->IsRetainer()) {
v->VisitRootPointer(Root::kGlobalHandles, node->location());
}
......@@ -925,7 +919,7 @@ DISABLE_CFI_PERF
void GlobalHandles::IterateNewSpaceRoots(RootVisitor* v, size_t start,
size_t end) {
for (size_t i = start; i < end; ++i) {
Node* node = new_space_nodes_[static_cast<int>(i)];
Node* node = new_space_nodes_[i];
if (node->IsRetainer()) {
v->VisitRootPointer(Root::kGlobalHandles, node->location());
}
......@@ -955,8 +949,7 @@ void GlobalHandles::IterateAllRootsWithClassIds(
DISABLE_CFI_PERF
void GlobalHandles::IterateAllRootsInNewSpaceWithClassIds(
v8::PersistentHandleVisitor* visitor) {
for (int i = 0; i < new_space_nodes_.length(); ++i) {
Node* node = new_space_nodes_[i];
for (Node* node : new_space_nodes_) {
if (node->IsRetainer() && node->has_wrapper_class_id()) {
ApplyPersistentHandleVisitor(visitor, node);
}
......@@ -967,8 +960,7 @@ void GlobalHandles::IterateAllRootsInNewSpaceWithClassIds(
DISABLE_CFI_PERF
void GlobalHandles::IterateWeakRootsInNewSpaceWithClassIds(
v8::PersistentHandleVisitor* visitor) {
for (int i = 0; i < new_space_nodes_.length(); ++i) {
Node* node = new_space_nodes_[i];
for (Node* node : new_space_nodes_) {
if (node->has_wrapper_class_id() && node->IsWeak()) {
ApplyPersistentHandleVisitor(visitor, node);
}
......@@ -1044,14 +1036,13 @@ EternalHandles::EternalHandles() : size_(0) {
EternalHandles::~EternalHandles() {
for (int i = 0; i < blocks_.length(); i++) delete[] blocks_[i];
for (Object** block : blocks_) delete[] block;
}
void EternalHandles::IterateAllRoots(RootVisitor* visitor) {
int limit = size_;
for (int i = 0; i < blocks_.length(); i++) {
for (Object** block : blocks_) {
DCHECK(limit > 0);
Object** block = blocks_[i];
visitor->VisitRootPointers(Root::kEternalHandles, block,
block + Min(limit, kSize));
limit -= kSize;
......@@ -1059,22 +1050,21 @@ void EternalHandles::IterateAllRoots(RootVisitor* visitor) {
}
void EternalHandles::IterateNewSpaceRoots(RootVisitor* visitor) {
for (int i = 0; i < new_space_indices_.length(); i++) {
visitor->VisitRootPointer(Root::kEternalHandles,
GetLocation(new_space_indices_[i]));
for (int index : new_space_indices_) {
visitor->VisitRootPointer(Root::kEternalHandles, GetLocation(index));
}
}
void EternalHandles::PostGarbageCollectionProcessing(Heap* heap) {
int last = 0;
for (int i = 0; i < new_space_indices_.length(); i++) {
int index = new_space_indices_[i];
size_t last = 0;
for (int index : new_space_indices_) {
if (heap->InNewSpace(*GetLocation(index))) {
new_space_indices_[last++] = index;
}
}
new_space_indices_.Rewind(last);
DCHECK_LE(last, new_space_indices_.size());
new_space_indices_.resize(last);
}
......@@ -1089,12 +1079,12 @@ void EternalHandles::Create(Isolate* isolate, Object* object, int* index) {
Object** next_block = new Object*[kSize];
Object* the_hole = isolate->heap()->the_hole_value();
MemsetPointer(next_block, the_hole, kSize);
blocks_.Add(next_block);
blocks_.push_back(next_block);
}
DCHECK_EQ(isolate->heap()->the_hole_value(), blocks_[block][offset]);
blocks_[block][offset] = object;
if (isolate->heap()->InNewSpace(object)) {
new_space_indices_.Add(size_);
new_space_indices_.push_back(size_);
}
*index = size_++;
}
......
......@@ -6,12 +6,12 @@
#define V8_GLOBAL_HANDLES_H_
#include <type_traits>
#include <vector>
#include "include/v8.h"
#include "include/v8-profiler.h"
#include "src/handles.h"
#include "src/list.h"
#include "src/utils.h"
namespace v8 {
......@@ -92,7 +92,7 @@ class GlobalHandles {
number_of_phantom_handle_resets_ = 0;
}
size_t NumberOfNewSpaceNodes() { return new_space_nodes_.length(); }
size_t NumberOfNewSpaceNodes() { return new_space_nodes_.size(); }
// Clear the weakness of a global handle.
static void* ClearWeakness(Object** location);
......@@ -188,7 +188,7 @@ class GlobalHandles {
// Helpers for PostGarbageCollectionProcessing.
static void InvokeSecondPassPhantomCallbacks(
List<PendingPhantomCallback>* callbacks, Isolate* isolate);
std::vector<PendingPhantomCallback>* callbacks, Isolate* isolate);
int PostScavengeProcessing(int initial_post_gc_processing_count);
int PostMarkSweepProcessing(int initial_post_gc_processing_count);
int DispatchPendingPhantomCallbacks(bool synchronous_second_pass);
......@@ -212,13 +212,13 @@ class GlobalHandles {
// Contains all nodes holding new space objects. Note: when the list
// is accessed, some of the objects may have been promoted already.
List<Node*> new_space_nodes_;
std::vector<Node*> new_space_nodes_;
int post_gc_processing_count_;
size_t number_of_phantom_handle_resets_;
List<PendingPhantomCallback> pending_phantom_callbacks_;
std::vector<PendingPhantomCallback> pending_phantom_callbacks_;
friend class Isolate;
......@@ -311,8 +311,8 @@ class EternalHandles {
}
int size_;
List<Object**> blocks_;
List<int> new_space_indices_;
std::vector<Object**> blocks_;
std::vector<int> new_space_indices_;
int singleton_handles_[NUMBER_OF_SINGLETON_HANDLES];
DISALLOW_COPY_AND_ASSIGN(EternalHandles);
......
......@@ -411,7 +411,7 @@ void IC::ConfigureVectorState(Handle<Name> name, Handle<Map> map,
}
void IC::ConfigureVectorState(Handle<Name> name, MapHandles const& maps,
List<Handle<Object>>* handlers) {
ObjectHandles* handlers) {
DCHECK(!IsLoadGlobalIC());
// Non-keyed ICs don't track the name explicitly.
if (!is_keyed()) name = Handle<Name>::null();
......@@ -518,7 +518,7 @@ bool IC::UpdatePolymorphicIC(Handle<Name> name, Handle<Object> handler) {
if (is_keyed() && state() != RECOMPUTE_HANDLER) return false;
Handle<Map> map = receiver_map();
MapHandles maps;
List<Handle<Object>> handlers;
ObjectHandles handlers;
TargetMaps(&maps);
int number_of_maps = static_cast<int>(maps.size());
......@@ -558,13 +558,13 @@ bool IC::UpdatePolymorphicIC(Handle<Name> name, Handle<Object> handler) {
ConfigureVectorState(name, receiver_map(), handler);
} else {
if (handler_to_overwrite >= 0) {
handlers.Set(handler_to_overwrite, handler);
handlers[handler_to_overwrite] = handler;
if (!map.is_identical_to(maps.at(handler_to_overwrite))) {
maps[handler_to_overwrite] = map;
}
} else {
maps.push_back(map);
handlers.Add(handler);
handlers.push_back(handler);
}
ConfigureVectorState(name, maps, &handlers);
......@@ -581,7 +581,7 @@ void IC::UpdateMonomorphicIC(Handle<Object> handler, Handle<Name> name) {
void IC::CopyICToMegamorphicCache(Handle<Name> name) {
MapHandles maps;
List<Handle<Object>> handlers;
ObjectHandles handlers;
TargetMaps(&maps);
if (!nexus()->FindHandlers(&handlers, static_cast<int>(maps.size()))) return;
for (int i = 0; i < static_cast<int>(maps.size()); i++) {
......@@ -1276,12 +1276,12 @@ void KeyedLoadIC::UpdateLoadElement(Handle<HeapObject> receiver) {
return;
}
List<Handle<Object>> handlers(static_cast<int>(target_receiver_maps.size()));
ObjectHandles handlers;
handlers.reserve(target_receiver_maps.size());
LoadElementPolymorphicHandlers(&target_receiver_maps, &handlers);
DCHECK_LE(1, target_receiver_maps.size());
if (target_receiver_maps.size() == 1) {
ConfigureVectorState(Handle<Name>(), target_receiver_maps[0],
handlers.at(0));
ConfigureVectorState(Handle<Name>(), target_receiver_maps[0], handlers[0]);
} else {
ConfigureVectorState(Handle<Name>(), target_receiver_maps, &handlers);
}
......@@ -1328,8 +1328,8 @@ Handle<Object> KeyedLoadIC::LoadElementHandler(Handle<Map> receiver_map) {
convert_hole_to_undefined, is_js_array);
}
void KeyedLoadIC::LoadElementPolymorphicHandlers(
MapHandles* receiver_maps, List<Handle<Object>>* handlers) {
void KeyedLoadIC::LoadElementPolymorphicHandlers(MapHandles* receiver_maps,
ObjectHandles* handlers) {
// Filter out deprecated maps to ensure their instances get migrated.
receiver_maps->erase(
std::remove_if(
......@@ -1347,7 +1347,7 @@ void KeyedLoadIC::LoadElementPolymorphicHandlers(
receiver_map->NotifyLeafMapLayoutChange();
}
}
handlers->Add(LoadElementHandler(receiver_map));
handlers->push_back(LoadElementHandler(receiver_map));
}
}
......@@ -1959,13 +1959,13 @@ void KeyedStoreIC::UpdateStoreElement(Handle<Map> receiver_map,
}
}
List<Handle<Object>> handlers(static_cast<int>(target_receiver_maps.size()));
ObjectHandles handlers;
handlers.reserve(target_receiver_maps.size());
StoreElementPolymorphicHandlers(&target_receiver_maps, &handlers, store_mode);
if (target_receiver_maps.size() == 0) {
ConfigureVectorState(PREMONOMORPHIC, Handle<Name>());
} else if (target_receiver_maps.size() == 1) {
ConfigureVectorState(Handle<Name>(), target_receiver_maps[0],
handlers.at(0));
ConfigureVectorState(Handle<Name>(), target_receiver_maps[0], handlers[0]);
} else {
ConfigureVectorState(Handle<Name>(), target_receiver_maps, &handlers);
}
......@@ -2032,7 +2032,7 @@ Handle<Object> KeyedStoreIC::StoreElementHandler(
}
void KeyedStoreIC::StoreElementPolymorphicHandlers(
MapHandles* receiver_maps, List<Handle<Object>>* handlers,
MapHandles* receiver_maps, ObjectHandles* handlers,
KeyedAccessStoreMode store_mode) {
DCHECK(store_mode == STANDARD_STORE ||
store_mode == STORE_AND_GROW_NO_TRANSITION ||
......@@ -2097,7 +2097,7 @@ void KeyedStoreIC::StoreElementPolymorphicHandlers(
}
}
DCHECK(!handler.is_null());
handlers->Add(handler);
handlers->push_back(handler);
}
}
......
......@@ -5,6 +5,8 @@
#ifndef V8_IC_H_
#define V8_IC_H_
#include <vector>
#include "src/factory.h"
#include "src/feedback-vector.h"
#include "src/macro-assembler.h"
......@@ -93,7 +95,7 @@ class IC {
Handle<Object> handler);
// Configure the vector for POLYMORPHIC.
void ConfigureVectorState(Handle<Name> name, MapHandles const& maps,
List<Handle<Object>>* handlers);
ObjectHandles* handlers);
char TransitionMarkFromState(IC::State state);
void TraceIC(const char* type, Handle<Object> name);
......@@ -314,7 +316,7 @@ class KeyedLoadIC : public LoadIC {
Handle<Object> LoadElementHandler(Handle<Map> receiver_map);
void LoadElementPolymorphicHandlers(MapHandles* receiver_maps,
List<Handle<Object>>* handlers);
ObjectHandles* handlers);
};
......@@ -403,7 +405,7 @@ class KeyedStoreIC : public StoreIC {
KeyedAccessStoreMode store_mode);
void StoreElementPolymorphicHandlers(MapHandles* receiver_maps,
List<Handle<Object>>* handlers,
ObjectHandles* handlers,
KeyedAccessStoreMode store_mode);
friend class IC;
......
......@@ -6,7 +6,6 @@
#include "src/ast/ast-value-factory.h"
#include "src/ast/ast.h"
#include "src/list-inl.h"
#include "src/objects-inl.h"
namespace v8 {
......
......@@ -13,7 +13,6 @@
#include "src/ast/ast-value-factory.h"
#include "src/char-predicates-inl.h"
#include "src/conversions-inl.h"
#include "src/list-inl.h"
#include "src/parsing/duplicate-finder.h" // For Scanner::FindSymbol
namespace v8 {
......
......@@ -6,7 +6,6 @@
#include "src/external-reference-table.h"
#include "src/ic/stub-cache.h"
#include "src/list-inl.h"
#include "src/objects-inl.h"
namespace v8 {
......
......@@ -8,7 +8,6 @@
#include "src/base/platform/time.h"
#include "src/flags.h"
#include "src/isolate.h"
#include "src/list-inl.h"
#include "src/objects-inl.h"
#include "src/v8.h"
......@@ -101,9 +100,9 @@ SaveFlags::SaveFlags() { non_default_flags_ = FlagList::argv(); }
SaveFlags::~SaveFlags() {
FlagList::ResetAllFlags();
int argc = non_default_flags_->length();
int argc = static_cast<int>(non_default_flags_->size());
FlagList::SetFlagsFromCommandLine(
&argc, const_cast<char**>(non_default_flags_->begin()),
&argc, const_cast<char**>(non_default_flags_->data()),
false /* remove_flags */);
for (auto flag = non_default_flags_->begin();
flag != non_default_flags_->end(); ++flag) {
......
......@@ -5,10 +5,11 @@
#ifndef V8_UNITTESTS_TEST_UTILS_H_
#define V8_UNITTESTS_TEST_UTILS_H_
#include <vector>
#include "include/v8.h"
#include "src/base/macros.h"
#include "src/base/utils/random-number-generator.h"
#include "src/list.h"
#include "src/zone/accounting-allocator.h"
#include "src/zone/zone.h"
#include "testing/gtest-support.h"
......@@ -142,7 +143,7 @@ class SaveFlags {
~SaveFlags();
private:
List<const char*>* non_default_flags_;
std::vector<const char*>* non_default_flags_;
DISALLOW_COPY_AND_ASSIGN(SaveFlags);
};
......
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