Skip to content

Commit

Permalink
deps: upgrade to V8 4.7.80.32
Browse files Browse the repository at this point in the history
Pick up the latest fixes on the V8 4.7 branch
v8/v8@4.7.80.25...4.7.80.32

PR-URL: #4699
Reviewed-By: cjihrig - Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: trevnorris - Trevor Norris <trev.norris@gmail.com>
Reviewed-By: jasnell - James M Snell <jasnell@gmail.com>
Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com>
  • Loading branch information
ofrobots committed Jan 15, 2016
1 parent 212a44d commit 384b203
Show file tree
Hide file tree
Showing 14 changed files with 10,251 additions and 121 deletions.
2 changes: 1 addition & 1 deletion deps/v8/include/v8-version.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#define V8_MAJOR_VERSION 4
#define V8_MINOR_VERSION 7
#define V8_BUILD_NUMBER 80
#define V8_PATCH_LEVEL 25
#define V8_PATCH_LEVEL 32

// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
Expand Down
3 changes: 1 addition & 2 deletions deps/v8/src/code-stubs-hydrogen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,7 @@ HValue* CodeStubGraphBuilder<TypeofStub>::BuildCodeStub() {
// Is it an undetectable object?
IfBuilder is_undetectable(this);
is_undetectable.If<HCompareNumericAndBranch>(
bit_field_masked, Add<HConstant>(1 << Map::kIsUndetectable),
Token::EQ);
bit_field_masked, graph()->GetConstant0(), Token::NE);
is_undetectable.Then();
{
// typeof an undetectable object is 'undefined'.
Expand Down
125 changes: 80 additions & 45 deletions deps/v8/src/elements.cc
Original file line number Diff line number Diff line change
Expand Up @@ -691,11 +691,12 @@ class ElementsAccessorBase : public ElementsAccessor {
}

virtual void SetLength(Handle<JSArray> array, uint32_t length) final {
ElementsAccessorSubclass::SetLengthImpl(array, length,
ElementsAccessorSubclass::SetLengthImpl(array->GetIsolate(), array, length,
handle(array->elements()));
}

static void SetLengthImpl(Handle<JSArray> array, uint32_t length,
static void SetLengthImpl(Isolate* isolate, Handle<JSArray> array,
uint32_t length,
Handle<FixedArrayBase> backing_store) {
DCHECK(!array->SetLengthWouldNormalize(length));
DCHECK(IsFastElementsKind(array->GetElementsKind()));
Expand All @@ -712,6 +713,7 @@ class ElementsAccessorBase : public ElementsAccessor {

// Check whether the backing store should be shrunk.
uint32_t capacity = backing_store->length();
old_length = Min(old_length, capacity);
if (length == 0) {
array->initialize_elements();
} else if (length <= capacity) {
Expand All @@ -720,7 +722,7 @@ class ElementsAccessorBase : public ElementsAccessor {
}
if (2 * length <= capacity) {
// If more than half the elements won't be used, trim the array.
array->GetHeap()->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(
isolate->heap()->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(
*backing_store, capacity - length);
} else {
// Otherwise, fill the unused tail with holes.
Expand Down Expand Up @@ -954,11 +956,11 @@ class DictionaryElementsAccessor
: ElementsAccessorBase<DictionaryElementsAccessor,
ElementsKindTraits<DICTIONARY_ELEMENTS> >(name) {}

static void SetLengthImpl(Handle<JSArray> array, uint32_t length,
static void SetLengthImpl(Isolate* isolate, Handle<JSArray> array,
uint32_t length,
Handle<FixedArrayBase> backing_store) {
Handle<SeededNumberDictionary> dict =
Handle<SeededNumberDictionary>::cast(backing_store);
Isolate* isolate = array->GetIsolate();
int capacity = dict->Capacity();
uint32_t old_length = 0;
CHECK(array->length()->ToArrayLength(&old_length));
Expand Down Expand Up @@ -1181,13 +1183,18 @@ class FastElementsAccessor
}
int num_used = 0;
for (int i = 0; i < backing_store->length(); ++i) {
if (!backing_store->is_the_hole(i)) ++num_used;
// Bail out early if more than 1/4 is used.
if (4 * num_used > backing_store->length()) break;
}
if (4 * num_used <= backing_store->length()) {
JSObject::NormalizeElements(obj);
if (!backing_store->is_the_hole(i)) {
++num_used;
// Bail out if a number dictionary wouldn't be able to save at least
// 75% space.
if (4 * SeededNumberDictionary::ComputeCapacity(num_used) *
SeededNumberDictionary::kEntrySize >
backing_store->length()) {
return;
}
}
}
JSObject::NormalizeElements(obj);
}
}

Expand Down Expand Up @@ -1293,9 +1300,10 @@ class FastElementsAccessor
receiver, backing_store, args, unshift_size, AT_START);
}

static void MoveElements(Heap* heap, Handle<FixedArrayBase> backing_store,
int dst_index, int src_index, int len,
int hole_start, int hole_end) {
static void MoveElements(Isolate* isolate, Handle<JSArray> receiver,
Handle<FixedArrayBase> backing_store, int dst_index,
int src_index, int len, int hole_start,
int hole_end) {
UNREACHABLE();
}

Expand Down Expand Up @@ -1344,13 +1352,13 @@ class FastElementsAccessor

// Delete and move elements to make space for add_count new elements.
if (add_count < delete_count) {
FastElementsAccessorSubclass::SpliceShrinkStep(backing_store, heap, start,
delete_count, add_count,
length, new_length);
FastElementsAccessorSubclass::SpliceShrinkStep(
isolate, receiver, backing_store, start, delete_count, add_count,
length, new_length);
} else if (add_count > delete_count) {
backing_store = FastElementsAccessorSubclass::SpliceGrowStep(
receiver, backing_store, isolate, heap, start, delete_count,
add_count, length, new_length);
isolate, receiver, backing_store, start, delete_count, add_count,
length, new_length);
}

// Copy over the arguments.
Expand All @@ -1364,29 +1372,33 @@ class FastElementsAccessor
}

private:
static void SpliceShrinkStep(Handle<FixedArrayBase> backing_store, Heap* heap,
// SpliceShrinkStep might modify the backing_store.
static void SpliceShrinkStep(Isolate* isolate, Handle<JSArray> receiver,
Handle<FixedArrayBase> backing_store,
uint32_t start, uint32_t delete_count,
uint32_t add_count, uint32_t len,
uint32_t new_length) {
const int move_left_count = len - delete_count - start;
const int move_left_dst_index = start + add_count;
FastElementsAccessorSubclass::MoveElements(
heap, backing_store, move_left_dst_index, start + delete_count,
move_left_count, new_length, len);
isolate, receiver, backing_store, move_left_dst_index,
start + delete_count, move_left_count, new_length, len);
}


// SpliceGrowStep might modify the backing_store.
static Handle<FixedArrayBase> SpliceGrowStep(
Handle<JSArray> receiver, Handle<FixedArrayBase> backing_store,
Isolate* isolate, Heap* heap, uint32_t start, uint32_t delete_count,
uint32_t add_count, uint32_t length, uint32_t new_length) {
Isolate* isolate, Handle<JSArray> receiver,
Handle<FixedArrayBase> backing_store, uint32_t start,
uint32_t delete_count, uint32_t add_count, uint32_t length,
uint32_t new_length) {
// Check we do not overflow the new_length.
DCHECK((add_count - delete_count) <= (Smi::kMaxValue - length));
// Check if backing_store is big enough.
if (new_length <= static_cast<uint32_t>(backing_store->length())) {
FastElementsAccessorSubclass::MoveElements(
heap, backing_store, start + add_count, start + delete_count,
(length - delete_count - start), 0, 0);
isolate, receiver, backing_store, start + add_count,
start + delete_count, (length - delete_count - start), 0, 0);
// MoveElements updates the backing_store in-place.
return backing_store;
}
// New backing storage is needed.
Expand All @@ -1407,20 +1419,19 @@ class FastElementsAccessor
static Handle<Object> RemoveElement(Handle<JSArray> receiver,
Handle<FixedArrayBase> backing_store,
Where remove_position) {
Isolate* isolate = receiver->GetIsolate();
uint32_t length =
static_cast<uint32_t>(Smi::cast(receiver->length())->value());
Isolate* isolate = receiver->GetIsolate();
DCHECK(length > 0);
int new_length = length - 1;
int remove_index = remove_position == AT_START ? 0 : new_length;
Handle<Object> result =
FastElementsAccessorSubclass::GetImpl(backing_store, remove_index);
if (remove_position == AT_START) {
Heap* heap = isolate->heap();
FastElementsAccessorSubclass::MoveElements(heap, backing_store, 0, 1,
new_length, 0, 0);
FastElementsAccessorSubclass::MoveElements(
isolate, receiver, backing_store, 0, 1, new_length, 0, 0);
}
FastElementsAccessorSubclass::SetLengthImpl(receiver, new_length,
FastElementsAccessorSubclass::SetLengthImpl(isolate, receiver, new_length,
backing_store);

if (IsHoleyElementsKind(KindTraits::Kind) && result->IsTheHole()) {
Expand Down Expand Up @@ -1454,8 +1465,8 @@ class FastElementsAccessor
// If the backing store has enough capacity and we add elements to the
// start we have to shift the existing objects.
Isolate* isolate = receiver->GetIsolate();
FastElementsAccessorSubclass::MoveElements(isolate->heap(), backing_store,
add_size, 0, length, 0, 0);
FastElementsAccessorSubclass::MoveElements(
isolate, receiver, backing_store, add_size, 0, length, 0, 0);
}

int insertion_index = remove_position == AT_START ? 0 : length;
Expand Down Expand Up @@ -1508,11 +1519,22 @@ class FastSmiOrObjectElementsAccessor
return backing_store->get(index);
}

static void MoveElements(Heap* heap, Handle<FixedArrayBase> backing_store,
int dst_index, int src_index, int len,
int hole_start, int hole_end) {
static void MoveElements(Isolate* isolate, Handle<JSArray> receiver,
Handle<FixedArrayBase> backing_store, int dst_index,
int src_index, int len, int hole_start,
int hole_end) {
Heap* heap = isolate->heap();
Handle<FixedArray> dst_elms = Handle<FixedArray>::cast(backing_store);
if (len != 0) {
if (heap->CanMoveObjectStart(*dst_elms) && dst_index == 0) {
// Update all the copies of this backing_store handle.
*dst_elms.location() =
FixedArray::cast(heap->LeftTrimFixedArray(*dst_elms, src_index));
receiver->set_elements(*dst_elms);
// Adjust the hole offset as the array has been shrunk.
hole_end -= src_index;
DCHECK_LE(hole_start, backing_store->length());
DCHECK_LE(hole_end, backing_store->length());
} else if (len != 0) {
DisallowHeapAllocation no_gc;
heap->MoveElements(*dst_elms, dst_index, src_index, len);
}
Expand Down Expand Up @@ -1631,12 +1653,23 @@ class FastDoubleElementsAccessor
FixedDoubleArray::cast(backing_store)->set(entry, value->Number());
}

static void MoveElements(Heap* heap, Handle<FixedArrayBase> backing_store,
int dst_index, int src_index, int len,
int hole_start, int hole_end) {
static void MoveElements(Isolate* isolate, Handle<JSArray> receiver,
Handle<FixedArrayBase> backing_store, int dst_index,
int src_index, int len, int hole_start,
int hole_end) {
Heap* heap = isolate->heap();
Handle<FixedDoubleArray> dst_elms =
Handle<FixedDoubleArray>::cast(backing_store);
if (len != 0) {
if (heap->CanMoveObjectStart(*dst_elms) && dst_index == 0) {
// Update all the copies of this backing_store handle.
*dst_elms.location() = FixedDoubleArray::cast(
heap->LeftTrimFixedArray(*dst_elms, src_index));
receiver->set_elements(*dst_elms);
// Adjust the hole offset as the array has been shrunk.
hole_end -= src_index;
DCHECK_LE(hole_start, backing_store->length());
DCHECK_LE(hole_end, backing_store->length());
} else if (len != 0) {
MemMove(dst_elms->data_start() + dst_index,
dst_elms->data_start() + src_index, len * kDoubleSize);
}
Expand Down Expand Up @@ -1742,7 +1775,8 @@ class TypedElementsAccessor
return PropertyDetails(DONT_DELETE, DATA, 0, PropertyCellType::kNoCell);
}

static void SetLengthImpl(Handle<JSArray> array, uint32_t length,
static void SetLengthImpl(Isolate* isolate, Handle<JSArray> array,
uint32_t length,
Handle<FixedArrayBase> backing_store) {
// External arrays do not support changing their length.
UNREACHABLE();
Expand Down Expand Up @@ -1856,7 +1890,8 @@ class SloppyArgumentsElementsAccessor
}
}

static void SetLengthImpl(Handle<JSArray> array, uint32_t length,
static void SetLengthImpl(Isolate* isolate, Handle<JSArray> array,
uint32_t length,
Handle<FixedArrayBase> parameter_map) {
// Sloppy arguments objects are not arrays.
UNREACHABLE();
Expand Down
2 changes: 1 addition & 1 deletion deps/v8/src/flag-definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ DEFINE_IMPLICATION(trace_detached_contexts, track_detached_contexts)
#ifdef VERIFY_HEAP
DEFINE_BOOL(verify_heap, false, "verify heap pointers before and after GC")
#endif
DEFINE_BOOL(move_object_start, false, "enable moving of object starts")
DEFINE_BOOL(move_object_start, true, "enable moving of object starts")

// counters.cc
DEFINE_INT(histogram_interval, 600000,
Expand Down
38 changes: 25 additions & 13 deletions deps/v8/src/func-name-inferrer.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,29 @@ class FuncNameInferrer : public ZoneObject {
public:
FuncNameInferrer(AstValueFactory* ast_value_factory, Zone* zone);

// To enter function name inference state, put a FuncNameInferrer::State
// on the stack.
class State {
public:
explicit State(FuncNameInferrer* fni) : fni_(fni) {
if (fni_ != nullptr) fni_->Enter();
}
~State() {
if (fni_ != nullptr) fni_->Leave();
}

private:
FuncNameInferrer* fni_;

DISALLOW_COPY_AND_ASSIGN(State);
};

// Returns whether we have entered name collection state.
bool IsOpen() const { return !entries_stack_.is_empty(); }

// Pushes an enclosing the name of enclosing function onto names stack.
void PushEnclosingName(const AstRawString* name);

// Enters name collection state.
void Enter() {
entries_stack_.Add(names_stack_.length(), zone());
}

// Pushes an encountered name onto names stack when in collection state.
void PushLiteralName(const AstRawString* name);

Expand All @@ -67,14 +79,6 @@ class FuncNameInferrer : public ZoneObject {
}
}

// Leaves names collection state.
void Leave() {
DCHECK(IsOpen());
names_stack_.Rewind(entries_stack_.RemoveLast());
if (entries_stack_.is_empty())
funcs_to_infer_.Clear();
}

private:
enum NameType {
kEnclosingConstructorName,
Expand All @@ -87,6 +91,14 @@ class FuncNameInferrer : public ZoneObject {
NameType type;
};

void Enter() { entries_stack_.Add(names_stack_.length(), zone()); }

void Leave() {
DCHECK(IsOpen());
names_stack_.Rewind(entries_stack_.RemoveLast());
if (entries_stack_.is_empty()) funcs_to_infer_.Clear();
}

Zone* zone() const { return zone_; }

// Constructs a full name in dotted notation from gathered names.
Expand Down
11 changes: 8 additions & 3 deletions deps/v8/src/heap/heap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5993,9 +5993,14 @@ void Heap::FilterStoreBufferEntriesOnAboutToBeFreedPages() {

void Heap::FreeQueuedChunks() {
if (chunks_queued_for_free_ != NULL) {
V8::GetCurrentPlatform()->CallOnBackgroundThread(
new UnmapFreeMemoryTask(this, chunks_queued_for_free_),
v8::Platform::kShortRunningTask);
if (FLAG_concurrent_sweeping) {
V8::GetCurrentPlatform()->CallOnBackgroundThread(
new UnmapFreeMemoryTask(this, chunks_queued_for_free_),
v8::Platform::kShortRunningTask);
} else {
FreeQueuedChunks(chunks_queued_for_free_);
pending_unmapping_tasks_semaphore_.Signal();
}
chunks_queued_for_free_ = NULL;
} else {
// If we do not have anything to unmap, we just signal the semaphore
Expand Down
Loading

0 comments on commit 384b203

Please sign in to comment.