Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
v8: upgrade to 3.22.24.5
Browse files Browse the repository at this point in the history
  • Loading branch information
tjfontaine committed Nov 18, 2013
1 parent 2329a25 commit b73967e
Show file tree
Hide file tree
Showing 29 changed files with 522 additions and 267 deletions.
10 changes: 6 additions & 4 deletions deps/v8/src/arm/lithium-arm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -863,10 +863,12 @@ void LChunkBuilder::VisitInstruction(HInstruction* current) {

LInstruction* instr = NULL;
if (current->CanReplaceWithDummyUses()) {
HValue* first_operand = current->OperandCount() == 0
? graph()->GetConstant1()
: current->OperandAt(0);
instr = DefineAsRegister(new(zone()) LDummyUse(UseAny(first_operand)));
if (current->OperandCount() == 0) {
instr = DefineAsRegister(new(zone()) LDummy());
} else {
instr = DefineAsRegister(new(zone())
LDummyUse(UseAny(current->OperandAt(0))));
}
for (int i = 1; i < current->OperandCount(); ++i) {
LInstruction* dummy =
new(zone()) LDummyUse(UseAny(current->OperandAt(i)));
Expand Down
8 changes: 8 additions & 0 deletions deps/v8/src/arm/lithium-arm.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class LCodeGen;
V(DoubleToI) \
V(DoubleToSmi) \
V(Drop) \
V(Dummy) \
V(DummyUse) \
V(ElementsKind) \
V(ForInCacheArray) \
Expand Down Expand Up @@ -423,6 +424,13 @@ class LLazyBailout V8_FINAL : public LTemplateInstruction<0, 0, 0> {
};


class LDummy V8_FINAL : public LTemplateInstruction<1, 0, 0> {
public:
explicit LDummy() { }
DECLARE_CONCRETE_INSTRUCTION(Dummy, "dummy")
};


class LDummyUse V8_FINAL : public LTemplateInstruction<1, 1, 0> {
public:
explicit LDummyUse(LOperand* value) {
Expand Down
5 changes: 5 additions & 0 deletions deps/v8/src/arm/lithium-codegen-arm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5650,6 +5650,11 @@ void LCodeGen::DoDeoptimize(LDeoptimize* instr) {
}


void LCodeGen::DoDummy(LDummy* instr) {
// Nothing to see here, move on!
}


void LCodeGen::DoDummyUse(LDummyUse* instr) {
// Nothing to see here, move on!
}
Expand Down
72 changes: 23 additions & 49 deletions deps/v8/src/arm/stub-cache-arm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,14 @@ static void ProbeTable(Isolate* isolate,
}


// Helper function used to check that the dictionary doesn't contain
// the property. This function may return false negatives, so miss_label
// must always call a backup property check that is complete.
// This function is safe to call if the receiver has fast properties.
// Name must be unique and receiver must be a heap object.
static void GenerateDictionaryNegativeLookup(MacroAssembler* masm,
Label* miss_label,
Register receiver,
Handle<Name> name,
Register scratch0,
Register scratch1) {
void StubCompiler::GenerateDictionaryNegativeLookup(MacroAssembler* masm,
Label* miss_label,
Register receiver,
Handle<Name> name,
Register scratch0,
Register scratch1) {
ASSERT(name->IsUniqueName());
ASSERT(!receiver.is(scratch0));
Counters* counters = masm->isolate()->counters();
__ IncrementCounter(counters->negative_lookups(), 1, scratch0, scratch1);
__ IncrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1);
Expand Down Expand Up @@ -418,12 +414,12 @@ void StubCompiler::GenerateLoadFunctionPrototype(MacroAssembler* masm,
// Generate code to check that a global property cell is empty. Create
// the property cell at compilation time if no cell exists for the
// property.
static void GenerateCheckPropertyCell(MacroAssembler* masm,
Handle<GlobalObject> global,
Handle<Name> name,
Register scratch,
Label* miss) {
Handle<Cell> cell = GlobalObject::EnsurePropertyCell(global, name);
void StubCompiler::GenerateCheckPropertyCell(MacroAssembler* masm,
Handle<JSGlobalObject> global,
Handle<Name> name,
Register scratch,
Label* miss) {
Handle<Cell> cell = JSGlobalObject::EnsurePropertyCell(global, name);
ASSERT(cell->value()->IsTheHole());
__ mov(scratch, Operand(cell));
__ ldr(scratch, FieldMemOperand(scratch, Cell::kValueOffset));
Expand All @@ -441,7 +437,7 @@ void StoreStubCompiler::GenerateNegativeHolderLookup(
Label* miss) {
if (holder->IsJSGlobalObject()) {
GenerateCheckPropertyCell(
masm, Handle<GlobalObject>::cast(holder), name, scratch1(), miss);
masm, Handle<JSGlobalObject>::cast(holder), name, scratch1(), miss);
} else if (!holder->HasFastProperties() && !holder->IsJSGlobalProxy()) {
GenerateDictionaryNegativeLookup(
masm, miss, holder_reg, name, scratch1(), scratch2());
Expand Down Expand Up @@ -1156,19 +1152,17 @@ class CallInterceptorCompiler BASE_EMBEDDED {
};


// Calls GenerateCheckPropertyCell for each global object in the prototype chain
// from object to (but not including) holder.
static void GenerateCheckPropertyCells(MacroAssembler* masm,
Handle<JSObject> object,
Handle<JSObject> holder,
Handle<Name> name,
Register scratch,
Label* miss) {
void StubCompiler::GenerateCheckPropertyCells(MacroAssembler* masm,
Handle<JSObject> object,
Handle<JSObject> holder,
Handle<Name> name,
Register scratch,
Label* miss) {
Handle<JSObject> current = object;
while (!current.is_identical_to(holder)) {
if (current->IsGlobalObject()) {
if (current->IsJSGlobalObject()) {
GenerateCheckPropertyCell(masm,
Handle<GlobalObject>::cast(current),
Handle<JSGlobalObject>::cast(current),
name,
scratch,
miss);
Expand Down Expand Up @@ -1373,26 +1367,6 @@ Register LoadStubCompiler::CallbackHandlerFrontend(
}


void LoadStubCompiler::NonexistentHandlerFrontend(
Handle<JSObject> object,
Handle<JSObject> last,
Handle<Name> name,
Label* success,
Handle<GlobalObject> global) {
Label miss;

HandlerFrontendHeader(object, receiver(), last, name, &miss);

// If the last object in the prototype chain is a global object,
// check that the global property cell is empty.
if (!global.is_null()) {
GenerateCheckPropertyCell(masm(), global, name, scratch2(), &miss);
}

HandlerFrontendFooter(name, success, &miss);
}


void LoadStubCompiler::GenerateLoadField(Register reg,
Handle<JSObject> holder,
PropertyIndex field,
Expand Down Expand Up @@ -2939,7 +2913,7 @@ Handle<Code> LoadStubCompiler::CompileLoadNonexistent(
Handle<JSObject> object,
Handle<JSObject> last,
Handle<Name> name,
Handle<GlobalObject> global) {
Handle<JSGlobalObject> global) {
Label success;

NonexistentHandlerFrontend(object, last, name, &success, global);
Expand Down
62 changes: 44 additions & 18 deletions deps/v8/src/hydrogen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -708,21 +708,36 @@ DEFINE_GET_CONSTANT(Null, null, HType::Tagged(), false)

#undef DEFINE_GET_CONSTANT

#define DEFINE_IS_CONSTANT(Name, name) \
bool HGraph::IsConstant##Name(HConstant* constant) { \
return constant_##name##_.is_set() && constant == constant_##name##_.get(); \
}
DEFINE_IS_CONSTANT(Undefined, undefined)
DEFINE_IS_CONSTANT(0, 0)
DEFINE_IS_CONSTANT(1, 1)
DEFINE_IS_CONSTANT(Minus1, minus1)
DEFINE_IS_CONSTANT(True, true)
DEFINE_IS_CONSTANT(False, false)
DEFINE_IS_CONSTANT(Hole, the_hole)
DEFINE_IS_CONSTANT(Null, null)

#undef DEFINE_IS_CONSTANT


HConstant* HGraph::GetInvalidContext() {
return GetConstant(&constant_invalid_context_, 0xFFFFC0C7);
}


bool HGraph::IsStandardConstant(HConstant* constant) {
if (constant == GetConstantUndefined()) return true;
if (constant == GetConstant0()) return true;
if (constant == GetConstant1()) return true;
if (constant == GetConstantMinus1()) return true;
if (constant == GetConstantTrue()) return true;
if (constant == GetConstantFalse()) return true;
if (constant == GetConstantHole()) return true;
if (constant == GetConstantNull()) return true;
if (IsConstantUndefined(constant)) return true;
if (IsConstant0(constant)) return true;
if (IsConstant1(constant)) return true;
if (IsConstantMinus1(constant)) return true;
if (IsConstantTrue(constant)) return true;
if (IsConstantFalse(constant)) return true;
if (IsConstantHole(constant)) return true;
if (IsConstantNull(constant)) return true;
return false;
}

Expand Down Expand Up @@ -2281,7 +2296,8 @@ HGraph::HGraph(CompilationInfo* info)
depends_on_empty_array_proto_elements_(false),
type_change_checksum_(0),
maximum_environment_size_(0),
no_side_effects_scope_count_(0) {
no_side_effects_scope_count_(0),
disallow_adding_new_values_(false) {
if (info->IsStub()) {
HydrogenCodeStub* stub = info->code_stub();
CodeStubInterfaceDescriptor* descriptor =
Expand Down Expand Up @@ -7830,29 +7846,39 @@ HInstruction* HGraphBuilder::BuildBinaryOperation(
// Special case for string addition here.
if (op == Token::ADD &&
(left_type->Is(Type::String()) || right_type->Is(Type::String()))) {
// Validate type feedback for left argument.
if (left_type->Is(Type::String())) {
IfBuilder if_isstring(this);
if_isstring.If<HIsStringAndBranch>(left);
if_isstring.Then();
if_isstring.ElseDeopt("Expected string for LHS of binary operation");
} else if (left_type->Is(Type::Number())) {
}

// Validate type feedback for right argument.
if (right_type->Is(Type::String())) {
IfBuilder if_isstring(this);
if_isstring.If<HIsStringAndBranch>(right);
if_isstring.Then();
if_isstring.ElseDeopt("Expected string for RHS of binary operation");
}

// Convert left argument as necessary.
if (left_type->Is(Type::Number())) {
ASSERT(right_type->Is(Type::String()));
left = BuildNumberToString(left, left_type);
} else {
} else if (!left_type->Is(Type::String())) {
ASSERT(right_type->Is(Type::String()));
HValue* function = AddLoadJSBuiltin(Builtins::STRING_ADD_RIGHT);
Add<HPushArgument>(left);
Add<HPushArgument>(right);
return NewUncasted<HInvokeFunction>(function, 2);
}

if (right_type->Is(Type::String())) {
IfBuilder if_isstring(this);
if_isstring.If<HIsStringAndBranch>(right);
if_isstring.Then();
if_isstring.ElseDeopt("Expected string for RHS of binary operation");
} else if (right_type->Is(Type::Number())) {
// Convert right argument as necessary.
if (right_type->Is(Type::Number())) {
ASSERT(left_type->Is(Type::String()));
right = BuildNumberToString(right, right_type);
} else {
} else if (!right_type->Is(Type::String())) {
ASSERT(left_type->Is(Type::String()));
HValue* function = AddLoadJSBuiltin(Builtins::STRING_ADD_LEFT);
Add<HPushArgument>(left);
Expand Down
13 changes: 13 additions & 0 deletions deps/v8/src/hydrogen.h
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,14 @@ class HGraph V8_FINAL : public ZoneObject {
HConstant* GetConstantNull();
HConstant* GetInvalidContext();

bool IsConstantUndefined(HConstant* constant);
bool IsConstant0(HConstant* constant);
bool IsConstant1(HConstant* constant);
bool IsConstantMinus1(HConstant* constant);
bool IsConstantTrue(HConstant* constant);
bool IsConstantFalse(HConstant* constant);
bool IsConstantHole(HConstant* constant);
bool IsConstantNull(HConstant* constant);
bool IsStandardConstant(HConstant* constant);

HBasicBlock* CreateBasicBlock();
Expand All @@ -366,13 +374,17 @@ class HGraph V8_FINAL : public ZoneObject {
int GetMaximumValueID() const { return values_.length(); }
int GetNextBlockID() { return next_block_id_++; }
int GetNextValueID(HValue* value) {
ASSERT(!disallow_adding_new_values_);
values_.Add(value, zone());
return values_.length() - 1;
}
HValue* LookupValue(int id) const {
if (id >= 0 && id < values_.length()) return values_[id];
return NULL;
}
void DisallowAddingNewValues() {
disallow_adding_new_values_ = true;
}

bool Optimize(BailoutReason* bailout_reason);

Expand Down Expand Up @@ -499,6 +511,7 @@ class HGraph V8_FINAL : public ZoneObject {
int type_change_checksum_;
int maximum_environment_size_;
int no_side_effects_scope_count_;
bool disallow_adding_new_values_;

DISALLOW_COPY_AND_ASSIGN(HGraph);
};
Expand Down
5 changes: 5 additions & 0 deletions deps/v8/src/ia32/lithium-codegen-ia32.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6216,6 +6216,11 @@ void LCodeGen::DoDeoptimize(LDeoptimize* instr) {
}


void LCodeGen::DoDummy(LDummy* instr) {
// Nothing to see here, move on!
}


void LCodeGen::DoDummyUse(LDummyUse* instr) {
// Nothing to see here, move on!
}
Expand Down
10 changes: 6 additions & 4 deletions deps/v8/src/ia32/lithium-ia32.cc
Original file line number Diff line number Diff line change
Expand Up @@ -916,10 +916,12 @@ void LChunkBuilder::VisitInstruction(HInstruction* current) {

LInstruction* instr = NULL;
if (current->CanReplaceWithDummyUses()) {
HValue* first_operand = current->OperandCount() == 0
? graph()->GetConstant1()
: current->OperandAt(0);
instr = DefineAsRegister(new(zone()) LDummyUse(UseAny(first_operand)));
if (current->OperandCount() == 0) {
instr = DefineAsRegister(new(zone()) LDummy());
} else {
instr = DefineAsRegister(new(zone())
LDummyUse(UseAny(current->OperandAt(0))));
}
for (int i = 1; i < current->OperandCount(); ++i) {
LInstruction* dummy =
new(zone()) LDummyUse(UseAny(current->OperandAt(i)));
Expand Down
8 changes: 8 additions & 0 deletions deps/v8/src/ia32/lithium-ia32.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ class LCodeGen;
V(DoubleToI) \
V(DoubleToSmi) \
V(Drop) \
V(Dummy) \
V(DummyUse) \
V(ElementsKind) \
V(ForInCacheArray) \
Expand Down Expand Up @@ -431,6 +432,13 @@ class LLazyBailout V8_FINAL : public LTemplateInstruction<0, 0, 0> {
};


class LDummy V8_FINAL : public LTemplateInstruction<1, 0, 0> {
public:
explicit LDummy() { }
DECLARE_CONCRETE_INSTRUCTION(Dummy, "dummy")
};


class LDummyUse V8_FINAL : public LTemplateInstruction<1, 1, 0> {
public:
explicit LDummyUse(LOperand* value) {
Expand Down
Loading

0 comments on commit b73967e

Please sign in to comment.