Commit aa55407a authored by kasperl@chromium.org's avatar kasperl@chromium.org

Fix issue 656 on x86.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4212 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent a1ec99c0
...@@ -4430,9 +4430,7 @@ Result CodeGenerator::InstantiateFunction( ...@@ -4430,9 +4430,7 @@ Result CodeGenerator::InstantiateFunction(
// Use the fast case closure allocation code that allocates in new // Use the fast case closure allocation code that allocates in new
// space for nested functions that don't need literals cloning. // space for nested functions that don't need literals cloning.
// TODO(656): reimplement fast new closure stub if (scope()->is_function_scope() && function_info->num_literals() == 0) {
if (false && scope()->is_function_scope() &&
function_info->num_literals() == 0) {
FastNewClosureStub stub; FastNewClosureStub stub;
frame()->EmitPush(Immediate(function_info)); frame()->EmitPush(Immediate(function_info));
return frame()->CallStub(&stub, 1); return frame()->CallStub(&stub, 1);
...@@ -8206,12 +8204,12 @@ void Reference::SetValue(InitState init_state) { ...@@ -8206,12 +8204,12 @@ void Reference::SetValue(InitState init_state) {
void FastNewClosureStub::Generate(MacroAssembler* masm) { void FastNewClosureStub::Generate(MacroAssembler* masm) {
// Clone the boilerplate in new space. Set the context to the // Create a new closure from the given function info in new
// current context in esi. // space. Set the context to the current context in esi.
Label gc; Label gc;
__ AllocateInNewSpace(JSFunction::kSize, eax, ebx, ecx, &gc, TAG_OBJECT); __ AllocateInNewSpace(JSFunction::kSize, eax, ebx, ecx, &gc, TAG_OBJECT);
// Get the boilerplate function from the stack. // Get the function info from the stack.
__ mov(edx, Operand(esp, 1 * kPointerSize)); __ mov(edx, Operand(esp, 1 * kPointerSize));
// Compute the function map in the current global context and set that // Compute the function map in the current global context and set that
...@@ -8221,18 +8219,16 @@ void FastNewClosureStub::Generate(MacroAssembler* masm) { ...@@ -8221,18 +8219,16 @@ void FastNewClosureStub::Generate(MacroAssembler* masm) {
__ mov(ecx, Operand(ecx, Context::SlotOffset(Context::FUNCTION_MAP_INDEX))); __ mov(ecx, Operand(ecx, Context::SlotOffset(Context::FUNCTION_MAP_INDEX)));
__ mov(FieldOperand(eax, JSObject::kMapOffset), ecx); __ mov(FieldOperand(eax, JSObject::kMapOffset), ecx);
// Clone the rest of the boilerplate fields. We don't have to update // Initialize the rest of the function. We don't have to update the
// the write barrier because the allocated object is in new space. // write barrier because the allocated object is in new space.
for (int offset = kPointerSize; __ mov(ebx, Immediate(Factory::empty_fixed_array()));
offset < JSFunction::kSize; __ mov(FieldOperand(eax, JSObject::kPropertiesOffset), ebx);
offset += kPointerSize) { __ mov(FieldOperand(eax, JSObject::kElementsOffset), ebx);
if (offset == JSFunction::kContextOffset) { __ mov(FieldOperand(eax, JSFunction::kPrototypeOrInitialMapOffset),
__ mov(FieldOperand(eax, offset), esi); Immediate(Factory::the_hole_value()));
} else { __ mov(FieldOperand(eax, JSFunction::kSharedFunctionInfoOffset), edx);
__ mov(ebx, FieldOperand(edx, offset)); __ mov(FieldOperand(eax, JSFunction::kContextOffset), esi);
__ mov(FieldOperand(eax, offset), ebx); __ mov(FieldOperand(eax, JSFunction::kLiteralsOffset), ebx);
}
}
// Return and remove the on-stack parameter. // Return and remove the on-stack parameter.
__ ret(1 * kPointerSize); __ ret(1 * kPointerSize);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment