Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

next: Update v8 to 4.3.61.27 #1909

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 3
#define V8_BUILD_NUMBER 61
#define V8_PATCH_LEVEL 21
#define V8_PATCH_LEVEL 27

// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
Expand Down
36 changes: 18 additions & 18 deletions deps/v8/include/v8.h
Original file line number Diff line number Diff line change
Expand Up @@ -1018,24 +1018,6 @@ class V8_EXPORT EscapableHandleScope : public HandleScope {
internal::Object** escape_slot_;
};

class V8_EXPORT SealHandleScope {
public:
SealHandleScope(Isolate* isolate);
~SealHandleScope();

private:
// Make it hard to create heap-allocated or illegal handle scopes by
// disallowing certain operations.
SealHandleScope(const SealHandleScope&);
void operator=(const SealHandleScope&);
void* operator new(size_t size);
void operator delete(void*, size_t);

internal::Isolate* isolate_;
int prev_level_;
internal::Object** prev_limit_;
};


// --- Special objects ---

Expand Down Expand Up @@ -1090,6 +1072,24 @@ class ScriptOrigin {
Handle<Value> source_map_url_;
};

class V8_EXPORT SealHandleScope {
public:
SealHandleScope(Isolate* isolate);
~SealHandleScope();

private:
// Make it hard to create heap-allocated or illegal handle scopes by
// disallowing certain operations.
SealHandleScope(const SealHandleScope&);
void operator=(const SealHandleScope&);
void* operator new(size_t size);
void operator delete(void*, size_t);

internal::Isolate* isolate_;
int prev_level_;
internal::Object** prev_limit_;
};


