Index: src/arm/lithium-codegen-arm.cc |
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc |
index e1e35d251ec58c3172e6b696de0a6e0f3d352799..e79caf1854b978711411a9fa434b6bff464c12ed 100644 |
--- a/src/arm/lithium-codegen-arm.cc |
+++ b/src/arm/lithium-codegen-arm.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: |
@@ -4155,14 +4155,26 @@ void LCodeGen::DoCheckFunction(LCheckFunction* instr) { |
} |
+void LCodeGen::DoCheckMapCommon(Register reg, |
+ Register scratch, |
+ Handle<Map> map, |
+ CompareMapMode mode, |
+ LEnvironment* env) { |
+ Label success; |
+ __ CompareMap(reg, scratch, map, &success, mode); |
+ DeoptimizeIf(ne, env); |
+ __ bind(&success); |
+} |
+ |
+ |
void LCodeGen::DoCheckMap(LCheckMap* instr) { |
Register scratch = scratch0(); |
LOperand* input = instr->InputAt(0); |
ASSERT(input->IsRegister()); |
Register reg = ToRegister(input); |
- __ ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset)); |
- __ cmp(scratch, Operand(instr->hydrogen()->map())); |
- DeoptimizeIf(ne, instr->environment()); |
+ Handle<Map> map = instr->hydrogen()->map(); |
+ DoCheckMapCommon(reg, scratch, map, instr->hydrogen()->mode(), |
+ instr->environment()); |
} |
@@ -4231,9 +4243,9 @@ void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { |
// Check prototype maps up to the holder. |
while (!current_prototype.is_identical_to(holder)) { |
- __ ldr(temp2, FieldMemOperand(temp1, HeapObject::kMapOffset)); |
- __ cmp(temp2, Operand(Handle<Map>(current_prototype->map()))); |
- DeoptimizeIf(ne, instr->environment()); |
+ DoCheckMapCommon(temp1, temp2, |
+ Handle<Map>(current_prototype->map()), |
+ ALLOW_ELEMENT_TRANSITION_MAPS, instr->environment()); |
current_prototype = |
Handle<JSObject>(JSObject::cast(current_prototype->GetPrototype())); |
// Load next prototype object. |
@@ -4241,8 +4253,9 @@ void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { |
} |
// Check the holder map. |
- __ ldr(temp2, FieldMemOperand(temp1, HeapObject::kMapOffset)); |
- __ cmp(temp2, Operand(Handle<Map>(current_prototype->map()))); |
+ DoCheckMapCommon(temp1, temp2, |
+ Handle<Map>(current_prototype->map()), |
+ ALLOW_ELEMENT_TRANSITION_MAPS, instr->environment()); |
DeoptimizeIf(ne, instr->environment()); |
} |