X87: Fix object initialization when slack tracking for it's map is still enabled.

port 2fc2cb99f5 (r32144)

  original commit message:
  The old code was not ready for properly initialize objects with non standard headers and non zero in-object properties number.

  MacroAssembler::Allocate() implementations now return both start and end addresses of the new object (done by parameter renaming).

BUG=

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

Cr-Commit-Position: refs/heads/master@{#32161}
This commit is contained in:
zhengxing.li 2015-11-22 19:16:48 -08:00 committed by Commit bot
parent ea1d0a61be
commit d23330d496
3 changed files with 14 additions and 21 deletions

View File

@ -241,18 +241,12 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
__ j(less, &no_inobject_slack_tracking);
// Allocate object with a slack.
__ movzx_b(
esi,
FieldOperand(
eax,
Map::kInObjectPropertiesOrConstructorFunctionIndexOffset));
__ movzx_b(eax, FieldOperand(eax, Map::kUnusedPropertyFieldsOffset));
__ sub(esi, eax);
__ lea(esi,
Operand(ebx, esi, times_pointer_size, JSObject::kHeaderSize));
__ movzx_b(esi, FieldOperand(eax, Map::kUnusedPropertyFieldsOffset));
__ neg(esi);
__ lea(esi, Operand(edi, esi, times_pointer_size, 0));
// esi: offset of first field after pre-allocated fields
if (FLAG_debug_code) {
__ cmp(esi, edi);
__ cmp(ecx, esi);
__ Assert(less_equal,
kUnexpectedNumberOfPreAllocatedPropertyFields);
}

View File

@ -1700,16 +1700,16 @@ void MacroAssembler::CopyBytes(Register source,
}
void MacroAssembler::InitializeFieldsWithFiller(Register start_offset,
Register end_offset,
void MacroAssembler::InitializeFieldsWithFiller(Register current_address,
Register end_address,
Register filler) {
Label loop, entry;
jmp(&entry);
bind(&loop);
mov(Operand(start_offset, 0), filler);
add(start_offset, Immediate(kPointerSize));
mov(Operand(current_address, 0), filler);
add(current_address, Immediate(kPointerSize));
bind(&entry);
cmp(start_offset, end_offset);
cmp(current_address, end_address);
j(below, &loop);
}

View File

@ -685,12 +685,11 @@ class MacroAssembler: public Assembler {
Register length,
Register scratch);
// Initialize fields with filler values. Fields starting at |start_offset|
// not including end_offset are overwritten with the value in |filler|. At
// the end the loop, |start_offset| takes the value of |end_offset|.
void InitializeFieldsWithFiller(Register start_offset,
Register end_offset,
Register filler);
// Initialize fields with filler values. Fields starting at |current_address|
// not including |end_address| are overwritten with the value in |filler|. At
// the end the loop, |current_address| takes the value of |end_address|.
void InitializeFieldsWithFiller(Register current_address,
Register end_address, Register filler);
// ---------------------------------------------------------------------------
// Support functions.