Bug 56270 - The JIT 'friend's many classes in JSC; start unwinding this.
Summary: The JIT 'friend's many classes in JSC; start unwinding this.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Gavin Barraclough
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-13 13:50 PDT by Gavin Barraclough
Modified: 2011-03-13 21:54 PDT (History)
2 users (show)

See Also:


Attachments
The patch (57.17 KB, patch)
2011-03-13 13:58 PDT, Gavin Barraclough
sam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gavin Barraclough 2011-03-13 13:50:07 PDT
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.
Comment 1 Gavin Barraclough 2011-03-13 13:58:59 PDT
Created attachment 85621 [details]
The patch
Comment 2 WebKit Review Bot 2011-03-13 14:00:14 PDT
Attachment 85621 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/JavaScriptCore/ChangeLog', u'Source..." exit_code: 1

Source/JavaScriptCore/assembler/X86Assembler.h:302:  adcl_im is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
Source/JavaScriptCore/assembler/X86Assembler.h:379:  addl_im is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
Source/JavaScriptCore/assembler/X86Assembler.h:445:  andl_im is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
Source/JavaScriptCore/assembler/X86Assembler.h:531:  orl_im is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
Source/JavaScriptCore/assembler/X86Assembler.h:597:  subl_im is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
Source/JavaScriptCore/assembler/X86Assembler.h:870:  cmpl_rm is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
Source/JavaScriptCore/assembler/X86Assembler.h:875:  cmpl_im is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
Source/JavaScriptCore/assembler/X86Assembler.h:1042:  movl_mEAX is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
Source/JavaScriptCore/assembler/X86Assembler.h:1079:  movl_EAXm is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
Source/JavaScriptCore/assembler/X86Assembler.h:1110:  movq_mEAX is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
Source/JavaScriptCore/assembler/X86Assembler.h:1116:  movq_EAXm is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
Source/JavaScriptCore/assembler/X86Assembler.h:1156:  movl_rm is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
Source/JavaScriptCore/assembler/X86Assembler.h:1164:  movl_mr is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
Source/JavaScriptCore/assembler/X86Assembler.h:1172:  movl_i32m is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
Source/JavaScriptCore/assembler/X86Assembler.h:1368:  cvtsi2sd_mr is incorrectly named. Don't use underscores in your identifier names.  [readability/naming] [4]
Total errors found: 15 in 21 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Sam Weinig 2011-03-13 14:05:27 PDT
Comment on attachment 85621 [details]
The patch

View in context: https://bugs.webkit.org/attachment.cgi?id=85621&action=review

> Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:2550
>  			};
>  			buildConfigurationList = 149C277108902AFE008A9EFC /* Build configuration list for PBXProject "JavaScriptCore" */;
>  			compatibilityVersion = "Xcode 3.1";
> +			developmentRegion = English;
>  			hasScannedForEncodings = 1;
>  			knownRegions = (
>  				English,

How old is your xcode?  Please don't check this in.

> Source/JavaScriptCore/interpreter/RegisterFile.h:138
> +        Register*const* addressOfEnd() const

I think a space is needed somewhere here. How about Register* const * addressOfEnd() const

> Source/JavaScriptCore/runtime/JSCell.h:144
> +        Structure*const* addressOfStructure() const

Again with the no spaces!

> Source/JavaScriptCore/runtime/JSVariableObject.h:59
> +        WriteBarrier<Unknown>*const* addressOfRegisters() const { return &m_registers; }

And here.
Comment 4 Gavin Barraclough 2011-03-13 14:57:40 PDT
fixed in r80969
Comment 5 David Kilzer (:ddkilzer) 2011-03-13 21:54:57 PDT
(In reply to comment #4)
> fixed in r80969

Follow-up ARM fix in r80970
Follow-up ARMv7 fix in r80994

<http://trac.webkit.org/changeset/80969>
<http://trac.webkit.org/changeset/80970>
<http://trac.webkit.org/changeset/80994>