Fixed remaining bugs in COW-regexp-results.

Review URL: http://codereview.chromium.org/3197011

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5322 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
lrn@chromium.org 2010-08-23 13:58:56 +00:00
parent 528eb97b3a
commit 0d12f8f4e5
8 changed files with 24 additions and 30 deletions

View File

@ -5295,6 +5295,13 @@ void CodeGenerator::GenerateRegExpCloneResult(ZoneList<Expression*>* args) {
__ cmp(r1, Operand(ip));
__ b(ne, &done);
if (FLAG_debug_code) {
__ LoadRoot(r2, Heap::kEmptyFixedArrayRootIndex);
__ ldr(ip, FieldMemOperand(r0, JSObject::kPropertiesOffset));
__ cmp(ip, r2);
__ Check(eq, "JSRegExpResult: default map but non-empty properties.");
}
// All set, copy the contents to a new object.
__ AllocateInNewSpace(JSRegExpResult::kSize,
r2,
@ -5310,7 +5317,6 @@ void CodeGenerator::GenerateRegExpCloneResult(ZoneList<Expression*>* args) {
__ ldm(ib, r0, r3.bit() | r4.bit() | r5.bit() | r6.bit() | r7.bit());
__ stm(ia, r2,
r1.bit() | r3.bit() | r4.bit() | r5.bit() | r6.bit() | r7.bit());
ASSERT(!Heap::InNewSpace(Heap::fixed_cow_array_map()));
ASSERT(JSRegExp::kElementsOffset == 2 * kPointerSize);
// Check whether elements array is empty fixed array, and otherwise make
// it copy-on-write (it never should be empty unless someone is messing

View File

@ -2400,14 +2400,6 @@ void FullCodeGenerator::EmitRegExpConstructResult(ZoneList<Expression*>* args) {
}
void FullCodeGenerator::EmitRegExpCloneResult(ZoneList<Expression*>* args) {
ASSERT(args->length() == 1);
VisitForValue(args->at(0), kStack);
__ CallRuntime(Runtime::kRegExpConstructResult, 1);
Apply(context_, r0);
}
void FullCodeGenerator::EmitSwapElements(ZoneList<Expression*>* args) {
ASSERT(args->length() == 3);
VisitForValue(args->at(0), kStack);

View File

@ -1427,6 +1427,14 @@ int FullCodeGenerator::TryCatch::Exit(int stack_depth) {
return 0;
}
void FullCodeGenerator::EmitRegExpCloneResult(ZoneList<Expression*>* args) {
ASSERT(args->length() == 1);
VisitForValue(args->at(0), kStack);
__ CallRuntime(Runtime::kRegExpCloneResult, 1);
Apply(context_, result_register());
}
#undef __

View File

@ -7447,7 +7447,6 @@ void CodeGenerator::GenerateRegExpCloneResult(ZoneList<Expression*>* args) {
Label empty;
__ cmp(Operand(edx), Immediate(Factory::empty_fixed_array()));
__ j(equal, &empty);
ASSERT(!Heap::InNewSpace(Heap::fixed_cow_array_map()));
__ mov(FieldOperand(edx, HeapObject::kMapOffset),
Immediate(Factory::fixed_cow_array_map()));
__ bind(&empty);

View File

@ -2410,14 +2410,6 @@ void FullCodeGenerator::EmitRegExpConstructResult(ZoneList<Expression*>* args) {
}
void FullCodeGenerator::EmitRegExpCloneResult(ZoneList<Expression*>* args) {
ASSERT(args->length() == 1);
VisitForValue(args->at(0), kStack);
__ CallRuntime(Runtime::kRegExpCloneResult, 1);
Apply(context_, eax);
}
void FullCodeGenerator::EmitSwapElements(ZoneList<Expression*>* args) {
ASSERT(args->length() == 3);
VisitForValue(args->at(0), kStack);

View File

@ -1403,8 +1403,6 @@ static Object* Runtime_RegExpCloneResult(Arguments args) {
// Copy JSObject elements as copy-on-write.
FixedArray* elements = FixedArray::cast(result->elements());
if (elements != Heap::empty_fixed_array()) {
ASSERT(!Heap::InNewSpace(Heap::fixed_cow_array_map()));
// No write barrier is necessary when writing old-space pointer.
elements->set_map(Heap::fixed_cow_array_map());
}
new_array->set_elements(elements);

View File

@ -4833,7 +4833,7 @@ void DeferredAllocateInNewSpace::Generate() {
for (int i = kNumRegs - 1; i >= 0; i--) {
if (registers_to_save_ & (1 << i)) {
Register save_register = { i };
__ push(save_register);
__ pop(save_register);
}
}
}
@ -6648,6 +6648,14 @@ void CodeGenerator::GenerateRegExpCloneResult(ZoneList<Expression*>* args) {
__ cmpq(rdx, FieldOperand(rax, HeapObject::kMapOffset));
__ j(not_equal, &done);
if (FLAG_debug_code) {
// Check that object really has empty properties array, as the map
// should guarantee.
__ CompareRoot(FieldOperand(rax, JSObject::kPropertiesOffset),
Heap::kEmptyFixedArrayRootIndex);
__ Check(equal, "JSRegExpResult: default map but non-empty properties.");
}
DeferredAllocateInNewSpace* allocate_fallback =
new DeferredAllocateInNewSpace(JSRegExpResult::kSize,
rbx,
@ -6680,7 +6688,6 @@ void CodeGenerator::GenerateRegExpCloneResult(ZoneList<Expression*>* args) {
Label empty;
__ CompareRoot(rdx, Heap::kEmptyFixedArrayRootIndex);
__ j(equal, &empty);
ASSERT(!Heap::InNewSpace(Heap::fixed_cow_array_map()));
__ LoadRoot(kScratchRegister, Heap::kFixedCOWArrayMapRootIndex);
__ movq(FieldOperand(rdx, HeapObject::kMapOffset), kScratchRegister);
__ bind(&empty);

View File

@ -2399,14 +2399,6 @@ void FullCodeGenerator::EmitRegExpConstructResult(ZoneList<Expression*>* args) {
}
void FullCodeGenerator::EmitRegExpCloneResult(ZoneList<Expression*>* args) {
ASSERT(args->length() == 1);
VisitForValue(args->at(0), kStack);
__ CallRuntime(Runtime::kRegExpCloneResult, 1);
Apply(context_, rax);
}
void FullCodeGenerator::EmitSwapElements(ZoneList<Expression*>* args) {
ASSERT(args->length() == 3);
VisitForValue(args->at(0), kStack);