Commit 6aef61b5 authored by palfia@homejinni.com's avatar palfia@homejinni.com

MIPS: Always require exact maps.

Port r14768 (5dec309f)

BUG=

Review URL: https://codereview.chromium.org/15948003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14784 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 344d9057
...@@ -2763,9 +2763,7 @@ void LCodeGen::DoLoadNamedFieldPolymorphic(LLoadNamedFieldPolymorphic* instr) { ...@@ -2763,9 +2763,7 @@ void LCodeGen::DoLoadNamedFieldPolymorphic(LLoadNamedFieldPolymorphic* instr) {
bool last = (i == map_count - 1); bool last = (i == map_count - 1);
Handle<Map> map = instr->hydrogen()->types()->at(i); Handle<Map> map = instr->hydrogen()->types()->at(i);
Label check_passed; Label check_passed;
__ CompareMapAndBranch( __ CompareMapAndBranch(object_map, map, &check_passed, eq, &check_passed);
object_map, map, &check_passed,
eq, &check_passed, ALLOW_ELEMENT_TRANSITION_MAPS);
if (last && !need_generic) { if (last && !need_generic) {
DeoptimizeIf(al, instr->environment()); DeoptimizeIf(al, instr->environment());
__ bind(&check_passed); __ bind(&check_passed);
...@@ -5010,10 +5008,9 @@ void LCodeGen::DoCheckFunction(LCheckFunction* instr) { ...@@ -5010,10 +5008,9 @@ void LCodeGen::DoCheckFunction(LCheckFunction* instr) {
void LCodeGen::DoCheckMapCommon(Register map_reg, void LCodeGen::DoCheckMapCommon(Register map_reg,
Handle<Map> map, Handle<Map> map,
CompareMapMode mode,
LEnvironment* env) { LEnvironment* env) {
Label success; Label success;
__ CompareMapAndBranch(map_reg, map, &success, eq, &success, mode); __ CompareMapAndBranch(map_reg, map, &success, eq, &success);
DeoptimizeIf(al, env); DeoptimizeIf(al, env);
__ bind(&success); __ bind(&success);
} }
...@@ -5029,11 +5026,10 @@ void LCodeGen::DoCheckMaps(LCheckMaps* instr) { ...@@ -5029,11 +5026,10 @@ void LCodeGen::DoCheckMaps(LCheckMaps* instr) {
__ lw(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset)); __ lw(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset));
for (int i = 0; i < map_set->length() - 1; i++) { for (int i = 0; i < map_set->length() - 1; i++) {
Handle<Map> map = map_set->at(i); Handle<Map> map = map_set->at(i);
__ CompareMapAndBranch( __ CompareMapAndBranch(map_reg, map, &success, eq, &success);
map_reg, map, &success, eq, &success, REQUIRE_EXACT_MAP);
} }
Handle<Map> map = map_set->last(); Handle<Map> map = map_set->last();
DoCheckMapCommon(map_reg, map, REQUIRE_EXACT_MAP, instr->environment()); DoCheckMapCommon(map_reg, map, instr->environment());
__ bind(&success); __ bind(&success);
} }
...@@ -5105,10 +5101,7 @@ void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { ...@@ -5105,10 +5101,7 @@ void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) {
for (int i = 0; i < prototypes->length(); i++) { for (int i = 0; i < prototypes->length(); i++) {
__ LoadHeapObject(prototype_reg, prototypes->at(i)); __ LoadHeapObject(prototype_reg, prototypes->at(i));
__ lw(map_reg, FieldMemOperand(prototype_reg, HeapObject::kMapOffset)); __ lw(map_reg, FieldMemOperand(prototype_reg, HeapObject::kMapOffset));
DoCheckMapCommon(map_reg, DoCheckMapCommon(map_reg, maps->at(i), instr->environment());
maps->at(i),
ALLOW_ELEMENT_TRANSITION_MAPS,
instr->environment());
} }
} }
} }
......
...@@ -155,8 +155,7 @@ class LCodeGen BASE_EMBEDDED { ...@@ -155,8 +155,7 @@ class LCodeGen BASE_EMBEDDED {
void DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr, void DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr,
Label* map_check); Label* map_check);
void DoCheckMapCommon(Register map_reg, Handle<Map> map, void DoCheckMapCommon(Register map_reg, Handle<Map> map, LEnvironment* env);
CompareMapMode mode, LEnvironment* env);
// Parallel move support. // Parallel move support.
void DoParallelMove(LParallelMove* move); void DoParallelMove(LParallelMove* move);
......
...@@ -3464,10 +3464,9 @@ void MacroAssembler::CompareMapAndBranch(Register obj, ...@@ -3464,10 +3464,9 @@ void MacroAssembler::CompareMapAndBranch(Register obj,
Handle<Map> map, Handle<Map> map,
Label* early_success, Label* early_success,
Condition cond, Condition cond,
Label* branch_to, Label* branch_to) {
CompareMapMode mode) {
lw(scratch, FieldMemOperand(obj, HeapObject::kMapOffset)); lw(scratch, FieldMemOperand(obj, HeapObject::kMapOffset));
CompareMapAndBranch(scratch, map, early_success, cond, branch_to, mode); CompareMapAndBranch(scratch, map, early_success, cond, branch_to);
} }
...@@ -3475,25 +3474,8 @@ void MacroAssembler::CompareMapAndBranch(Register obj_map, ...@@ -3475,25 +3474,8 @@ void MacroAssembler::CompareMapAndBranch(Register obj_map,
Handle<Map> map, Handle<Map> map,
Label* early_success, Label* early_success,
Condition cond, Condition cond,
Label* branch_to, Label* branch_to) {
CompareMapMode mode) { Branch(branch_to, cond, obj_map, Operand(map));
Operand right = Operand(map);
if (mode == ALLOW_ELEMENT_TRANSITION_MAPS) {
ElementsKind kind = map->elements_kind();
if (IsFastElementsKind(kind)) {
bool packed = IsFastPackedElementsKind(kind);
Map* current_map = *map;
while (CanTransitionToMoreGeneralFastElementsKind(kind, packed)) {
kind = GetNextMoreGeneralFastElementsKind(kind, packed);
current_map = current_map->LookupElementsTransitionMap(kind);
if (!current_map) break;
Branch(early_success, eq, obj_map, right);
right = Operand(Handle<Map>(current_map));
}
}
}
Branch(branch_to, cond, obj_map, right);
} }
...@@ -3501,13 +3483,12 @@ void MacroAssembler::CheckMap(Register obj, ...@@ -3501,13 +3483,12 @@ void MacroAssembler::CheckMap(Register obj,
Register scratch, Register scratch,
Handle<Map> map, Handle<Map> map,
Label* fail, Label* fail,
SmiCheckType smi_check_type, SmiCheckType smi_check_type) {
CompareMapMode mode) {
if (smi_check_type == DO_SMI_CHECK) { if (smi_check_type == DO_SMI_CHECK) {
JumpIfSmi(obj, fail); JumpIfSmi(obj, fail);
} }
Label success; Label success;
CompareMapAndBranch(obj, scratch, map, &success, ne, fail, mode); CompareMapAndBranch(obj, scratch, map, &success, ne, fail);
bind(&success); bind(&success);
} }
......
...@@ -1014,8 +1014,7 @@ class MacroAssembler: public Assembler { ...@@ -1014,8 +1014,7 @@ class MacroAssembler: public Assembler {
Handle<Map> map, Handle<Map> map,
Label* early_success, Label* early_success,
Condition cond, Condition cond,
Label* branch_to, Label* branch_to);
CompareMapMode mode = REQUIRE_EXACT_MAP);
// As above, but the map of the object is already loaded into the register // As above, but the map of the object is already loaded into the register
// which is preserved by the code generated. // which is preserved by the code generated.
...@@ -1023,8 +1022,7 @@ class MacroAssembler: public Assembler { ...@@ -1023,8 +1022,7 @@ class MacroAssembler: public Assembler {
Handle<Map> map, Handle<Map> map,
Label* early_success, Label* early_success,
Condition cond, Condition cond,
Label* branch_to, Label* branch_to);
CompareMapMode mode = REQUIRE_EXACT_MAP);
// Check if the map of an object is equal to a specified map and branch to // Check if the map of an object is equal to a specified map and branch to
// label if not. Skip the smi check if not required (object is known to be a // label if not. Skip the smi check if not required (object is known to be a
...@@ -1034,8 +1032,7 @@ class MacroAssembler: public Assembler { ...@@ -1034,8 +1032,7 @@ class MacroAssembler: public Assembler {
Register scratch, Register scratch,
Handle<Map> map, Handle<Map> map,
Label* fail, Label* fail,
SmiCheckType smi_check_type, SmiCheckType smi_check_type);
CompareMapMode mode = REQUIRE_EXACT_MAP);
void CheckMap(Register obj, void CheckMap(Register obj,
......
...@@ -453,7 +453,7 @@ void StubCompiler::GenerateStoreTransition(MacroAssembler* masm, ...@@ -453,7 +453,7 @@ void StubCompiler::GenerateStoreTransition(MacroAssembler* masm,
// Check that the map of the object hasn't changed. // Check that the map of the object hasn't changed.
__ CheckMap(receiver_reg, scratch1, Handle<Map>(object->map()), miss_label, __ CheckMap(receiver_reg, scratch1, Handle<Map>(object->map()), miss_label,
DO_SMI_CHECK, REQUIRE_EXACT_MAP); DO_SMI_CHECK);
// Perform global security token check if needed. // Perform global security token check if needed.
if (object->IsJSGlobalProxy()) { if (object->IsJSGlobalProxy()) {
...@@ -662,7 +662,7 @@ void StubCompiler::GenerateStoreField(MacroAssembler* masm, ...@@ -662,7 +662,7 @@ void StubCompiler::GenerateStoreField(MacroAssembler* masm,
// Check that the map of the object hasn't changed. // Check that the map of the object hasn't changed.
__ CheckMap(receiver_reg, scratch1, Handle<Map>(object->map()), miss_label, __ CheckMap(receiver_reg, scratch1, Handle<Map>(object->map()), miss_label,
DO_SMI_CHECK, ALLOW_ELEMENT_TRANSITION_MAPS); DO_SMI_CHECK);
// Perform global security token check if needed. // Perform global security token check if needed.
if (object->IsJSGlobalProxy()) { if (object->IsJSGlobalProxy()) {
...@@ -1261,8 +1261,7 @@ Register StubCompiler::CheckPrototypes(Handle<JSObject> object, ...@@ -1261,8 +1261,7 @@ Register StubCompiler::CheckPrototypes(Handle<JSObject> object,
if (!current.is_identical_to(first) || check == CHECK_ALL_MAPS) { if (!current.is_identical_to(first) || check == CHECK_ALL_MAPS) {
Handle<Map> current_map(current->map()); Handle<Map> current_map(current->map());
// CheckMap implicitly loads the map of |reg| into |map_reg|. // CheckMap implicitly loads the map of |reg| into |map_reg|.
__ CheckMap(reg, map_reg, current_map, miss, DONT_DO_SMI_CHECK, __ CheckMap(reg, map_reg, current_map, miss, DONT_DO_SMI_CHECK);
ALLOW_ELEMENT_TRANSITION_MAPS);
} else { } else {
__ lw(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset)); __ lw(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset));
} }
...@@ -1298,7 +1297,7 @@ Register StubCompiler::CheckPrototypes(Handle<JSObject> object, ...@@ -1298,7 +1297,7 @@ Register StubCompiler::CheckPrototypes(Handle<JSObject> object,
if (!holder.is_identical_to(first) || check == CHECK_ALL_MAPS) { if (!holder.is_identical_to(first) || check == CHECK_ALL_MAPS) {
// Check the holder map. // Check the holder map.
__ CheckMap(reg, scratch1, Handle<Map>(holder->map()), miss, __ CheckMap(reg, scratch1, Handle<Map>(holder->map()), miss,
DONT_DO_SMI_CHECK, ALLOW_ELEMENT_TRANSITION_MAPS); DONT_DO_SMI_CHECK);
} }
// Perform security check for access to the global object. // Perform security check for access to the global object.
...@@ -2861,7 +2860,7 @@ Handle<Code> StoreStubCompiler::CompileStoreInterceptor( ...@@ -2861,7 +2860,7 @@ Handle<Code> StoreStubCompiler::CompileStoreInterceptor(
// Check that the map of the object hasn't changed. // Check that the map of the object hasn't changed.
__ CheckMap(receiver(), scratch1(), Handle<Map>(object->map()), &miss, __ CheckMap(receiver(), scratch1(), Handle<Map>(object->map()), &miss,
DO_SMI_CHECK, ALLOW_ELEMENT_TRANSITION_MAPS); DO_SMI_CHECK);
// Perform global security token check if needed. // Perform global security token check if needed.
if (object->IsJSGlobalProxy()) { if (object->IsJSGlobalProxy()) {
......
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