Ignore:
Timestamp:
Feb 16, 2011, 1:35:19 PM (14 years ago)
Author:
[email protected]
Message:

Bug 54524 - Allow JSObject to fully utilize cell's capacity for inline storage.

Reviewed by Geoff Garen.

Currently JSObject is both directly instantiated for regular JS objects, and
derived to implement subtypes. A consequence of this is that we need to ensure
that sufficient space from the cell is left unused and available for any data
members that will be introduced by subclasses of JSObject. By restructuring
the internal storage array out of JSObject we can increase the size in the
internal storage for regular objects.

Add classes JSFinalObject and JSNonFinalObject. JSNonFinalObject retains as
much additional capacity as is currently available to allow for data members
in subclasses. JSFinalObject utilizes all available space for internal storage,
and only allows construction through JSFinalObject::create().

Source/JavaScriptCore:

The additional storage made available in the JSObject means that we need no
longer rely on a union of the internal storage with a pointer to storage that
is only valid for external storage. This means we can go back to always having
a valid pointer to property storage, regardless of whether this is internal or
external. This simplifies some cases of access to the array from C code, and
significantly simplifies JIT access, since repatching no longer needs to be
able to change between a load of the storage pointer / a LEA of the internal
storage.

  • API/JSObjectRef.cpp:

(JSObjectMake):

  • assembler/ARMAssembler.h:
  • assembler/ARMv7Assembler.h:
  • assembler/AbstractMacroAssembler.h:

(JSC::AbstractMacroAssembler::repatchPointer):

  • assembler/MIPSAssembler.h:
  • assembler/MacroAssemblerARM.h:
  • assembler/MacroAssemblerARMv7.h:
  • assembler/MacroAssemblerMIPS.h:
  • assembler/MacroAssemblerX86.h:
  • assembler/MacroAssemblerX86_64.h:
  • assembler/RepatchBuffer.h:
  • assembler/X86Assembler.h:
  • debugger/DebuggerActivation.cpp:

(JSC::DebuggerActivation::DebuggerActivation):

  • debugger/DebuggerActivation.h:
  • interpreter/Interpreter.cpp:

(JSC::Interpreter::privateExecute):

  • jit/JIT.h:
  • jit/JITOpcodes.cpp:

(JSC::JIT::emit_op_resolve_global):

  • jit/JITOpcodes32_64.cpp:

(JSC::JIT::emit_op_resolve_global):

  • jit/JITPropertyAccess.cpp:

(JSC::JIT::compileGetDirectOffset):
(JSC::JIT::emit_op_get_by_pname):
(JSC::JIT::compileGetByIdHotPath):
(JSC::JIT::emit_op_put_by_id):
(JSC::JIT::compilePutDirectOffset):
(JSC::JIT::patchGetByIdSelf):
(JSC::JIT::patchPutByIdReplace):
(JSC::JIT::privateCompileGetByIdProto):
(JSC::JIT::privateCompileGetByIdSelfList):
(JSC::JIT::privateCompileGetByIdProtoList):
(JSC::JIT::privateCompileGetByIdChainList):
(JSC::JIT::privateCompileGetByIdChain):

  • jit/JITPropertyAccess32_64.cpp:

(JSC::JIT::compileGetByIdHotPath):
(JSC::JIT::emit_op_put_by_id):
(JSC::JIT::compilePutDirectOffset):
(JSC::JIT::compileGetDirectOffset):
(JSC::JIT::patchGetByIdSelf):
(JSC::JIT::patchPutByIdReplace):
(JSC::JIT::privateCompileGetByIdProto):
(JSC::JIT::privateCompileGetByIdSelfList):
(JSC::JIT::privateCompileGetByIdProtoList):
(JSC::JIT::privateCompileGetByIdChainList):
(JSC::JIT::privateCompileGetByIdChain):
(JSC::JIT::emit_op_get_by_pname):

  • jit/JITStubs.cpp:

(JSC::DEFINE_STUB_FUNCTION):

  • runtime/Arguments.h:

(JSC::Arguments::Arguments):

  • runtime/ErrorInstance.cpp:

(JSC::ErrorInstance::ErrorInstance):

  • runtime/ErrorInstance.h:
  • runtime/ExceptionHelpers.cpp:

(JSC::InterruptedExecutionError::InterruptedExecutionError):
(JSC::TerminatedExecutionError::TerminatedExecutionError):

  • runtime/JSArray.cpp:

(JSC::JSArray::JSArray):

  • runtime/JSArray.h:
  • runtime/JSByteArray.cpp:

(JSC::JSByteArray::JSByteArray):

  • runtime/JSByteArray.h:

(JSC::JSByteArray::JSByteArray):

  • runtime/JSFunction.cpp:

(JSC::JSFunction::getOwnPropertySlot):

  • runtime/JSGlobalData.cpp:

(JSC::JSGlobalData::JSGlobalData):

  • runtime/JSGlobalObject.h:

(JSC::constructEmptyObject):

  • runtime/JSNotAnObject.h:

(JSC::JSNotAnObject::JSNotAnObject):

  • runtime/JSObject.cpp:

(JSC::JSObject::createInheritorID):
(JSC::JSObject::allocatePropertyStorage):

  • runtime/JSObject.h:

(JSC::JSObject::propertyStorage):
(JSC::JSNonFinalObject::JSNonFinalObject):
(JSC::JSNonFinalObject::createStructure):
(JSC::JSFinalObject::create):
(JSC::JSFinalObject::createStructure):
(JSC::JSFinalObject::JSFinalObject):
(JSC::JSObject::offsetOfInlineStorage):
(JSC::constructEmptyObject):
(JSC::createEmptyObjectStructure):
(JSC::JSObject::JSObject):
(JSC::JSObject::~JSObject):
(JSC::Structure::isUsingInlineStorage):

  • runtime/JSObjectWithGlobalObject.cpp:

(JSC::JSObjectWithGlobalObject::JSObjectWithGlobalObject):

  • runtime/JSObjectWithGlobalObject.h:

(JSC::JSObjectWithGlobalObject::JSObjectWithGlobalObject):

  • runtime/JSTypeInfo.h:

(JSC::TypeInfo::TypeInfo):
(JSC::TypeInfo::isVanilla):

  • runtime/JSVariableObject.h:

(JSC::JSVariableObject::JSVariableObject):

  • runtime/JSWrapperObject.h:

(JSC::JSWrapperObject::JSWrapperObject):

  • runtime/ObjectConstructor.cpp:

(JSC::constructObject):

  • runtime/ObjectPrototype.cpp:

(JSC::ObjectPrototype::ObjectPrototype):

  • runtime/ObjectPrototype.h:
  • runtime/StrictEvalActivation.cpp:

(JSC::StrictEvalActivation::StrictEvalActivation):

  • runtime/StrictEvalActivation.h:
  • runtime/Structure.cpp:

(JSC::Structure::Structure):
(JSC::Structure::growPropertyStorageCapacity):

Source/JavaScriptGlue:

  • UserObjectImp.cpp:
  • UserObjectImp.h:

Update JSObject -> JSNonFinalObject.

Source/WebCore:

  • bindings/js/JSDOMWindowShell.h:

