Fix issue 656 on ARM.

TBR=iposva@chromium.org
Review URL: http://codereview.chromium.org/1117010

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4214 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
kasperl@chromium.org 2010-03-23 07:14:25 +00:00
parent 4ddc744f47
commit c2427115db

View File

@ -2311,8 +2311,7 @@ void CodeGenerator::InstantiateFunction(
__ mov(r0, Operand(function_info));
// Use the fast case closure allocation code that allocates in new
// space for nested functions that don't need literals cloning.
if (false &&
scope()->is_function_scope() && function_info->num_literals() == 0) {
if (scope()->is_function_scope() && function_info->num_literals() == 0) {
FastNewClosureStub stub;
frame_->EmitPush(r0);
frame_->CallStub(&stub, 1);
@ -4527,11 +4526,11 @@ void Reference::SetValue(InitState init_state) {
void FastNewClosureStub::Generate(MacroAssembler* masm) {
// Clone the boilerplate in new space. Set the context to the
// current context in cp.
// Create a new closure from the given function info in new
// space. Set the context to the current context in cp.
Label gc;
// Pop the boilerplate function from the stack.
// Pop the function info from the stack.
__ pop(r3);
// Attempt to allocate new JSFunction in new space.
@ -4549,20 +4548,18 @@ void FastNewClosureStub::Generate(MacroAssembler* masm) {
__ ldr(r2, MemOperand(r2, Context::SlotOffset(Context::FUNCTION_MAP_INDEX)));
__ str(r2, FieldMemOperand(r0, HeapObject::kMapOffset));
// Clone the rest of the boilerplate fields. We don't have to update
// the write barrier because the allocated object is in new space.
for (int offset = kPointerSize;
offset < JSFunction::kSize;
offset += kPointerSize) {
if (offset == JSFunction::kContextOffset) {
__ str(cp, FieldMemOperand(r0, offset));
} else {
__ ldr(r1, FieldMemOperand(r3, offset));
__ str(r1, FieldMemOperand(r0, offset));
}
}
// Initialize the rest of the function. We don't have to update the
// write barrier because the allocated object is in new space.
__ LoadRoot(r1, Heap::kEmptyFixedArrayRootIndex);
__ LoadRoot(r2, Heap::kTheHoleValueRootIndex);
__ str(r1, FieldMemOperand(r0, JSObject::kPropertiesOffset));
__ str(r1, FieldMemOperand(r0, JSObject::kElementsOffset));
__ str(r2, FieldMemOperand(r0, JSFunction::kPrototypeOrInitialMapOffset));
__ str(r3, FieldMemOperand(r0, JSFunction::kSharedFunctionInfoOffset));
__ str(cp, FieldMemOperand(r0, JSFunction::kContextOffset));
__ str(r1, FieldMemOperand(r0, JSFunction::kLiteralsOffset));
// Return result. The argument boilerplate has been popped already.
// Return result. The argument function info has been popped already.
__ Ret();
// Create a new closure through the slower runtime call.