/**
* A compiled JavaScript script, not yet tied to a Context.
Expand Down
33 changes: 10 additions & 23 deletions deps/v8/src/arm/full-codegen-arm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1698,21 +1698,13 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
__ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset));
__ mov(r2, Operand(Smi::FromInt(expr->literal_index())));
__ mov(r1, Operand(constant_properties));
int flags = expr->fast_elements()
? ObjectLiteral::kFastElements
: ObjectLiteral::kNoFlags;
flags |= expr->has_function()
? ObjectLiteral::kHasFunction
: ObjectLiteral::kNoFlags;
int flags = expr->ComputeFlags();
__ mov(r0, Operand(Smi::FromInt(flags)));
int properties_count = constant_properties->length() / 2;
if (expr->may_store_doubles() || expr->depth() > 1 ||
masm()->serializer_enabled() || flags != ObjectLiteral::kFastElements ||
properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) {
if (MustCreateObjectLiteralWithRuntime(expr)) {
__ Push(r3, r2, r1, r0);
__ CallRuntime(Runtime::kCreateObjectLiteral, 4);
} else {
FastCloneShallowObjectStub stub(isolate(), properties_count);
FastCloneShallowObjectStub stub(isolate(), expr->properties_count());
__ CallStub(&stub);
}
PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG);
Expand Down Expand Up @@ -1904,17 +1896,10 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
Comment cmnt(masm_, "[ ArrayLiteral");

expr->BuildConstantElements(isolate());
int flags = expr->depth() == 1
? ArrayLiteral::kShallowElements
: ArrayLiteral::kNoFlags;

ZoneList<Expression*>* subexprs = expr->values();
int length = subexprs->length();
Handle<FixedArray> constant_elements = expr->constant_elements();
DCHECK_EQ(2, constant_elements->length());
ElementsKind constant_elements_kind =
static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value());
bool has_fast_elements = IsFastObjectElementsKind(constant_elements_kind);
bool has_fast_elements =
IsFastObjectElementsKind(expr->constant_elements_kind());
Handle<FixedArrayBase> constant_elements_values(
FixedArrayBase::cast(constant_elements->get(1)));

Expand All @@ -1929,8 +1914,8 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
__ ldr(r3, FieldMemOperand(r3, JSFunction::kLiteralsOffset));
__ mov(r2, Operand(Smi::FromInt(expr->literal_index())));
__ mov(r1, Operand(constant_elements));
if (expr->depth() > 1 || length > JSObject::kInitialMaxFastElementArray) {
__ mov(r0, Operand(Smi::FromInt(flags)));
if (MustCreateArrayLiteralWithRuntime(expr)) {
__ mov(r0, Operand(Smi::FromInt(expr->ComputeFlags())));
__ Push(r3, r2, r1, r0);
__ CallRuntime(Runtime::kCreateArrayLiteral, 4);
} else {
Expand All @@ -1940,6 +1925,8 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG);

bool result_saved = false; // Is the result saved to the stack?
ZoneList<Expression*>* subexprs = expr->values();
int length = subexprs->length();

// Emit code to evaluate all the non-constant subexpressions and to store
// them into the newly cloned array.
Expand All @@ -1956,7 +1943,7 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
}
VisitForAccumulatorValue(subexpr);

if (IsFastObjectElementsKind(constant_elements_kind)) {
if (has_fast_elements) {
int offset = FixedArray::kHeaderSize + (i * kPointerSize);
__ ldr(r6, MemOperand(sp, kPointerSize)); // Copy of array literal.
__ ldr(r1, FieldMemOperand(r6, JSObject::kElementsOffset));
Expand Down
37 changes: 10 additions & 27 deletions deps/v8/src/arm64/full-codegen-arm64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1677,23 +1677,13 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
__ Ldr(x3, FieldMemOperand(x3, JSFunction::kLiteralsOffset));
__ Mov(x2, Smi::FromInt(expr->literal_index()));
__ Mov(x1, Operand(constant_properties));
int flags = expr->fast_elements()
? ObjectLiteral::kFastElements
: ObjectLiteral::kNoFlags;
flags |= expr->has_function()
? ObjectLiteral::kHasFunction
: ObjectLiteral::kNoFlags;
int flags = expr->ComputeFlags();
__ Mov(x0, Smi::FromInt(flags));
int properties_count = constant_properties->length() / 2;
const int max_cloned_properties =
FastCloneShallowObjectStub::kMaximumClonedProperties;
if (expr->may_store_doubles() || expr->depth() > 1 ||
masm()->serializer_enabled() || flags != ObjectLiteral::kFastElements ||
properties_count > max_cloned_properties) {
if (MustCreateObjectLiteralWithRuntime(expr)) {
__ Push(x3, x2, x1, x0);
__ CallRuntime(Runtime::kCreateObjectLiteral, 4);
} else {
FastCloneShallowObjectStub stub(isolate(), properties_count);
FastCloneShallowObjectStub stub(isolate(), expr->properties_count());
__ CallStub(&stub);
}
PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG);
Expand Down Expand Up @@ -1885,18 +1875,9 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
Comment cmnt(masm_, "[ ArrayLiteral");

expr->BuildConstantElements(isolate());
int flags = (expr->depth() == 1) ? ArrayLiteral::kShallowElements
: ArrayLiteral::kNoFlags;

ZoneList<Expression*>* subexprs = expr->values();
int length = subexprs->length();
Handle<FixedArray> constant_elements = expr->constant_elements();
DCHECK_EQ(2, constant_elements->length());
ElementsKind constant_elements_kind =
static_cast<ElementsKind>(Smi::cast(constant_elements->get(0))->value());
bool has_fast_elements = IsFastObjectElementsKind(constant_elements_kind);
Handle<FixedArrayBase> constant_elements_values(
FixedArrayBase::cast(constant_elements->get(1)));
bool has_fast_elements =
IsFastObjectElementsKind(expr->constant_elements_kind());

AllocationSiteMode allocation_site_mode = TRACK_ALLOCATION_SITE;
if (has_fast_elements && !FLAG_allocation_site_pretenuring) {
Expand All @@ -1909,8 +1890,8 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
__ Ldr(x3, FieldMemOperand(x3, JSFunction::kLiteralsOffset));
__ Mov(x2, Smi::FromInt(expr->literal_index()));
__ Mov(x1, Operand(constant_elements));
if (expr->depth() > 1 || length > JSObject::kInitialMaxFastElementArray) {
__ Mov(x0, Smi::FromInt(flags));
if (MustCreateArrayLiteralWithRuntime(expr)) {
__ Mov(x0, Smi::FromInt(expr->ComputeFlags()));
__ Push(x3, x2, x1, x0);
__ CallRuntime(Runtime::kCreateArrayLiteral, 4);
} else {
Expand All @@ -1920,6 +1901,8 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
PrepareForBailoutForId(expr->CreateLiteralId(), TOS_REG);

bool result_saved = false; // Is the result saved to the stack?
ZoneList<Expression*>* subexprs = expr->values();
int length = subexprs->length();

// Emit code to evaluate all the non-constant subexpressions and to store
// them into the newly cloned array.
Expand All @@ -1936,7 +1919,7 @@ void FullCodeGenerator::VisitArrayLiteral(ArrayLiteral* expr) {
}
VisitForAccumulatorValue(subexpr);

if (IsFastObjectElementsKind(constant_elements_kind)) {
if (has_fast_elements) {
int offset = FixedArray::kHeaderSize + (i * kPointerSize);
__ Peek(x6, kPointerSize); // Copy of array literal.
__ Ldr(x1, FieldMemOperand(x6, JSObject::kElementsOffset));
Expand Down
1 change: 1 addition & 0 deletions deps/v8/src/ast.cc
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ void ObjectLiteral::BuildConstantProperties(Isolate* isolate) {
constant_properties_ = constant_properties;
fast_elements_ =
(max_element_index <= 32) || ((2 * elements) >= max_element_index);
has_elements_ = elements > 0;
set_is_simple(is_simple);
set_depth(depth_acc);
}
Expand Down
24 changes: 20 additions & 4 deletions deps/v8/src/ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -1482,10 +1482,12 @@ class ObjectLiteral FINAL : public MaterializedLiteral {
Handle<FixedArray> constant_properties() const {
return constant_properties_;
}
int properties_count() const { return constant_properties_->length() / 2; }
ZoneList<Property*>* properties() const { return properties_; }
bool fast_elements() const { return fast_elements_; }
bool may_store_doubles() const { return may_store_doubles_; }
bool has_function() const { return has_function_; }
bool has_elements() const { return has_elements_; }

// Decide if a property should be in the object boilerplate.
static bool IsBoilerplateProperty(Property* property);
Expand All @@ -1499,16 +1501,20 @@ class ObjectLiteral FINAL : public MaterializedLiteral {
void CalculateEmitStore(Zone* zone);

// Assemble bitfield of flags for the CreateObjectLiteral helper.
int ComputeFlags() const {
int ComputeFlags(bool disable_mementos = false) const {
int flags = fast_elements() ? kFastElements : kNoFlags;
flags |= has_function() ? kHasFunction : kNoFlags;
if (disable_mementos) {
flags |= kDisableMementos;
}
return flags;
}

enum Flags {
kNoFlags = 0,
kFastElements = 1,
kHasFunction = 1 << 1
kHasFunction = 1 << 1,
kDisableMementos = 1 << 2
};

struct Accessors: public ZoneObject {
Expand All @@ -1533,6 +1539,7 @@ class ObjectLiteral FINAL : public MaterializedLiteral {
properties_(properties),
boilerplate_properties_(boilerplate_properties),
fast_elements_(false),
has_elements_(false),
may_store_doubles_(false),
has_function_(has_function) {}
static int parent_num_ids() { return MaterializedLiteral::num_ids(); }
Expand All @@ -1543,6 +1550,7 @@ class ObjectLiteral FINAL : public MaterializedLiteral {
ZoneList<Property*>* properties_;
int boilerplate_properties_;
bool fast_elements_;
bool has_elements_;
bool may_store_doubles_;
bool has_function_;
};
Expand Down Expand Up @@ -1578,6 +1586,12 @@ class ArrayLiteral FINAL : public MaterializedLiteral {
DECLARE_NODE_TYPE(ArrayLiteral)

Handle<FixedArray> constant_elements() const { return constant_elements_; }
ElementsKind constant_elements_kind() const {
DCHECK_EQ(2, constant_elements_->length());
return static_cast<ElementsKind>(
Smi::cast(constant_elements_->get(0))->value());
}

ZoneList<Expression*>* values() const { return values_; }

BailoutId CreateLiteralId() const { return BailoutId(local_id(0)); }
Expand All @@ -1593,9 +1607,11 @@ class ArrayLiteral FINAL : public MaterializedLiteral {
void BuildConstantElements(Isolate* isolate);

// Assemble bitfield of flags for the CreateArrayLiteral helper.
int ComputeFlags() const {
int ComputeFlags(bool disable_mementos = false) const {
int flags = depth() == 1 ? kShallowElements : kNoFlags;
flags |= ArrayLiteral::kDisableMementos;
if (disable_mementos) {
flags |= kDisableMementos;
}
return flags;
}

Expand Down
4 changes: 2 additions & 2 deletions deps/v8/src/compiler/ast-graph-builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1627,7 +1627,7 @@ void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
BuildLoadObjectField(closure, JSFunction::kLiteralsOffset);
Node* literal_index = jsgraph()->Constant(expr->literal_index());
Node* constants = jsgraph()->Constant(expr->constant_properties());
Node* flags = jsgraph()->Constant(expr->ComputeFlags());
Node* flags = jsgraph()->Constant(expr->ComputeFlags(true));
const Operator* op =
javascript()->CallRuntime(Runtime::kCreateObjectLiteral, 4);
Node* literal = NewNode(op, literals_array, literal_index, constants, flags);
Expand Down Expand Up @@ -1819,7 +1819,7 @@ void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
BuildLoadObjectField(closure, JSFunction::kLiteralsOffset);
Node* literal_index = jsgraph()->Constant(expr->literal_index());
Node* constants = jsgraph()->Constant(expr->constant_elements());
Node* flags = jsgraph()->Constant(expr->ComputeFlags());
Node* flags = jsgraph()->Constant(expr->ComputeFlags(true));
const Operator* op =
javascript()->CallRuntime(Runtime::kCreateArrayLiteral, 4);
Node* literal = NewNode(op, literals_array, literal_index, constants, flags);
Expand Down
1 change: 0 additions & 1 deletion deps/v8/src/compiler/graph-visualizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#ifndef V8_COMPILER_GRAPH_VISUALIZER_H_
#define V8_COMPILER_GRAPH_VISUALIZER_H_

#include <stdio.h>
#include <iosfwd>

namespace v8 {
Expand Down
2 changes: 2 additions & 0 deletions deps/v8/src/flag-definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -844,6 +844,8 @@ DEFINE_BOOL(gc_verbose, false, "print stuff during garbage collection")
DEFINE_BOOL(heap_stats, false, "report heap statistics before and after GC")
DEFINE_BOOL(code_stats, false, "report code statistics after GC")
DEFINE_BOOL(print_handles, false, "report handles after GC")
DEFINE_BOOL(check_handle_count, false,
"Check that there are not too many handles at GC")
DEFINE_BOOL(print_global_handles, false, "report global handles after GC")

// TurboFan debug-only flags.
Expand Down
21 changes: 21 additions & 0 deletions deps/v8/src/full-codegen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,27 @@ void FullCodeGenerator::PopulateTypeFeedbackInfo(Handle<Code> code) {
}


bool FullCodeGenerator::MustCreateObjectLiteralWithRuntime(
ObjectLiteral* expr) const {
// FastCloneShallowObjectStub doesn't copy elements, and object literals don't
// support copy-on-write (COW) elements for now.
// TODO(mvstanton): make object literals support COW elements.
return expr->may_store_doubles() || expr->depth() > 1 ||
masm()->serializer_enabled() ||
expr->ComputeFlags() != ObjectLiteral::kFastElements ||
expr->has_elements() ||
expr->properties_count() >
FastCloneShallowObjectStub::kMaximumClonedProperties;
}


bool FullCodeGenerator::MustCreateArrayLiteralWithRuntime(
ArrayLiteral* expr) const {
return expr->depth() > 1 ||
expr->values()->length() > JSObject::kInitialMaxFastElementArray;
}


void FullCodeGenerator::Initialize() {
InitializeAstVisitor(info_->isolate(), info_->zone());
// The generation of debug code must match between the snapshot code and the
Expand Down
5 changes: 4 additions & 1 deletion deps/v8/src/full-codegen.h
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ class FullCodeGenerator: public AstVisitor {
loop_depth_--;
}

MacroAssembler* masm() { return masm_; }
MacroAssembler* masm() const { return masm_; }

class ExpressionContext;
const ExpressionContext* context() { return context_; }
Expand Down Expand Up @@ -759,6 +759,9 @@ class FullCodeGenerator: public AstVisitor {
void PopulateDeoptimizationData(Handle<Code> code);
void PopulateTypeFeedbackInfo(Handle<Code> code);

bool MustCreateObjectLiteralWithRuntime(ObjectLiteral* expr) const;
bool MustCreateArrayLiteralWithRuntime(ArrayLiteral* expr) const;

Handle<HandlerTable> handler_table() { return handler_table_; }

struct BailoutEntry {
Expand Down
Loading