Chromium Code Reviews| Index: src/x64/lithium-codegen-x64.cc |
| diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
| index 6239acb51531d1f39ecfd1e247315736e82c3e29..4b6c56275199c7acbd25f58267fe12c0528eb155 100644 |
| --- a/src/x64/lithium-codegen-x64.cc |
| +++ b/src/x64/lithium-codegen-x64.cc |
| @@ -1,4 +1,4 @@ |
| -// Copyright 2011 the V8 project authors. All rights reserved. |
| +// Copyright 2012 the V8 project authors. All rights reserved. |
| // Redistribution and use in source and binary forms, with or without |
| // modification, are permitted provided that the following conditions are |
| // met: |
| @@ -3747,13 +3747,45 @@ void LCodeGen::DoCheckFunction(LCheckFunction* instr) { |
| } |
| +void LCodeGen::DoCheckMapCommon(Register reg, |
| + Handle<Map> map, |
| + MapCheckMode mode, |
| + LEnvironment* env) { |
| + Label success; |
| + __ Cmp(FieldOperand(reg, HeapObject::kMapOffset), map); |
| + if (mode == ALLOW_ELEMENT_TRANSITION_MAPS) { |
| + bool ignore; |
| + Map* transitioned_double_map = |
|
fschneider
2012/01/04 09:20:18
Handle<Map> transitioned_double_map(...)
fschneider
2012/01/04 09:20:18
I'd order this differently and move this down clos
danno
2012/01/04 10:42:15
Done.
danno
2012/01/04 10:42:15
Done.
|
| + map->LookupElementsTransitionMap(FAST_DOUBLE_ELEMENTS, &ignore); |
| + ASSERT(transitioned_double_map == NULL || |
| + map->elements_kind() == FAST_SMI_ONLY_ELEMENTS); |
| + Map* transitioned_fast_element_map = |
|
fschneider
2012/01/04 09:20:18
Handle<Map> transitioned_fast_element_map(...)
danno
2012/01/04 10:42:15
Done.
|
| + map->LookupElementsTransitionMap(FAST_ELEMENTS, &ignore); |
| + ASSERT(transitioned_fast_element_map == NULL || |
| + map->elements_kind() != FAST_ELEMENTS); |
| + if (transitioned_fast_element_map != NULL) { |
| + __ j(equal, &success); |
| + __ Cmp(FieldOperand(reg, HeapObject::kMapOffset), |
| + Handle<Map>(transitioned_fast_element_map)); |
| + } |
| + |
| + if (transitioned_double_map != NULL) { |
| + __ j(equal, &success); |
| + __ Cmp(FieldOperand(reg, HeapObject::kMapOffset), |
| + Handle<Map>(transitioned_double_map)); |
| + } |
| + } |
| + DeoptimizeIf(not_equal, env); |
| + __ bind(&success); |
| +} |
| + |
| + |
| void LCodeGen::DoCheckMap(LCheckMap* instr) { |
| LOperand* input = instr->InputAt(0); |
| ASSERT(input->IsRegister()); |
| Register reg = ToRegister(input); |
| - __ Cmp(FieldOperand(reg, HeapObject::kMapOffset), |
| - instr->hydrogen()->map()); |
| - DeoptimizeIf(not_equal, instr->environment()); |
| + Handle<Map> map = Handle<Map>(instr->hydrogen()->map()); |
|
fschneider
2012/01/04 09:20:18
Simpler would be:
Handle<Map> map = instr->hydrog
danno
2012/01/04 10:42:15
Done.
|
| + DoCheckMapCommon(reg, map, instr->hydrogen()->mode(), instr->environment()); |
| } |
| @@ -3819,9 +3851,8 @@ void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { |
| // Check prototype maps up to the holder. |
| while (!current_prototype.is_identical_to(holder)) { |
| - __ Cmp(FieldOperand(reg, HeapObject::kMapOffset), |
| - Handle<Map>(current_prototype->map())); |
| - DeoptimizeIf(not_equal, instr->environment()); |
| + DoCheckMapCommon(reg, Handle<Map>(current_prototype->map()), |
| + ALLOW_ELEMENT_TRANSITION_MAPS, instr->environment()); |
| current_prototype = |
| Handle<JSObject>(JSObject::cast(current_prototype->GetPrototype())); |
| // Load next prototype object. |
| @@ -3829,9 +3860,8 @@ void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { |
| } |
| // Check the holder map. |
| - __ Cmp(FieldOperand(reg, HeapObject::kMapOffset), |
| - Handle<Map>(current_prototype->map())); |
| - DeoptimizeIf(not_equal, instr->environment()); |
| + DoCheckMapCommon(reg, Handle<Map>(current_prototype->map()), |
| + ALLOW_ELEMENT_TRANSITION_MAPS, instr->environment()); |
| } |