| Index: src/ia32/stub-cache-ia32.cc
|
| diff --git a/src/ia32/stub-cache-ia32.cc b/src/ia32/stub-cache-ia32.cc
|
| index 7cb7811e22685547c9c90f6b75725b0e90b0f6bf..691e9a63668c03a3ad8d91e8a36e26227627b3ea 100644
|
| --- a/src/ia32/stub-cache-ia32.cc
|
| +++ b/src/ia32/stub-cache-ia32.cc
|
| @@ -3178,145 +3178,6 @@ Handle<Code> BaseLoadStubCompiler::CompilePolymorphicIC(
|
| }
|
|
|
|
|
| -// Specialized stub for constructing objects from functions which only have only
|
| -// simple assignments of the form this.x = ...; in their body.
|
| -Handle<Code> ConstructStubCompiler::CompileConstructStub(
|
| - Handle<JSFunction> function) {
|
| - // ----------- S t a t e -------------
|
| - // -- eax : argc
|
| - // -- edi : constructor
|
| - // -- esp[0] : return address
|
| - // -- esp[4] : last argument
|
| - // -----------------------------------
|
| - Label generic_stub_call;
|
| -#ifdef ENABLE_DEBUGGER_SUPPORT
|
| - // Check to see whether there are any break points in the function code. If
|
| - // there are jump to the generic constructor stub which calls the actual
|
| - // code for the function thereby hitting the break points.
|
| - __ mov(ebx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
|
| - __ mov(ebx, FieldOperand(ebx, SharedFunctionInfo::kDebugInfoOffset));
|
| - __ cmp(ebx, factory()->undefined_value());
|
| - __ j(not_equal, &generic_stub_call);
|
| -#endif
|
| -
|
| - // Load the initial map and verify that it is in fact a map.
|
| - // edi: constructor
|
| - __ mov(ebx, FieldOperand(edi, JSFunction::kPrototypeOrInitialMapOffset));
|
| - // Will both indicate a NULL and a Smi.
|
| - __ JumpIfSmi(ebx, &generic_stub_call);
|
| - __ CmpObjectType(ebx, MAP_TYPE, ecx);
|
| - __ j(not_equal, &generic_stub_call);
|
| -
|
| -#ifdef DEBUG
|
| - // Cannot construct functions this way.
|
| - // ebx: initial map
|
| - __ CmpInstanceType(ebx, JS_FUNCTION_TYPE);
|
| - __ Check(not_equal, "Function constructed by construct stub.");
|
| -#endif
|
| -
|
| - // Now allocate the JSObject on the heap by moving the new space allocation
|
| - // top forward.
|
| - // ebx: initial map
|
| - ASSERT(function->has_initial_map());
|
| - int instance_size = function->initial_map()->instance_size();
|
| -#ifdef DEBUG
|
| - __ movzx_b(ecx, FieldOperand(ebx, Map::kInstanceSizeOffset));
|
| - __ shl(ecx, kPointerSizeLog2);
|
| - __ cmp(ecx, Immediate(instance_size));
|
| - __ Check(equal, "Instance size of initial map changed.");
|
| -#endif
|
| - __ Allocate(instance_size, edx, ecx, no_reg, &generic_stub_call,
|
| - NO_ALLOCATION_FLAGS);
|
| -
|
| - // Allocated the JSObject, now initialize the fields and add the heap tag.
|
| - // ebx: initial map
|
| - // edx: JSObject (untagged)
|
| - __ mov(Operand(edx, JSObject::kMapOffset), ebx);
|
| - __ mov(ebx, factory()->empty_fixed_array());
|
| - __ mov(Operand(edx, JSObject::kPropertiesOffset), ebx);
|
| - __ mov(Operand(edx, JSObject::kElementsOffset), ebx);
|
| -
|
| - // Push the allocated object to the stack. This is the object that will be
|
| - // returned (after it is tagged).
|
| - __ push(edx);
|
| -
|
| - // eax: argc
|
| - // edx: JSObject (untagged)
|
| - // Load the address of the first in-object property into edx.
|
| - __ lea(edx, Operand(edx, JSObject::kHeaderSize));
|
| - // Calculate the location of the first argument. The stack contains the
|
| - // allocated object and the return address on top of the argc arguments.
|
| - __ lea(ecx, Operand(esp, eax, times_4, 1 * kPointerSize));
|
| -
|
| - // Use edi for holding undefined which is used in several places below.
|
| - __ mov(edi, factory()->undefined_value());
|
| -
|
| - // eax: argc
|
| - // ecx: first argument
|
| - // edx: first in-object property of the JSObject
|
| - // edi: undefined
|
| - // Fill the initialized properties with a constant value or a passed argument
|
| - // depending on the this.x = ...; assignment in the function.
|
| - Handle<SharedFunctionInfo> shared(function->shared());
|
| - for (int i = 0; i < shared->this_property_assignments_count(); i++) {
|
| - if (shared->IsThisPropertyAssignmentArgument(i)) {
|
| - // Check if the argument assigned to the property is actually passed.
|
| - // If argument is not passed the property is set to undefined,
|
| - // otherwise find it on the stack.
|
| - int arg_number = shared->GetThisPropertyAssignmentArgument(i);
|
| - __ mov(ebx, edi);
|
| - __ cmp(eax, arg_number);
|
| - if (CpuFeatures::IsSupported(CMOV)) {
|
| - CpuFeatureScope use_cmov(masm(), CMOV);
|
| - __ cmov(above, ebx, Operand(ecx, arg_number * -kPointerSize));
|
| - } else {
|
| - Label not_passed;
|
| - __ j(below_equal, ¬_passed);
|
| - __ mov(ebx, Operand(ecx, arg_number * -kPointerSize));
|
| - __ bind(¬_passed);
|
| - }
|
| - // Store value in the property.
|
| - __ mov(Operand(edx, i * kPointerSize), ebx);
|
| - } else {
|
| - // Set the property to the constant value.
|
| - Handle<Object> constant(shared->GetThisPropertyAssignmentConstant(i),
|
| - isolate());
|
| - __ mov(Operand(edx, i * kPointerSize), Immediate(constant));
|
| - }
|
| - }
|
| -
|
| - // Fill the unused in-object property fields with undefined.
|
| - for (int i = shared->this_property_assignments_count();
|
| - i < function->initial_map()->inobject_properties();
|
| - i++) {
|
| - __ mov(Operand(edx, i * kPointerSize), edi);
|
| - }
|
| -
|
| - // Move argc to ebx and retrieve and tag the JSObject to return.
|
| - __ mov(ebx, eax);
|
| - __ pop(eax);
|
| - __ or_(eax, Immediate(kHeapObjectTag));
|
| -
|
| - // Remove caller arguments and receiver from the stack and return.
|
| - __ pop(ecx);
|
| - __ lea(esp, Operand(esp, ebx, times_pointer_size, 1 * kPointerSize));
|
| - __ push(ecx);
|
| - Counters* counters = isolate()->counters();
|
| - __ IncrementCounter(counters->constructed_objects(), 1);
|
| - __ IncrementCounter(counters->constructed_objects_stub(), 1);
|
| - __ ret(0);
|
| -
|
| - // Jump to the generic stub in case the specialized code cannot handle the
|
| - // construction.
|
| - __ bind(&generic_stub_call);
|
| - Handle<Code> code = isolate()->builtins()->JSConstructStubGeneric();
|
| - __ jmp(code, RelocInfo::CODE_TARGET);
|
| -
|
| - // Return the generated code.
|
| - return GetCode();
|
| -}
|
| -
|
| -
|
| #undef __
|
| #define __ ACCESS_MASM(masm)
|
|
|
|
|