Index: src/ia32/macro-assembler-ia32.cc |
diff --git a/src/ia32/macro-assembler-ia32.cc b/src/ia32/macro-assembler-ia32.cc |
index 19a380b029bd8055a5db70b68b52be382b35e4f1..49fc88b9101031727a18fcdc044821a75d258052 100644 |
--- a/src/ia32/macro-assembler-ia32.cc |
+++ b/src/ia32/macro-assembler-ia32.cc |
@@ -538,6 +538,7 @@ void MacroAssembler::PopTryHandler() { |
Register MacroAssembler::CheckMaps(JSObject* object, Register object_reg, |
JSObject* holder, Register holder_reg, |
Register scratch, |
+ int save_at_depth, |
Label* miss) { |
// Make sure there's no overlap between scratch and the other |
// registers. |
@@ -545,7 +546,11 @@ Register MacroAssembler::CheckMaps(JSObject* object, Register object_reg, |
// Keep track of the current object in register reg. |
Register reg = object_reg; |
- int depth = 1; |
+ int depth = 0; |
+ |
+ if (save_at_depth == depth) { |
+ mov(Operand(esp, kPointerSize), object_reg); |
+ } |
// Check the maps in the prototype chain. |
// Traverse the prototype chain from the object and do map checks. |
@@ -577,7 +582,6 @@ Register MacroAssembler::CheckMaps(JSObject* object, Register object_reg, |
// to it in the code. Load it from the map. |
reg = holder_reg; // from now the object is in holder_reg |
mov(reg, FieldOperand(scratch, Map::kPrototypeOffset)); |
- |
} else { |
// Check the map of the current object. |
cmp(FieldOperand(reg, HeapObject::kMapOffset), |
@@ -595,6 +599,10 @@ Register MacroAssembler::CheckMaps(JSObject* object, Register object_reg, |
mov(reg, Handle<JSObject>(prototype)); |
} |
+ if (save_at_depth == depth) { |
+ mov(Operand(esp, kPointerSize), reg); |
+ } |
+ |
// Go to the next object in the prototype chain. |
object = prototype; |
} |
@@ -605,7 +613,7 @@ Register MacroAssembler::CheckMaps(JSObject* object, Register object_reg, |
j(not_equal, miss, not_taken); |
// Log the check depth. |
- LOG(IntEvent("check-maps-depth", depth)); |
+ LOG(IntEvent("check-maps-depth", depth + 1)); |
// Perform security check for access to the global object and return |
// the holder register. |