Update JSObject -> JSNonFinalObject.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/jit/JIT.h

    r78174 r78732  
    333333#endif
    334334        void compileGetDirectOffset(RegisterID base, RegisterID resultTag, RegisterID resultPayload, Structure* structure, size_t cachedOffset);
    335         void compileGetDirectOffset(JSObject* base, RegisterID temp, RegisterID resultTag, RegisterID resultPayload, size_t cachedOffset);
    336         void compileGetDirectOffset(RegisterID base, RegisterID resultTag, RegisterID resultPayload, RegisterID structure, RegisterID offset);
     335        void compileGetDirectOffset(JSObject* base, RegisterID resultTag, RegisterID resultPayload, size_t cachedOffset);
     336        void compileGetDirectOffset(RegisterID base, RegisterID resultTag, RegisterID resultPayload, RegisterID offset);
    337337        void compilePutDirectOffset(RegisterID base, RegisterID valueTag, RegisterID valuePayload, Structure* structure, size_t cachedOffset);
    338338
     
    345345        // These architecture specific value are used to enable patching - see comment on op_put_by_id.
    346346        static const int patchOffsetPutByIdStructure = 7;
    347         static const int patchOffsetPutByIdExternalLoad = 13;
    348         static const int patchLengthPutByIdExternalLoad = 3;
    349347        static const int patchOffsetPutByIdPropertyMapOffset1 = 22;
    350348        static const int patchOffsetPutByIdPropertyMapOffset2 = 28;
     
    352350        static const int patchOffsetGetByIdStructure = 7;
    353351        static const int patchOffsetGetByIdBranchToSlowCase = 13;
    354         static const int patchOffsetGetByIdExternalLoad = 13;
    355         static const int patchLengthGetByIdExternalLoad = 3;
    356352        static const int patchOffsetGetByIdPropertyMapOffset1 = 22;
    357353        static const int patchOffsetGetByIdPropertyMapOffset2 = 28;
     
    370366        // These architecture specific value are used to enable patching - see comment on op_put_by_id.
    371367        static const int patchOffsetPutByIdStructure = 4;
    372         static const int patchOffsetPutByIdExternalLoad = 16;
    373         static const int patchLengthPutByIdExternalLoad = 4;
    374368        static const int patchOffsetPutByIdPropertyMapOffset1 = 20;
    375369        static const int patchOffsetPutByIdPropertyMapOffset2 = 28;
     
    377371        static const int patchOffsetGetByIdStructure = 4;
    378372        static const int patchOffsetGetByIdBranchToSlowCase = 16;
    379         static const int patchOffsetGetByIdExternalLoad = 16;
    380         static const int patchLengthGetByIdExternalLoad = 4;
    381373        static const int patchOffsetGetByIdPropertyMapOffset1 = 20;
    382374        static const int patchOffsetGetByIdPropertyMapOffset2 = 28;
     
    411403        // These architecture specific value are used to enable patching - see comment on op_put_by_id.
    412404        static const int patchOffsetPutByIdStructure = 10;
    413         static const int patchOffsetPutByIdExternalLoad = 26;
    414         static const int patchLengthPutByIdExternalLoad = 12;
    415405        static const int patchOffsetPutByIdPropertyMapOffset1 = 46;
    416406        static const int patchOffsetPutByIdPropertyMapOffset2 = 58;
     
    418408        static const int patchOffsetGetByIdStructure = 10;
    419409        static const int patchOffsetGetByIdBranchToSlowCase = 26;
    420         static const int patchOffsetGetByIdExternalLoad = 26;
    421         static const int patchLengthGetByIdExternalLoad = 12;
    422410        static const int patchOffsetGetByIdPropertyMapOffset1 = 46;
    423411        static const int patchOffsetGetByIdPropertyMapOffset2 = 58;
     
    452440#if WTF_MIPS_ISA(1)
    453441        static const int patchOffsetPutByIdStructure = 16;
    454         static const int patchOffsetPutByIdExternalLoad = 48;
    455         static const int patchLengthPutByIdExternalLoad = 20;
    456442        static const int patchOffsetPutByIdPropertyMapOffset1 = 68;
    457443        static const int patchOffsetPutByIdPropertyMapOffset2 = 84;
    458444        static const int patchOffsetGetByIdStructure = 16;
    459445        static const int patchOffsetGetByIdBranchToSlowCase = 48;
    460         static const int patchOffsetGetByIdExternalLoad = 48;
    461         static const int patchLengthGetByIdExternalLoad = 20;
    462446        static const int patchOffsetGetByIdPropertyMapOffset1 = 68;
    463447        static const int patchOffsetGetByIdPropertyMapOffset2 = 88;
     
    474458#else // WTF_MIPS_ISA(1)
    475459        static const int patchOffsetPutByIdStructure = 12;
    476         static const int patchOffsetPutByIdExternalLoad = 44;
    477         static const int patchLengthPutByIdExternalLoad = 16;
    478460        static const int patchOffsetPutByIdPropertyMapOffset1 = 60;
    479461        static const int patchOffsetPutByIdPropertyMapOffset2 = 76;
    480462        static const int patchOffsetGetByIdStructure = 12;
    481463        static const int patchOffsetGetByIdBranchToSlowCase = 44;
    482         static const int patchOffsetGetByIdExternalLoad = 44;
    483         static const int patchLengthGetByIdExternalLoad = 16;
    484464        static const int patchOffsetGetByIdPropertyMapOffset1 = 60;
    485465        static const int patchOffsetGetByIdPropertyMapOffset2 = 76;
     
    552532#endif
    553533        void compileGetDirectOffset(RegisterID base, RegisterID result, Structure* structure, size_t cachedOffset);
    554         void compileGetDirectOffset(JSObject* base, RegisterID temp, RegisterID result, size_t cachedOffset);
    555         void compileGetDirectOffset(RegisterID base, RegisterID result, RegisterID structure, RegisterID offset, RegisterID scratch);
     534        void compileGetDirectOffset(JSObject* base, RegisterID result, size_t cachedOffset);
     535        void compileGetDirectOffset(RegisterID base, RegisterID result, RegisterID offset, RegisterID scratch);
    556536        void compilePutDirectOffset(RegisterID base, RegisterID value, Structure* structure, size_t cachedOffset);
    557537
     
    559539        // These architecture specific value are used to enable patching - see comment on op_put_by_id.
    560540        static const int patchOffsetPutByIdStructure = 10;
    561         static const int patchOffsetPutByIdExternalLoad = 20;
    562         static const int patchLengthPutByIdExternalLoad = 4;
    563541        static const int patchOffsetPutByIdPropertyMapOffset = 31;
    564542        // These architecture specific value are used to enable patching - see comment on op_get_by_id.
    565543        static const int patchOffsetGetByIdStructure = 10;
    566544        static const int patchOffsetGetByIdBranchToSlowCase = 20;
    567         static const int patchOffsetGetByIdExternalLoad = 20;
    568         static const int patchLengthGetByIdExternalLoad = 4;
    569545        static const int patchOffsetGetByIdPropertyMapOffset = 31;
    570546        static const int patchOffsetGetByIdPutResult = 31;
     
    582558        // These architecture specific value are used to enable patching - see comment on op_put_by_id.
    583559        static const int patchOffsetPutByIdStructure = 7;
    584         static const int patchOffsetPutByIdExternalLoad = 13;
    585         static const int patchLengthPutByIdExternalLoad = 3;
    586560        static const int patchOffsetPutByIdPropertyMapOffset = 22;
    587561        // These architecture specific value are used to enable patching - see comment on op_get_by_id.
    588562        static const int patchOffsetGetByIdStructure = 7;
    589563        static const int patchOffsetGetByIdBranchToSlowCase = 13;
    590         static const int patchOffsetGetByIdExternalLoad = 13;
    591         static const int patchLengthGetByIdExternalLoad = 3;
    592564        static const int patchOffsetGetByIdPropertyMapOffset = 22;
    593565        static const int patchOffsetGetByIdPutResult = 22;
     
    605577        // These architecture specific value are used to enable patching - see comment on op_put_by_id.
    606578        static const int patchOffsetPutByIdStructure = 10;
    607         static const int patchOffsetPutByIdExternalLoad = 26;
    608         static const int patchLengthPutByIdExternalLoad = 12;
    609579        static const int patchOffsetPutByIdPropertyMapOffset = 46;
    610580        // These architecture specific value are used to enable patching - see comment on op_get_by_id.
    611581        static const int patchOffsetGetByIdStructure = 10;
    612582        static const int patchOffsetGetByIdBranchToSlowCase = 26;
    613         static const int patchOffsetGetByIdExternalLoad = 26;
    614         static const int patchLengthGetByIdExternalLoad = 12;
    615583        static const int patchOffsetGetByIdPropertyMapOffset = 46;
    616584        static const int patchOffsetGetByIdPutResult = 50;
     
    628596        // These architecture specific value are used to enable patching - see comment on op_put_by_id.
    629597        static const int patchOffsetPutByIdStructure = 4;
    630         static const int patchOffsetPutByIdExternalLoad = 16;
    631         static const int patchLengthPutByIdExternalLoad = 4;
    632598        static const int patchOffsetPutByIdPropertyMapOffset = 20;
    633599        // These architecture specific value are used to enable patching - see comment on op_get_by_id.
    634600        static const int patchOffsetGetByIdStructure = 4;
    635601        static const int patchOffsetGetByIdBranchToSlowCase = 16;
    636         static const int patchOffsetGetByIdExternalLoad = 16;
    637         static const int patchLengthGetByIdExternalLoad = 4;
    638602        static const int patchOffsetGetByIdPropertyMapOffset = 20;
    639603        static const int patchOffsetGetByIdPutResult = 28;
     
    667631#if WTF_MIPS_ISA(1)
    668632        static const int patchOffsetPutByIdStructure = 16;
    669         static const int patchOffsetPutByIdExternalLoad = 48;
    670         static const int patchLengthPutByIdExternalLoad = 20;
    671633        static const int patchOffsetPutByIdPropertyMapOffset = 68;
    672634        static const int patchOffsetGetByIdStructure = 16;
    673635        static const int patchOffsetGetByIdBranchToSlowCase = 48;
    674         static const int patchOffsetGetByIdExternalLoad = 48;
    675         static const int patchLengthGetByIdExternalLoad = 20;
    676636        static const int patchOffsetGetByIdPropertyMapOffset = 68;
    677637        static const int patchOffsetGetByIdPutResult = 88;
     
    687647#else // WTF_MIPS_ISA(1)
    688648        static const int patchOffsetPutByIdStructure = 12;
    689         static const int patchOffsetPutByIdExternalLoad = 44;
    690         static const int patchLengthPutByIdExternalLoad = 16;
    691649        static const int patchOffsetPutByIdPropertyMapOffset = 60;
    692650        static const int patchOffsetGetByIdStructure = 12;
    693651        static const int patchOffsetGetByIdBranchToSlowCase = 44;
    694         static const int patchOffsetGetByIdExternalLoad = 44;
    695         static const int patchLengthGetByIdExternalLoad = 16;
    696652        static const int patchOffsetGetByIdPropertyMapOffset = 60;
    697653        static const int patchOffsetGetByIdPutResult = 76;
Note: See TracChangeset for help on using the changeset viewer.