Use weak cells to embed maps in store handler.
BUG=v8:3629 LOG=N Review URL: https://codereview.chromium.org/774473004 Cr-Commit-Position: refs/heads/master@{#25639}
This commit is contained in:
parent
740d0a987a
commit
3fc9c9b665
@ -3670,18 +3670,6 @@ void MacroAssembler::CheckPageFlag(
|
||||
}
|
||||
|
||||
|
||||
void MacroAssembler::CheckMapDeprecated(Handle<Map> map,
|
||||
Register scratch,
|
||||
Label* if_deprecated) {
|
||||
if (map->CanBeDeprecated()) {
|
||||
mov(scratch, Operand(map));
|
||||
ldr(scratch, FieldMemOperand(scratch, Map::kBitField3Offset));
|
||||
tst(scratch, Operand(Map::Deprecated::kMask));
|
||||
b(ne, if_deprecated);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MacroAssembler::JumpIfBlack(Register object,
|
||||
Register scratch0,
|
||||
Register scratch1,
|
||||
|
@ -200,10 +200,6 @@ class MacroAssembler: public Assembler {
|
||||
Condition cc,
|
||||
Label* condition_met);
|
||||
|
||||
void CheckMapDeprecated(Handle<Map> map,
|
||||
Register scratch,
|
||||
Label* if_deprecated);
|
||||
|
||||
// Check if object is in new space. Jumps if the object is not in new space.
|
||||
// The register scratch can be object itself, but scratch will be clobbered.
|
||||
void JumpIfNotInNewSpace(Register object,
|
||||
|
@ -4650,17 +4650,6 @@ void MacroAssembler::HasColor(Register object,
|
||||
}
|
||||
|
||||
|
||||
void MacroAssembler::CheckMapDeprecated(Handle<Map> map,
|
||||
Register scratch,
|
||||
Label* if_deprecated) {
|
||||
if (map->CanBeDeprecated()) {
|
||||
Mov(scratch, Operand(map));
|
||||
Ldrsw(scratch, FieldMemOperand(scratch, Map::kBitField3Offset));
|
||||
TestAndBranchIfAnySet(scratch, Map::Deprecated::kMask, if_deprecated);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MacroAssembler::JumpIfBlack(Register object,
|
||||
Register scratch0,
|
||||
Register scratch1,
|
||||
|
@ -1782,10 +1782,6 @@ class MacroAssembler : public Assembler {
|
||||
int mask,
|
||||
Label* if_all_clear);
|
||||
|
||||
void CheckMapDeprecated(Handle<Map> map,
|
||||
Register scratch,
|
||||
Label* if_deprecated);
|
||||
|
||||
// Check if object is in new space and jump accordingly.
|
||||
// Register 'object' is preserved.
|
||||
void JumpIfNotInNewSpace(Register object,
|
||||
|
@ -3172,18 +3172,6 @@ void MacroAssembler::CheckPageFlagForMap(
|
||||
}
|
||||
|
||||
|
||||
void MacroAssembler::CheckMapDeprecated(Handle<Map> map,
|
||||
Register scratch,
|
||||
Label* if_deprecated) {
|
||||
if (map->CanBeDeprecated()) {
|
||||
mov(scratch, map);
|
||||
mov(scratch, FieldOperand(scratch, Map::kBitField3Offset));
|
||||
and_(scratch, Immediate(Map::Deprecated::kMask));
|
||||
j(not_zero, if_deprecated);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MacroAssembler::JumpIfBlack(Register object,
|
||||
Register scratch0,
|
||||
Register scratch1,
|
||||
|
@ -94,10 +94,6 @@ class MacroAssembler: public Assembler {
|
||||
Label* condition_met,
|
||||
Label::Distance condition_met_distance = Label::kFar);
|
||||
|
||||
void CheckMapDeprecated(Handle<Map> map,
|
||||
Register scratch,
|
||||
Label* if_deprecated);
|
||||
|
||||
// Check if object is in new space. Jumps if the object is not in new space.
|
||||
// The register scratch can be object itself, but scratch will be clobbered.
|
||||
void JumpIfNotInNewSpace(Register object,
|
||||
|
@ -326,10 +326,23 @@ void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label,
|
||||
}
|
||||
|
||||
|
||||
void NamedStoreHandlerCompiler::GenerateRestoreNameAndMap(
|
||||
Handle<Name> name, Handle<Map> transition) {
|
||||
void NamedStoreHandlerCompiler::GenerateRestoreName(Handle<Name> name) {
|
||||
__ mov(this->name(), Operand(name));
|
||||
__ mov(StoreTransitionDescriptor::MapRegister(), Operand(transition));
|
||||
}
|
||||
|
||||
|
||||
void NamedStoreHandlerCompiler::GenerateRestoreMap(Handle<Map> transition,
|
||||
Register scratch,
|
||||
Label* miss) {
|
||||
Handle<WeakCell> cell = Map::WeakCellForMap(transition);
|
||||
Register map_reg = StoreTransitionDescriptor::MapRegister();
|
||||
DCHECK(!map_reg.is(scratch));
|
||||
__ LoadWeakValue(map_reg, cell, miss);
|
||||
if (transition->CanBeDeprecated()) {
|
||||
__ ldr(scratch, FieldMemOperand(map_reg, Map::kBitField3Offset));
|
||||
__ tst(scratch, Operand(Map::Deprecated::kMask));
|
||||
__ b(ne, miss);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -370,10 +370,22 @@ void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label,
|
||||
}
|
||||
|
||||
|
||||
void NamedStoreHandlerCompiler::GenerateRestoreNameAndMap(
|
||||
Handle<Name> name, Handle<Map> transition) {
|
||||
void NamedStoreHandlerCompiler::GenerateRestoreName(Handle<Name> name) {
|
||||
__ Mov(this->name(), Operand(name));
|
||||
__ Mov(StoreTransitionDescriptor::MapRegister(), Operand(transition));
|
||||
}
|
||||
|
||||
|
||||
void NamedStoreHandlerCompiler::GenerateRestoreMap(Handle<Map> transition,
|
||||
Register scratch,
|
||||
Label* miss) {
|
||||
Handle<WeakCell> cell = Map::WeakCellForMap(transition);
|
||||
Register map_reg = StoreTransitionDescriptor::MapRegister();
|
||||
DCHECK(!map_reg.is(scratch));
|
||||
__ LoadWeakValue(map_reg, cell, miss);
|
||||
if (transition->CanBeDeprecated()) {
|
||||
__ Ldrsw(scratch, FieldMemOperand(map_reg, Map::kBitField3Offset));
|
||||
__ TestAndBranchIfAnySet(scratch, Map::Deprecated::kMask, miss);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -312,9 +312,6 @@ Handle<Code> NamedStoreHandlerCompiler::CompileStoreTransition(
|
||||
Handle<Map> transition, Handle<Name> name) {
|
||||
Label miss;
|
||||
|
||||
// Ensure no transitions to deprecated maps are followed.
|
||||
__ CheckMapDeprecated(transition, scratch1(), &miss);
|
||||
|
||||
// Check that we are allowed to write this.
|
||||
bool is_nonexistent = holder()->map() == transition->GetBackPointer();
|
||||
if (is_nonexistent) {
|
||||
@ -345,7 +342,8 @@ Handle<Code> NamedStoreHandlerCompiler::CompileStoreTransition(
|
||||
if (details.type() == CONSTANT) {
|
||||
GenerateConstantCheck(descriptors->GetValue(descriptor), value(), &miss);
|
||||
|
||||
GenerateRestoreNameAndMap(name, transition);
|
||||
GenerateRestoreMap(transition, scratch2(), &miss);
|
||||
GenerateRestoreName(name);
|
||||
StoreTransitionStub stub(isolate());
|
||||
GenerateTailCall(masm(), stub.GetCode());
|
||||
|
||||
@ -359,7 +357,8 @@ Handle<Code> NamedStoreHandlerCompiler::CompileStoreTransition(
|
||||
? StoreTransitionStub::ExtendStorageAndStoreMapAndValue
|
||||
: StoreTransitionStub::StoreMapAndValue;
|
||||
|
||||
GenerateRestoreNameAndMap(name, transition);
|
||||
GenerateRestoreMap(transition, scratch2(), &miss);
|
||||
GenerateRestoreName(name);
|
||||
StoreTransitionStub stub(isolate(),
|
||||
FieldIndex::ForDescriptor(*transition, descriptor),
|
||||
representation, store_mode);
|
||||
|
@ -230,7 +230,9 @@ class NamedStoreHandlerCompiler : public PropertyHandlerCompiler {
|
||||
void GenerateRestoreName(Label* label, Handle<Name> name);
|
||||
|
||||
private:
|
||||
void GenerateRestoreNameAndMap(Handle<Name> name, Handle<Map> transition);
|
||||
void GenerateRestoreName(Handle<Name> name);
|
||||
void GenerateRestoreMap(Handle<Map> transition, Register scratch,
|
||||
Label* miss);
|
||||
|
||||
void GenerateConstantCheck(Object* constant, Register value_reg,
|
||||
Label* miss_label);
|
||||
|
@ -329,10 +329,23 @@ void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label,
|
||||
}
|
||||
|
||||
|
||||
void NamedStoreHandlerCompiler::GenerateRestoreNameAndMap(
|
||||
Handle<Name> name, Handle<Map> transition) {
|
||||
void NamedStoreHandlerCompiler::GenerateRestoreName(Handle<Name> name) {
|
||||
__ mov(this->name(), Immediate(name));
|
||||
__ mov(StoreTransitionDescriptor::MapRegister(), Immediate(transition));
|
||||
}
|
||||
|
||||
|
||||
void NamedStoreHandlerCompiler::GenerateRestoreMap(Handle<Map> transition,
|
||||
Register scratch,
|
||||
Label* miss) {
|
||||
Handle<WeakCell> cell = Map::WeakCellForMap(transition);
|
||||
Register map_reg = StoreTransitionDescriptor::MapRegister();
|
||||
DCHECK(!map_reg.is(scratch));
|
||||
__ LoadWeakValue(map_reg, cell, miss);
|
||||
if (transition->CanBeDeprecated()) {
|
||||
__ mov(scratch, FieldOperand(map_reg, Map::kBitField3Offset));
|
||||
__ and_(scratch, Immediate(Map::Deprecated::kMask));
|
||||
__ j(not_zero, miss);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -324,13 +324,25 @@ void NamedStoreHandlerCompiler::GenerateRestoreName(Label* label,
|
||||
}
|
||||
|
||||
|
||||
void NamedStoreHandlerCompiler::GenerateRestoreNameAndMap(
|
||||
Handle<Name> name, Handle<Map> transition) {
|
||||
void NamedStoreHandlerCompiler::GenerateRestoreName(Handle<Name> name) {
|
||||
__ Move(this->name(), name);
|
||||
__ Move(StoreTransitionDescriptor::MapRegister(), transition);
|
||||
}
|
||||
|
||||
|
||||
void NamedStoreHandlerCompiler::GenerateRestoreMap(Handle<Map> transition,
|
||||
Register scratch,
|
||||
Label* miss) {
|
||||
Handle<WeakCell> cell = Map::WeakCellForMap(transition);
|
||||
Register map_reg = StoreTransitionDescriptor::MapRegister();
|
||||
DCHECK(!map_reg.is(scratch));
|
||||
__ LoadWeakValue(map_reg, cell, miss);
|
||||
if (transition->CanBeDeprecated()) {
|
||||
__ movl(scratch, FieldOperand(map_reg, Map::kBitField3Offset));
|
||||
__ andl(scratch, Immediate(Map::Deprecated::kMask));
|
||||
__ j(not_zero, miss);
|
||||
}
|
||||
}
|
||||
|
||||
void NamedStoreHandlerCompiler::GenerateConstantCheck(Object* constant,
|
||||
Register value_reg,
|
||||
Label* miss_label) {
|
||||
|
@ -5128,18 +5128,6 @@ void MacroAssembler::CheckPageFlag(
|
||||
}
|
||||
|
||||
|
||||
void MacroAssembler::CheckMapDeprecated(Handle<Map> map,
|
||||
Register scratch,
|
||||
Label* if_deprecated) {
|
||||
if (map->CanBeDeprecated()) {
|
||||
Move(scratch, map);
|
||||
movl(scratch, FieldOperand(scratch, Map::kBitField3Offset));
|
||||
andl(scratch, Immediate(Map::Deprecated::kMask));
|
||||
j(not_zero, if_deprecated);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MacroAssembler::JumpIfBlack(Register object,
|
||||
Register bitmap_scratch,
|
||||
Register mask_scratch,
|
||||
|
@ -175,10 +175,6 @@ class MacroAssembler: public Assembler {
|
||||
Label* condition_met,
|
||||
Label::Distance condition_met_distance = Label::kFar);
|
||||
|
||||
void CheckMapDeprecated(Handle<Map> map,
|
||||
Register scratch,
|
||||
Label* if_deprecated);
|
||||
|
||||
// Check if object is in new space. Jumps if the object is not in new space.
|
||||
// The register scratch can be object itself, but scratch will be clobbered.
|
||||
void JumpIfNotInNewSpace(Register object,
|
||||
|
Loading…
Reference in New Issue
Block a user