Bug 56270 - The JIT 'friend's many classes in JSC; start unwinding this.
authorbarraclough@apple.com <barraclough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 13 Mar 2011 21:16:29 +0000 (21:16 +0000)
committerbarraclough@apple.com <barraclough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 13 Mar 2011 21:16:29 +0000 (21:16 +0000)
commit62c78890837981f4ed0723ca5dcbf2c44ba7fd42
tree8982d1d0466d8688fdb597a63024a0a1b334526d
parent0b6a8dfec344e3f54e8d79a25b22b8ae3a8f864b
Bug 56270 - The JIT 'friend's many classes in JSC; start unwinding this.

Reviewed by Sam Weinig.

The JIT need to 'friend' other classes in order to be able to calculate offsets
of various properties, or the absolute addresses of members within specific objects,
in order to JIT generate code that will access members within the class when run.

Instead of using friends in these cases, switch to providing specific accessor
methods to provide this information.  In the case of offsets, these can be static
functions, and in the case of pointers to members within a specific object these can
be const methods returning pointers to const values, to prevent clients from
modifying values otherwise encapsulated within classes.

* bytecode/SamplingTool.h:
* interpreter/Register.h:
* interpreter/RegisterFile.h:
* runtime/JSArray.h:
* runtime/JSCell.h:
* runtime/JSTypeInfo.h:
* runtime/JSVariableObject.h:
* runtime/Structure.h:
* wtf/RefCounted.h:
    - Change these classes to no longer friend the JIT, add accessors for member offsets.
* jit/JIT.cpp:
* jit/JITCall32_64.cpp:
* jit/JITInlineMethods.h:
* jit/JITOpcodes.cpp:
* jit/JITOpcodes32_64.cpp:
* jit/JITPropertyAccess.cpp:
* jit/JITPropertyAccess32_64.cpp:
    - Change the JIT to use class accessors, rather than taking object ofsets directly.
* assembler/AbstractMacroAssembler.h:
* assembler/MacroAssemblerX86_64.h:
* assembler/X86Assembler.h:
    - Since the accessors for objects members return const pointers to retain encapsulation,
      methods generating code with absolute addresses must be able to handle const pointers
      (the JIT doesn't write to these values, do dies treat the pointer to value as const
      from within the C++ code of the JIT, if not at runtime!).

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@80969 268f45cc-cd09-0410-ab3c-d52691b4dbfc
21 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/JavaScriptCore/assembler/AbstractMacroAssembler.h
Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h
Source/JavaScriptCore/assembler/X86Assembler.h
Source/JavaScriptCore/bytecode/SamplingTool.h
Source/JavaScriptCore/interpreter/Register.h
Source/JavaScriptCore/interpreter/RegisterFile.h
Source/JavaScriptCore/jit/JIT.cpp
Source/JavaScriptCore/jit/JITCall32_64.cpp
Source/JavaScriptCore/jit/JITInlineMethods.h
Source/JavaScriptCore/jit/JITOpcodes.cpp
Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
Source/JavaScriptCore/jit/JITPropertyAccess.cpp
Source/JavaScriptCore/jit/JITPropertyAccess32_64.cpp
Source/JavaScriptCore/runtime/JSArray.h
Source/JavaScriptCore/runtime/JSCell.h
Source/JavaScriptCore/runtime/JSTypeInfo.h
Source/JavaScriptCore/runtime/JSVariableObject.h
Source/JavaScriptCore/runtime/Structure.h
Source/JavaScriptCore/wtf/RefCounted.h