Changeset 251584 in webkit


Ignore:
Timestamp:
Oct 24, 2019 11:59:36 PM (5 years ago)
Author:
mark.lam@apple.com
Message:

Move JSC::Register inline methods into RegisterInlines.h.
https://bugs.webkit.org/show_bug.cgi?id=203391

Reviewed by Yusuke Suzuki and Keith Miller.

Source/JavaScriptCore:

We're doing this because:

  1. RegisterInlines.h is the canonical place to put inline Register methods.
  2. It helps reduce build time. e.g. build-jsc went from 208.02 to 196.81 seconds (about a 5% reduction).
  3. This enables experimental work to box JSCells in JSValue.

This patch also handles the fallout of this change, which necessitates more
inline methods being moved from <file>.h to their respective <file>Inlines.h.

JSArray.h used to include ButterflyInlines.h and JSCellInlines.h. This is a
violation of inclusion ordering (.h should not #include Inlines.h). This
violation has been removed.

  • API/JSAPIGlobalObject.mm:
  • CMakeLists.txt:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • bytecode/CodeBlock.h:

(JSC::CallFrame::r): Deleted.
(JSC::CallFrame::uncheckedR): Deleted.

  • bytecode/MetadataTable.cpp:
  • ftl/FTLLowerDFGToB3.cpp:
  • interpreter/CallFrame.h:

(JSC::CallFrame::guaranteedJSValueCallee const): Deleted.
(JSC::CallFrame::jsCallee const): Deleted.
(JSC::CallFrame::codeBlock const): Deleted.
(JSC::CallFrame::unsafeCodeBlock const): Deleted.
(JSC::CallFrame::scope const): Deleted.
(JSC::CallFrame::topOfFrame): Deleted.
(JSC::CallFrame::setScope): Deleted.
(JSC::CallFrame::setCallee): Deleted.
(JSC::CallFrame::setCodeBlock): Deleted.

  • interpreter/CallFrameInlines.h:

(JSC::CallFrame::r):
(JSC::CallFrame::uncheckedR):
(JSC::CallFrame::guaranteedJSValueCallee const):
(JSC::CallFrame::jsCallee const):
(JSC::CallFrame::codeBlock const):
(JSC::CallFrame::unsafeCodeBlock const):
(JSC::CallFrame::lexicalGlobalObject const):
(JSC::CallFrame::setCallee):
(JSC::CallFrame::setCodeBlock):
(JSC::CallFrame::setScope):
(JSC::CallFrame::scope const):
(JSC::CallFrame::topOfFrame):

  • interpreter/Interpreter.cpp:
  • interpreter/ProtoCallFrame.h:

(JSC::ProtoCallFrame::init): Deleted.

  • interpreter/ProtoCallFrameInlines.h: Added.

(JSC::ProtoCallFrame::init):
(JSC::ProtoCallFrame::callee const):
(JSC::ProtoCallFrame::setCallee):
(JSC::ProtoCallFrame::codeBlock const):
(JSC::ProtoCallFrame::setCodeBlock):

  • interpreter/Register.h:

(JSC::Register::callFrame const): Deleted.
(JSC::Register::codeBlock const): Deleted.
(JSC::Register::asanUnsafeCodeBlock const): Deleted.

  • interpreter/RegisterInlines.h: Added.

(JSC::Register::callFrame const):
(JSC::Register::codeBlock const):
(JSC::Register::asanUnsafeCodeBlock const):
(JSC::Register::object const):
(JSC::Register::operator=):
(JSC::Register::scope const):

  • interpreter/StackVisitor.cpp:
  • jit/AssemblyHelpers.h:
  • llint/LLIntSlowPaths.cpp:
  • runtime/ArrayStorage.h:

(JSC::ArrayStorage::optimalVectorLength): Deleted.

  • runtime/ArrayStorageInlines.h: Added.

(JSC::ArrayStorage::availableVectorLength):
(JSC::ArrayStorage::optimalVectorLength):
(JSC::ArrayStorage::totalSize const):

  • runtime/ButterflyInlines.h:
  • runtime/ClassInfo.h:
  • runtime/GetVM.h: Added.
  • runtime/JSArray.h:
  • runtime/JSArrayInlines.h:
  • runtime/JSCellInlines.h:
  • runtime/JSGlobalObject.h:
  • runtime/JSObject.h:

(JSC::Register::object const): Deleted.
(JSC::Register::operator=): Deleted.

  • runtime/JSObjectInlines.h:
  • runtime/JSScope.h:

(JSC::Register::operator=): Deleted.
(JSC::Register::scope const): Deleted.
(JSC::CallFrame::lexicalGlobalObject const): Deleted.

  • runtime/JSString.h:
  • runtime/PropertyNameArray.h:
  • runtime/PropertySlot.h:
  • runtime/VMInlines.h:
  • tools/HeapVerifier.cpp:
  • wasm/js/WebAssemblyFunction.cpp:

Source/WebCore:

No new tests needed because there is no behavior change.

  • platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
Location:
trunk/Source
Files:
4 added
33 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/API/JSAPIGlobalObject.mm

    r251425 r251584  
    3030
    3131#import "APICast.h"
     32#import "CallFrameInlines.h"
    3233#import "CatchScope.h"
    3334#import "Completion.h"
  • trunk/Source/JavaScriptCore/CMakeLists.txt

    r251468 r251584  
    679679    interpreter/FrameTracers.h
    680680    interpreter/Register.h
     681    interpreter/RegisterInlines.h
    681682    interpreter/ShadowChicken.h
    682683    interpreter/StackVisitor.h
     
    753754    runtime/ArrayPrototype.h
    754755    runtime/ArrayStorage.h
     756    runtime/ArrayStorageInlines.h
    755757    runtime/AuxiliaryBarrier.h
    756758    runtime/AuxiliaryBarrierInlines.h
     
    822824    runtime/GenericTypedArrayViewInlines.h
    823825    runtime/GetPutInfo.h
     826    runtime/GetVM.h
    824827    runtime/GlobalExecutable.h
    825828    runtime/HashMapImpl.h
  • trunk/Source/JavaScriptCore/ChangeLog

    r251583 r251584  
     12019-10-24  Mark Lam  <mark.lam@apple.com>
     2
     3        Move JSC::Register inline methods into RegisterInlines.h.
     4        https://bugs.webkit.org/show_bug.cgi?id=203391
     5
     6        Reviewed by Yusuke Suzuki and Keith Miller.
     7
     8        We're doing this because:
     9        1. RegisterInlines.h is the canonical place to put inline Register methods.
     10        2. It helps reduce build time.
     11           e.g. build-jsc went from 208.02 to 196.81 seconds (about a 5% reduction).
     12        3. This enables experimental work to box JSCells in JSValue.
     13
     14        This patch also handles the fallout of this change, which necessitates more
     15        inline methods being moved from <file>.h to their respective <file>Inlines.h.
     16
     17        JSArray.h used to include ButterflyInlines.h and JSCellInlines.h.  This is a
     18        violation of inclusion ordering (.h should not #include Inlines.h).  This
     19        violation has been removed.
     20
     21        * API/JSAPIGlobalObject.mm:
     22        * CMakeLists.txt:
     23        * JavaScriptCore.xcodeproj/project.pbxproj:
     24        * bytecode/CodeBlock.h:
     25        (JSC::CallFrame::r): Deleted.
     26        (JSC::CallFrame::uncheckedR): Deleted.
     27        * bytecode/MetadataTable.cpp:
     28        * ftl/FTLLowerDFGToB3.cpp:
     29        * interpreter/CallFrame.h:
     30        (JSC::CallFrame::guaranteedJSValueCallee const): Deleted.
     31        (JSC::CallFrame::jsCallee const): Deleted.
     32        (JSC::CallFrame::codeBlock const): Deleted.
     33        (JSC::CallFrame::unsafeCodeBlock const): Deleted.
     34        (JSC::CallFrame::scope const): Deleted.
     35        (JSC::CallFrame::topOfFrame): Deleted.
     36        (JSC::CallFrame::setScope): Deleted.
     37        (JSC::CallFrame::setCallee): Deleted.
     38        (JSC::CallFrame::setCodeBlock): Deleted.
     39        * interpreter/CallFrameInlines.h:
     40        (JSC::CallFrame::r):
     41        (JSC::CallFrame::uncheckedR):
     42        (JSC::CallFrame::guaranteedJSValueCallee const):
     43        (JSC::CallFrame::jsCallee const):
     44        (JSC::CallFrame::codeBlock const):
     45        (JSC::CallFrame::unsafeCodeBlock const):
     46        (JSC::CallFrame::lexicalGlobalObject const):
     47        (JSC::CallFrame::setCallee):
     48        (JSC::CallFrame::setCodeBlock):
     49        (JSC::CallFrame::setScope):
     50        (JSC::CallFrame::scope const):
     51        (JSC::CallFrame::topOfFrame):
     52        * interpreter/Interpreter.cpp:
     53        * interpreter/ProtoCallFrame.h:
     54        (JSC::ProtoCallFrame::init): Deleted.
     55        * interpreter/ProtoCallFrameInlines.h: Added.
     56        (JSC::ProtoCallFrame::init):
     57        (JSC::ProtoCallFrame::callee const):
     58        (JSC::ProtoCallFrame::setCallee):
     59        (JSC::ProtoCallFrame::codeBlock const):
     60        (JSC::ProtoCallFrame::setCodeBlock):
     61        * interpreter/Register.h:
     62        (JSC::Register::callFrame const): Deleted.
     63        (JSC::Register::codeBlock const): Deleted.
     64        (JSC::Register::asanUnsafeCodeBlock const): Deleted.
     65        * interpreter/RegisterInlines.h: Added.
     66        (JSC::Register::callFrame const):
     67        (JSC::Register::codeBlock const):
     68        (JSC::Register::asanUnsafeCodeBlock const):
     69        (JSC::Register::object const):
     70        (JSC::Register::operator=):
     71        (JSC::Register::scope const):
     72        * interpreter/StackVisitor.cpp:
     73        * jit/AssemblyHelpers.h:
     74        * llint/LLIntSlowPaths.cpp:
     75        * runtime/ArrayStorage.h:
     76        (JSC::ArrayStorage::optimalVectorLength): Deleted.
     77        * runtime/ArrayStorageInlines.h: Added.
     78        (JSC::ArrayStorage::availableVectorLength):
     79        (JSC::ArrayStorage::optimalVectorLength):
     80        (JSC::ArrayStorage::totalSize const):
     81        * runtime/ButterflyInlines.h:
     82        * runtime/ClassInfo.h:
     83        * runtime/GetVM.h: Added.
     84        * runtime/JSArray.h:
     85        * runtime/JSArrayInlines.h:
     86        * runtime/JSCellInlines.h:
     87        * runtime/JSGlobalObject.h:
     88        * runtime/JSObject.h:
     89        (JSC::Register::object const): Deleted.
     90        (JSC::Register::operator=): Deleted.
     91        * runtime/JSObjectInlines.h:
     92        * runtime/JSScope.h:
     93        (JSC::Register::operator=): Deleted.
     94        (JSC::Register::scope const): Deleted.
     95        (JSC::CallFrame::lexicalGlobalObject const): Deleted.
     96        * runtime/JSString.h:
     97        * runtime/PropertyNameArray.h:
     98        * runtime/PropertySlot.h:
     99        * runtime/VMInlines.h:
     100        * tools/HeapVerifier.cpp:
     101        * wasm/js/WebAssemblyFunction.cpp:
     102
    11032019-10-24  Zan Dobersek  <zdobersek@igalia.com>
    2104
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r251468 r251584  
    18661866                FE1BD0251E72053800134BC9 /* HeapVerifier.h in Headers */ = {isa = PBXBuildFile; fileRef = FE1BD0231E72052F00134BC9 /* HeapVerifier.h */; };
    18671867                FE1C0FFD1B193E9800B53FCA /* Exception.h in Headers */ = {isa = PBXBuildFile; fileRef = FE1C0FFC1B193E9800B53FCA /* Exception.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1868                FE1D6D6D2362544B007A5C26 /* RegisterInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = FE1D6D6C2362544A007A5C26 /* RegisterInlines.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1869                FE1D6D6F236258FE007A5C26 /* GetVM.h in Headers */ = {isa = PBXBuildFile; fileRef = FE1D6D6E236258FE007A5C26 /* GetVM.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1870                FE1D6D7123625AB1007A5C26 /* ArrayStorageInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = FE1D6D7023625AB0007A5C26 /* ArrayStorageInlines.h */; settings = {ATTRIBUTES = (Private, ); }; };
     1871                FE1D6D752362649F007A5C26 /* ProtoCallFrameInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = FE1D6D742362649D007A5C26 /* ProtoCallFrameInlines.h */; };
    18681872                FE1E2C3F2240DD5800F6B729 /* MacroAssemblerARM64E.h in Headers */ = {isa = PBXBuildFile; fileRef = FE1E2C3E2240D30B00F6B729 /* MacroAssemblerARM64E.h */; settings = {ATTRIBUTES = (Private, ); }; };
    18691873                FE1E2C402240DD6200F6B729 /* ARM64EAssembler.h in Headers */ = {isa = PBXBuildFile; fileRef = FE1E2C3D2240D2F600F6B729 /* ARM64EAssembler.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    50505054                FE1C0FFC1B193E9800B53FCA /* Exception.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Exception.h; sourceTree = "<group>"; };
    50515055                FE1C0FFE1B194FD100B53FCA /* Exception.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Exception.cpp; sourceTree = "<group>"; };
     5056                FE1D6D6C2362544A007A5C26 /* RegisterInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RegisterInlines.h; sourceTree = "<group>"; };
     5057                FE1D6D6E236258FE007A5C26 /* GetVM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GetVM.h; sourceTree = "<group>"; };
     5058                FE1D6D7023625AB0007A5C26 /* ArrayStorageInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArrayStorageInlines.h; sourceTree = "<group>"; };
     5059                FE1D6D742362649D007A5C26 /* ProtoCallFrameInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProtoCallFrameInlines.h; sourceTree = "<group>"; };
    50525060                FE1E2C3C2240C1EF00F6B729 /* JSCPtrTag.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCPtrTag.cpp; sourceTree = "<group>"; };
    50535061                FE1E2C3D2240D2F600F6B729 /* ARM64EAssembler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARM64EAssembler.h; sourceTree = "<group>"; };
     
    59285936                                E39D9D841D39000600667282 /* InterpreterInlines.h */,
    59295937                                65FB5115184EE8F800C12B70 /* ProtoCallFrame.h */,
     5938                                FE1D6D742362649D007A5C26 /* ProtoCallFrameInlines.h */,
    59305939                                149B24FF0D8AF6D1009CB8C7 /* Register.h */,
     5940                                FE1D6D6C2362544A007A5C26 /* RegisterInlines.h */,
    59315941                                DC17E8131C9C7FD4008A6AB3 /* ShadowChicken.cpp */,
    59325942                                DC17E8141C9C7FD4008A6AB3 /* ShadowChicken.h */,
     
    69026912                                F692A84E0255597D01FF60F7 /* ArrayPrototype.h */,
    69036913                                0FB7F38A15ED8E3800F167B2 /* ArrayStorage.h */,
     6914                                FE1D6D7023625AB0007A5C26 /* ArrayStorageInlines.h */,
    69046915                                8B6016F31F3E3CC000F9DE6A /* AsyncFromSyncIteratorPrototype.cpp */,
    69056916                                8B6016F41F3E3CC000F9DE6A /* AsyncFromSyncIteratorPrototype.h */,
     
    70787089                                14788EE521501B2900A561C8 /* GetPutInfo.cpp */,
    70797090                                796465681B952FF0003059EE /* GetPutInfo.h */,
     7091                                FE1D6D6E236258FE007A5C26 /* GetVM.h */,
    70807092                                BC02E9B80E184545000F9297 /* GetterSetter.cpp */,
    70817093                                BC337BDE0E1AF0B80076918A /* GetterSetter.h */,
     
    88728884                                DCFDFBD91D1F5D9B00FE3D72 /* B3BottomProvider.h in Headers */,
    88738885                                0F6B8AE31C4EFE1700969052 /* B3BreakCriticalEdges.h in Headers */,
     8886                                FE1D6D752362649F007A5C26 /* ProtoCallFrameInlines.h in Headers */,
    88748887                                DC9A0C201D2D9CB30085124E /* B3CaseCollection.h in Headers */,
    88758888                                DC9A0C1F1D2D9CB10085124E /* B3CaseCollectionInlines.h in Headers */,
     
    89158928                                4319DA041C1BE40D001D260B /* B3LowerMacrosAfterOptimizations.h in Headers */,
    89168929                                0FEC851E1BDACDAC0080FF74 /* B3LowerToAir.h in Headers */,
     8930                                FE1D6D6D2362544B007A5C26 /* RegisterInlines.h in Headers */,
    89178931                                43AB26C61C1A535900D82AE6 /* B3MathExtras.h in Headers */,
    89188932                                0FEC85201BDACDAC0080FF74 /* B3MemoryValue.h in Headers */,
     
    94799493                                C2DA778318E259990066FCB6 /* HeapInlines.h in Headers */,
    94809494                                2AD8932B17E3868F00668276 /* HeapIterationScope.h in Headers */,
     9495                                FE1D6D7123625AB1007A5C26 /* ArrayStorageInlines.h in Headers */,
    94819496                                A5339EC91BB4B4600054F005 /* HeapObserver.h in Headers */,
    94829497                                A5398FAB1C750DA40060A963 /* HeapProfiler.h in Headers */,
     
    999610011                                BC18C45D0E16F5CD00B34460 /* Register.h in Headers */,
    999710012                                E328C6C91DA432F900D255FD /* RegisterAtOffset.h in Headers */,
     10013                                FE1D6D6F236258FE007A5C26 /* GetVM.h in Headers */,
    999810014                                E328C6C81DA4306100D255FD /* RegisterAtOffsetList.h in Headers */,
    999910015                                969A072B0ED1CE6900F1F681 /* RegisterID.h in Headers */,
     
    1104111057                                5C4196622270E0000047B7CD /* InspectorBackendDispatcherCompatibility.cpp in Sources */,
    1104211058                                536B319E1F735F160037FC33 /* LowLevelInterpreter.cpp in Sources */,
    11043                                 FE1D6D4523580E1F007A5C26 /* Options.cpp in Sources */,
    1104411059                                0FF4274A158EBE91004CB9FF /* udis86.c in Sources */,
    1104511060                                0FF42740158EBE8B004CB9FF /* udis86_decode.c in Sources */,
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.h

    r251468 r251584  
    10331033};
    10341034
    1035 inline Register& CallFrame::r(int index)
    1036 {
    1037     CodeBlock* codeBlock = this->codeBlock();
    1038     if (codeBlock->isConstantRegisterIndex(index))
    1039         return *reinterpret_cast<Register*>(&codeBlock->constantRegister(index));
    1040     return this[index];
    1041 }
    1042 
    1043 inline Register& CallFrame::r(VirtualRegister reg)
    1044 {
    1045     return r(reg.offset());
    1046 }
    1047 
    1048 inline Register& CallFrame::uncheckedR(int index)
    1049 {
    1050     RELEASE_ASSERT(index < FirstConstantRegisterIndex);
    1051     return this[index];
    1052 }
    1053 
    1054 inline Register& CallFrame::uncheckedR(VirtualRegister reg)
    1055 {
    1056     return uncheckedR(reg.offset());
    1057 }
    1058 
    10591035template <typename ExecutableType>
    10601036Exception* ScriptExecutable::prepareForExecution(VM& vm, JSFunction* function, JSScope* scope, CodeSpecializationKind kind, CodeBlock*& resultCodeBlock)
  • trunk/Source/JavaScriptCore/bytecode/MetadataTable.cpp

    r245669 r251584  
    11/*
    2  * Copyright (C) 2018 Apple Inc. All rights reserved.
     2 * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2727#include "MetadataTable.h"
    2828
    29 #include "CodeBlock.h"
    3029#include "JSCInlines.h"
    3130#include "OpcodeInlines.h"
  • trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp

    r251518 r251584  
    4040#include "B3StackmapGenerationParams.h"
    4141#include "B3ValueInlines.h"
     42#include "ButterflyInlines.h"
    4243#include "CallFrameShuffler.h"
    4344#include "CodeBlockWithJITType.h"
  • trunk/Source/JavaScriptCore/interpreter/CallFrame.h

    r251529 r251584  
    22 *  Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
    33 *  Copyright (C) 2001 Peter Kelly (pmk@post.com)
    4  *  Copyright (C) 2003-2018 Apple Inc. All rights reserved.
     4 *  Copyright (C) 2003-2019 Apple Inc. All rights reserved.
    55 *
    66 *  This library is free software; you can redistribute it and/or
     
    105105        // to be a cell, however, there is a brief window where we need to check
    106106        // to see if it's a cell, and if it's not, we throw an exception.
    107         JSValue guaranteedJSValueCallee() const
    108         {
    109             ASSERT(!callee().isWasm());
    110             return this[CallFrameSlot::callee].jsValue();
    111         }
    112         JSObject* jsCallee() const
    113         {
    114             ASSERT(!callee().isWasm());
    115             return this[CallFrameSlot::callee].object();
    116         }
     107        inline JSValue guaranteedJSValueCallee() const;
     108        inline JSObject* jsCallee() const;
    117109        CalleeBits callee() const { return CalleeBits(this[CallFrameSlot::callee].pointer()); }
    118110        SUPPRESS_ASAN CalleeBits unsafeCallee() const { return CalleeBits(this[CallFrameSlot::callee].asanUnsafePointer()); }
    119         CodeBlock* codeBlock() const { return this[CallFrameSlot::codeBlock].Register::codeBlock(); }
     111        CodeBlock* codeBlock() const;
    120112        CodeBlock** addressOfCodeBlock() const { return bitwise_cast<CodeBlock**>(this + CallFrameSlot::codeBlock); }
    121         SUPPRESS_ASAN CodeBlock* unsafeCodeBlock() const { return this[CallFrameSlot::codeBlock].Register::asanUnsafeCodeBlock(); }
    122         JSScope* scope(int scopeRegisterOffset) const
    123         {
    124             ASSERT(this[scopeRegisterOffset].Register::scope());
    125             return this[scopeRegisterOffset].Register::scope();
    126         }
     113        inline SUPPRESS_ASAN CodeBlock* unsafeCodeBlock() const;
     114        inline JSScope* scope(int scopeRegisterOffset) const;
    127115
    128116        JS_EXPORT_PRIVATE bool isAnyWasmCallee();
     
    184172        JS_EXPORT_PRIVATE CodeOrigin codeOrigin();
    185173
    186         Register* topOfFrame()
    187         {
    188             if (!codeBlock())
    189                 return registers();
    190             return topOfFrameInternal();
    191         }
     174        inline Register* topOfFrame();
    192175   
    193176        const Instruction* currentVPC() const; // This only makes sense in the LLInt and baseline.
     
    195178
    196179        void setCallerFrame(CallFrame* frame) { callerFrameAndPC().callerFrame = frame; }
    197         void setScope(int scopeRegisterOffset, JSScope* scope) { static_cast<Register*>(this)[scopeRegisterOffset] = scope; }
     180        inline void setScope(int scopeRegisterOffset, JSScope*);
    198181
    199182        static void initDeprecatedCallFrameForDebugger(CallFrame* globalExec, JSCallee* globalCallee);
     
    270253
    271254        void setArgumentCountIncludingThis(int count) { static_cast<Register*>(this)[CallFrameSlot::argumentCount].payload() = count; }
    272         void setCallee(JSObject* callee) { static_cast<Register*>(this)[CallFrameSlot::callee] = callee; }
    273         void setCodeBlock(CodeBlock* codeBlock) { static_cast<Register*>(this)[CallFrameSlot::codeBlock] = codeBlock; }
     255        inline void setCallee(JSObject*);
     256        inline void setCodeBlock(CodeBlock*);
    274257        void setReturnPC(void* value) { callerFrameAndPC().returnPC = reinterpret_cast<const Instruction*>(value); }
    275258
     
    324307    };
    325308
    326 // Helper function to get VM& from JSGlobalObject* if JSGlobalObject.h is not included.
    327 VM& getVM(JSGlobalObject*);
    328309JS_EXPORT_PRIVATE bool isFromJSCode(void* returnAddress);
    329310
  • trunk/Source/JavaScriptCore/interpreter/CallFrameInlines.h

    r243925 r251584  
    11/*
    2  * Copyright (C) 2018 Apple Inc. All rights reserved.
     2 * Copyright (C) 2018-2019 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2929#include "JSCallee.h"
    3030#include "JSGlobalObject.h"
     31#include "RegisterInlines.h"
    3132
    3233namespace JSC {
     34
     35inline Register& CallFrame::r(int index)
     36{
     37    CodeBlock* codeBlock = this->codeBlock();
     38    if (codeBlock->isConstantRegisterIndex(index))
     39        return *reinterpret_cast<Register*>(&codeBlock->constantRegister(index));
     40    return this[index];
     41}
     42
     43inline Register& CallFrame::r(VirtualRegister reg)
     44{
     45    return r(reg.offset());
     46}
     47
     48inline Register& CallFrame::uncheckedR(int index)
     49{
     50    RELEASE_ASSERT(index < FirstConstantRegisterIndex);
     51    return this[index];
     52}
     53
     54inline Register& CallFrame::uncheckedR(VirtualRegister reg)
     55{
     56    return uncheckedR(reg.offset());
     57}
     58
     59inline JSValue CallFrame::guaranteedJSValueCallee() const
     60{
     61    ASSERT(!callee().isWasm());
     62    return this[CallFrameSlot::callee].jsValue();
     63}
     64
     65inline JSObject* CallFrame::jsCallee() const
     66{
     67    ASSERT(!callee().isWasm());
     68    return this[CallFrameSlot::callee].object();
     69}
     70
     71inline CodeBlock* CallFrame::codeBlock() const
     72{
     73    return this[CallFrameSlot::codeBlock].Register::codeBlock();
     74}
     75
     76inline SUPPRESS_ASAN CodeBlock* CallFrame::unsafeCodeBlock() const
     77{
     78    return this[CallFrameSlot::codeBlock].Register::asanUnsafeCodeBlock();
     79}
     80
     81inline JSGlobalObject* CallFrame::lexicalGlobalObject(VM& vm) const
     82{
     83    UNUSED_PARAM(vm);
     84#if ENABLE(WEBASSEMBLY)
     85    if (callee().isWasm())
     86        return lexicalGlobalObjectFromWasmCallee(vm);
     87#endif
     88    return jsCallee()->globalObject();
     89}
    3390
    3491inline bool CallFrame::isStackOverflowFrame() const
     
    44101}
    45102
     103inline void CallFrame::setCallee(JSObject* callee)
     104{
     105    static_cast<Register*>(this)[CallFrameSlot::callee] = callee;
     106}
     107
     108inline void CallFrame::setCodeBlock(CodeBlock* codeBlock)
     109{
     110    static_cast<Register*>(this)[CallFrameSlot::codeBlock] = codeBlock;
     111}
     112
     113inline void CallFrame::setScope(int scopeRegisterOffset, JSScope* scope)
     114{
     115    static_cast<Register*>(this)[scopeRegisterOffset] = scope;
     116}
     117
     118inline JSScope* CallFrame::scope(int scopeRegisterOffset) const
     119{
     120    ASSERT(this[scopeRegisterOffset].Register::scope());
     121    return this[scopeRegisterOffset].Register::scope();
     122}
     123
     124inline Register* CallFrame::topOfFrame()
     125{
     126    if (!codeBlock())
     127        return registers();
     128    return topOfFrameInternal();
     129}
     130
    46131} // namespace JSC
  • trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp

    r251529 r251584  
    6767#include "Parser.h"
    6868#include "ProgramCodeBlock.h"
    69 #include "ProtoCallFrame.h"
     69#include "ProtoCallFrameInlines.h"
    7070#include "RegExpObject.h"
    7171#include "Register.h"
  • trunk/Source/JavaScriptCore/interpreter/ProtoCallFrame.h

    r250803 r251584  
    11/*
    2  * Copyright (C) 2013-2018 Apple Inc. All Rights Reserved.
     2 * Copyright (C) 2013-2019 Apple Inc. All Rights Reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4848    JSGlobalObject* globalObject;
    4949
    50     void init(CodeBlock*, JSGlobalObject*, JSObject*, JSValue, int, JSValue* otherArgs = 0);
     50    inline void init(CodeBlock*, JSGlobalObject*, JSObject*, JSValue, int, JSValue* otherArgs = 0);
    5151
    52     CodeBlock* codeBlock() const { return codeBlockValue.Register::codeBlock(); }
    53     void setCodeBlock(CodeBlock* codeBlock) { codeBlockValue = codeBlock; }
     52    inline CodeBlock* codeBlock() const;
     53    inline void setCodeBlock(CodeBlock*);
    5454
    55     JSObject* callee() const { return calleeValue.Register::object(); }
    56     void setCallee(JSObject* callee)
    57     {
    58         calleeValue = callee;
    59     }
     55    inline JSObject* callee() const;
     56    inline void setCallee(JSObject*);
    6057    void setGlobalObject(JSGlobalObject* object)
    6158    {
     
    8784};
    8885
    89 inline void ProtoCallFrame::init(CodeBlock* codeBlock, JSGlobalObject* globalObject, JSObject* callee, JSValue thisValue, int argCountIncludingThis, JSValue* otherArgs)
    90 {
    91     this->args = otherArgs;
    92     this->setCodeBlock(codeBlock);
    93     this->setCallee(callee);
    94     this->setGlobalObject(globalObject);
    95     this->setArgumentCountIncludingThis(argCountIncludingThis);
    96     if (codeBlock && argCountIncludingThis < codeBlock->numParameters())
    97         this->hasArityMismatch = true;
    98     else
    99         this->hasArityMismatch = false;
    100 
    101     // Round up argCountIncludingThis to keep the stack frame size aligned.
    102     size_t paddedArgsCount = roundArgumentCountToAlignFrame(argCountIncludingThis);
    103     this->setPaddedArgCount(paddedArgsCount);
    104     this->clearCurrentVPC();
    105     this->setThisValue(thisValue);
    106 }
    107 
    10886} // namespace JSC
  • trunk/Source/JavaScriptCore/interpreter/Register.h

    r251425 r251584  
    11/*
    2  * Copyright (C) 2008-2018 Apple Inc. All rights reserved.
     2 * Copyright (C) 2008-2019 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    5252        EncodedJSValue encodedJSValue() const;
    5353       
    54         Register& operator=(CallFrame*);
    55         Register& operator=(CodeBlock*);
    56         Register& operator=(JSScope*);
    57         Register& operator=(JSObject*);
     54        ALWAYS_INLINE Register& operator=(CallFrame*);
     55        ALWAYS_INLINE Register& operator=(CodeBlock*);
     56        ALWAYS_INLINE Register& operator=(JSScope*);
     57        ALWAYS_INLINE Register& operator=(JSObject*);
    5858
    5959        int32_t i() const;
    60         CallFrame* callFrame() const;
    61         CodeBlock* codeBlock() const;
    62         CodeBlock* asanUnsafeCodeBlock() const;
    63         JSObject* object() const;
    64         JSScope* scope() const;
     60        ALWAYS_INLINE CallFrame* callFrame() const;
     61        ALWAYS_INLINE CodeBlock* codeBlock() const;
     62        ALWAYS_INLINE CodeBlock* asanUnsafeCodeBlock() const;
     63        ALWAYS_INLINE JSObject* object() const;
     64        ALWAYS_INLINE JSScope* scope() const;
    6565        int32_t unboxedInt32() const;
    6666        int32_t asanUnsafeUnboxedInt32() const;
     
    137137    // Interpreter functions
    138138
    139     ALWAYS_INLINE Register& Register::operator=(CallFrame* callFrame)
    140     {
    141         u.callFrame = callFrame;
    142         return *this;
    143     }
    144 
    145     ALWAYS_INLINE Register& Register::operator=(CodeBlock* codeBlock)
    146     {
    147         u.codeBlock = codeBlock;
    148         return *this;
    149     }
    150 
    151139    ALWAYS_INLINE int32_t Register::i() const
    152140    {
     
    154142    }
    155143
    156     ALWAYS_INLINE CallFrame* Register::callFrame() const
    157     {
    158         return u.callFrame;
    159     }
    160    
    161     ALWAYS_INLINE CodeBlock* Register::codeBlock() const
    162     {
    163         return u.codeBlock;
    164     }
    165 
    166     SUPPRESS_ASAN ALWAYS_INLINE CodeBlock* Register::asanUnsafeCodeBlock() const
    167     {
    168         return u.codeBlock;
    169     }
    170 
    171144    ALWAYS_INLINE int32_t Register::unboxedInt32() const
    172145    {
  • trunk/Source/JavaScriptCore/interpreter/StackVisitor.cpp

    r251529 r251584  
    2727#include "StackVisitor.h"
    2828
    29 #include "CallFrameInlines.h"
    3029#include "ClonedArguments.h"
    3130#include "DebuggerPrimitives.h"
  • trunk/Source/JavaScriptCore/jit/AssemblyHelpers.h

    r251518 r251584  
    3636#include "JITAllocator.h"
    3737#include "JITCode.h"
     38#include "JSCellInlines.h"
    3839#include "MacroAssembler.h"
    3940#include "MarkedSpace.h"
  • trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp

    r251534 r251584  
    6565#include "OpcodeInlines.h"
    6666#include "ProgramCodeBlock.h"
    67 #include "ProtoCallFrame.h"
     67#include "ProtoCallFrameInlines.h"
    6868#include "RegExpObject.h"
    6969#include "ShadowChicken.h"
  • trunk/Source/JavaScriptCore/runtime/ArrayStorage.h

    r225913 r251584  
    11/*
    2  * Copyright (C) 2012, 2016 Apple Inc. All rights reserved.
     2 * Copyright (C) 2012-2019 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    104104    }
    105105
    106     size_t totalSize(Structure* structure) const
    107     {
    108         return totalSize(structure->outOfLineCapacity());
    109     }
     106    inline size_t totalSize(Structure*) const;
    110107
    111108    static unsigned availableVectorLength(unsigned indexBias, size_t propertyCapacity, unsigned vectorLength)
     
    118115    }
    119116
    120     static unsigned availableVectorLength(unsigned indexBias, Structure* structure, unsigned vectorLength)
    121     {
    122         return availableVectorLength(indexBias, structure->outOfLineCapacity(), vectorLength);
    123     }
     117    inline static unsigned availableVectorLength(unsigned indexBias, Structure*, unsigned vectorLength);
    124118
    125     unsigned availableVectorLength(size_t propertyCapacity, unsigned vectorLength)
    126     {
    127         return availableVectorLength(m_indexBias, propertyCapacity, vectorLength);
    128     }
     119    inline unsigned availableVectorLength(size_t propertyCapacity, unsigned vectorLength);
    129120
    130     unsigned availableVectorLength(Structure* structure, unsigned vectorLength)
    131     {
    132         return availableVectorLength(structure->outOfLineCapacity(), vectorLength);
    133     }
     121    inline unsigned availableVectorLength(Structure*, unsigned vectorLength);
    134122
    135     static unsigned optimalVectorLength(unsigned indexBias, size_t propertyCapacity, unsigned vectorLength)
    136     {
    137         vectorLength = std::max(BASE_ARRAY_STORAGE_VECTOR_LEN, vectorLength);
    138         return availableVectorLength(indexBias, propertyCapacity, vectorLength);
    139     }
     123    inline static unsigned optimalVectorLength(unsigned indexBias, size_t propertyCapacity, unsigned vectorLength);
    140124
    141     static unsigned optimalVectorLength(unsigned indexBias, Structure* structure, unsigned vectorLength)
    142     {
    143         return optimalVectorLength(indexBias, structure->outOfLineCapacity(), vectorLength);
    144     }
     125    inline static unsigned optimalVectorLength(unsigned indexBias, Structure*, unsigned vectorLength);
    145126
    146     unsigned optimalVectorLength(size_t propertyCapacity, unsigned vectorLength)
    147     {
    148         return optimalVectorLength(m_indexBias, propertyCapacity, vectorLength);
    149     }
     127    inline unsigned optimalVectorLength(size_t propertyCapacity, unsigned vectorLength);
    150128
    151     unsigned optimalVectorLength(Structure* structure, unsigned vectorLength)
    152     {
    153         return optimalVectorLength(structure->outOfLineCapacity(), vectorLength);
    154     }
     129    inline unsigned optimalVectorLength(Structure*, unsigned vectorLength);
    155130
    156131    WriteBarrier<SparseArrayValueMap> m_sparseMap;
  • trunk/Source/JavaScriptCore/runtime/ButterflyInlines.h

    r243688 r251584  
    11/*
    2  * Copyright (C) 2012-2018 Apple Inc. All rights reserved.
     2 * Copyright (C) 2012-2019 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2626#pragma once
    2727
    28 #include "ArrayStorage.h"
     28#include "ArrayStorageInlines.h"
    2929#include "Butterfly.h"
    3030#include "JSObject.h"
  • trunk/Source/JavaScriptCore/runtime/ClassInfo.h

    r251425 r251584  
    2323#pragma once
    2424
    25 #include "CallFrame.h"
    2625#include "ConstructData.h"
    2726#include "JSCast.h"
  • trunk/Source/JavaScriptCore/runtime/JSArray.h

    r251425 r251584  
    2323#include "ArgList.h"
    2424#include "ArrayConventions.h"
    25 #include "ButterflyInlines.h"
    26 #include "JSCellInlines.h"
     25#include "Butterfly.h"
     26#include "JSCell.h"
    2727#include "JSObject.h"
    2828
  • trunk/Source/JavaScriptCore/runtime/JSArrayInlines.h

    r251425 r251584  
    11/*
    2  *  Copyright (C) 2016 Apple Inc. All rights reserved.
     2 *  Copyright (C) 2016-2019 Apple Inc. All rights reserved.
    33 *
    44 *  This library is free software; you can redistribute it and/or
     
    2121
    2222#include "ArrayPrototype.h"
     23#include "ButterflyInlines.h"
    2324#include "Error.h"
    2425#include "JSArray.h"
  • trunk/Source/JavaScriptCore/runtime/JSCellInlines.h

    r251457 r251584  
    3030#include "CompleteSubspaceInlines.h"
    3131#include "CPU.h"
    32 #include "CallFrame.h"
     32#include "CallFrameInlines.h"
    3333#include "DeferGC.h"
    3434#include "FreeListInlines.h"
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h

    r251556 r251584  
    2828#include "ErrorType.h"
    2929#include "ExceptionHelpers.h"
     30#include "GetVM.h"
    3031#include "InternalFunction.h"
    3132#include "JSArray.h"
  • trunk/Source/JavaScriptCore/runtime/JSObject.h

    r251425 r251584  
    14981498}
    14991499
    1500 ALWAYS_INLINE JSObject* Register::object() const
    1501 {
    1502     return asObject(jsValue());
    1503 }
    1504 
    1505 ALWAYS_INLINE Register& Register::operator=(JSObject* object)
    1506 {
    1507     u.value = JSValue::encode(JSValue(object));
    1508     return *this;
    1509 }
    1510 
    15111500inline size_t offsetInButterfly(PropertyOffset offset)
    15121501{
  • trunk/Source/JavaScriptCore/runtime/JSObjectInlines.h

    r251425 r251584  
    22 *  Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
    33 *  Copyright (C) 2001 Peter Kelly (pmk@post.com)
    4  *  Copyright (C) 2003-2017 Apple Inc. All rights reserved.
     4 *  Copyright (C) 2003-2019 Apple Inc. All rights reserved.
    55 *  Copyright (C) 2007 Eric Seidel (eric@webkit.org)
    66 *
     
    2525
    2626#include "AuxiliaryBarrierInlines.h"
     27#include "ButterflyInlines.h"
    2728#include "Error.h"
    2829#include "JSObject.h"
  • trunk/Source/JavaScriptCore/runtime/JSScope.h

    r251529 r251584  
    130130}
    131131
    132 inline Register& Register::operator=(JSScope* scope)
    133 {
    134     *this = JSValue(scope);
    135     return *this;
    136 }
    137 
    138 inline JSScope* Register::scope() const
    139 {
    140     return jsCast<JSScope*>(unboxedCell());
    141 }
    142 
    143 inline JSGlobalObject* CallFrame::lexicalGlobalObject(VM& vm) const
    144 {
    145     UNUSED_PARAM(vm);
    146 #if ENABLE(WEBASSEMBLY)
    147     if (callee().isWasm())
    148         return lexicalGlobalObjectFromWasmCallee(vm);
    149 #endif
    150     return jsCallee()->globalObject();
    151 }
    152 
    153132inline size_t JSScope::offsetOfNext()
    154133{
  • trunk/Source/JavaScriptCore/runtime/JSString.h

    r251425 r251584  
    2626#include "CallFrame.h"
    2727#include "CommonIdentifiers.h"
     28#include "GetVM.h"
    2829#include "Identifier.h"
    2930#include "PropertyDescriptor.h"
  • trunk/Source/JavaScriptCore/runtime/PropertyNameArray.h

    r250005 r251584  
    2121#pragma once
    2222
    23 #include "CallFrame.h"
    2423#include "Identifier.h"
    2524#include <wtf/HashSet.h>
  • trunk/Source/JavaScriptCore/runtime/PropertySlot.h

    r251425 r251584  
    2121#pragma once
    2222
    23 #include "CallFrame.h"
    2423#include "DOMAnnotation.h"
     24#include "GetVM.h"
    2525#include "JSCJSValue.h"
    2626#include "PropertyName.h"
  • trunk/Source/JavaScriptCore/runtime/VMInlines.h

    r236381 r251584  
    11/*
    2  * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015-2019 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2626#pragma once
    2727
    28 #include "CallFrameInlines.h"
    2928#include "EntryFrame.h"
    3029#include "ProfilerDatabase.h"
  • trunk/Source/JavaScriptCore/tools/HeapVerifier.cpp

    r250005 r251584  
    2727#include "HeapVerifier.h"
    2828
     29#include "ButterflyInlines.h"
    2930#include "CodeBlockInlines.h"
    3031#include "HeapIterationScope.h"
  • trunk/Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp

    r251425 r251584  
    4141#include "LLIntThunks.h"
    4242#include "LinkBuffer.h"
    43 #include "ProtoCallFrame.h"
     43#include "ProtoCallFrameInlines.h"
    4444#include "VM.h"
    4545#include "WasmCallee.h"
  • trunk/Source/WebCore/ChangeLog

    r251582 r251584  
     12019-10-24  Mark Lam  <mark.lam@apple.com>
     2
     3        Move JSC::Register inline methods into RegisterInlines.h.
     4        https://bugs.webkit.org/show_bug.cgi?id=203391
     5
     6        Reviewed by Yusuke Suzuki and Keith Miller.
     7
     8        No new tests needed because there is no behavior change.
     9
     10        * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm:
     11
    1122019-10-24  Alex Christensen  <achristensen@webkit.org>
    213
  • trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm

    r251425 r251584  
    11/*
    2  * Copyright (C) 2015 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015-2019 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3737#import <AVFoundation/AVError.h>
    3838#import <CoreMedia/CMBase.h>
     39#import <JavaScriptCore/HeapInlines.h>
     40#import <JavaScriptCore/JSCellInlines.h>
    3941#import <JavaScriptCore/JSGlobalObjectInlines.h>
    4042#import <JavaScriptCore/TypedArrayInlines.h>
Note: See TracChangeset for help on using the changeset viewer.