Changeset 220047 in webkit


Ignore:
Timestamp:
Jul 29, 2017 8:01:12 PM (7 years ago)
Author:
keith_miller@apple.com
Message:

LLInt offsets extractor should be able to handle C++ constexprs
https://bugs.webkit.org/show_bug.cgi?id=174964

Reviewed by Saam Barati.

This patch adds new syntax to the offline asm language. The new keyword,
constexpr, takes the subsequent identifier and maps it to a C++ constexpr
expression. Additionally, if the value is not an identifier you can wrap it in
parentheses. e.g. constexpr (myConstexprFunction() + OBJECT_OFFSET(Foo, bar)),
which will get converted into:
static_cast<int64_t>(myConstexprFunction() + OBJECT_OFFSET(Foo, bar));

This patch also changes the data format the LLIntOffsetsExtractor
binary produces. Previously, it would produce unsigned values,
after this patch every value is an int64_t. Using an int64_t is
useful because it means that we can represent any constant needed.
int32_t masks are sign extended then passed then converted to a
negative literal sting in the assembler so it will be the constant
expected.

  • llint/LLIntOffsetsExtractor.cpp:

(JSC::LLIntOffsetsExtractor::dummy):

  • llint/LowLevelInterpreter.asm:
  • llint/LowLevelInterpreter64.asm:
  • offlineasm/asm.rb:
  • offlineasm/ast.rb:
  • offlineasm/generate_offset_extractor.rb:
  • offlineasm/offsets.rb:
  • offlineasm/parser.rb:
  • offlineasm/transform.rb:
Location:
trunk/Source/JavaScriptCore
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r220036 r220047  
     12017-07-29  Keith Miller  <keith_miller@apple.com>
     2
     3        LLInt offsets extractor should be able to handle C++ constexprs
     4        https://bugs.webkit.org/show_bug.cgi?id=174964
     5
     6        Reviewed by Saam Barati.
     7
     8        This patch adds new syntax to the offline asm language. The new keyword,
     9        constexpr, takes the subsequent identifier and maps it to a C++ constexpr
     10        expression. Additionally, if the value is not an identifier you can wrap it in
     11        parentheses. e.g. constexpr (myConstexprFunction() + OBJECT_OFFSET(Foo, bar)),
     12        which will get converted into:
     13        static_cast<int64_t>(myConstexprFunction() + OBJECT_OFFSET(Foo, bar));
     14
     15        This patch also changes the data format the LLIntOffsetsExtractor
     16        binary produces.  Previously, it would produce unsigned values,
     17        after this patch every value is an int64_t.  Using an int64_t is
     18        useful because it means that we can represent any constant needed.
     19        int32_t masks are sign extended then passed then converted to a
     20        negative literal sting in the assembler so it will be the constant
     21        expected.
     22
     23        * llint/LLIntOffsetsExtractor.cpp:
     24        (JSC::LLIntOffsetsExtractor::dummy):
     25        * llint/LowLevelInterpreter.asm:
     26        * llint/LowLevelInterpreter64.asm:
     27        * offlineasm/asm.rb:
     28        * offlineasm/ast.rb:
     29        * offlineasm/generate_offset_extractor.rb:
     30        * offlineasm/offsets.rb:
     31        * offlineasm/parser.rb:
     32        * offlineasm/transform.rb:
     33
    1342017-07-28  Matt Baker  <mattbaker@apple.com>
    235
  • trunk/Source/JavaScriptCore/llint/LLIntOffsetsExtractor.cpp

    r208712 r220047  
    6868class LLIntOffsetsExtractor {
    6969public:
    70     static const unsigned* dummy();
     70    static const int64_t* dummy();
    7171};
    7272
    73 const unsigned* LLIntOffsetsExtractor::dummy()
     73const int64_t* LLIntOffsetsExtractor::dummy()
    7474{
    7575// This is a file generated by offlineasm/generate_offsets_extractor.rb, and contains code
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm

    r218883 r220047  
    154154# These declarations must match interpreter/JSStack.h.
    155155
     156const PtrSize = constexpr (sizeof(void*))
     157
    156158if JSVALUE64
    157     const PtrSize = 8
    158159    const CallFrameHeaderSlots = 5
    159160else
    160     const PtrSize = 4
    161161    const CallFrameHeaderSlots = 4
    162162    const CallFrameAlignSlots = 1
     
    206206
    207207# NOTE: The values below must be in sync with what is in PutByIdFlags.h.
    208 const PutByIdPrimaryTypeMask = 0x6
    209 const PutByIdPrimaryTypeSecondary = 0x0
    210 const PutByIdPrimaryTypeObjectWithStructure = 0x2
    211 const PutByIdPrimaryTypeObjectWithStructureOrOther = 0x4
    212 const PutByIdSecondaryTypeMask = -0x8
    213 const PutByIdSecondaryTypeBottom = 0x0
    214 const PutByIdSecondaryTypeBoolean = 0x8
    215 const PutByIdSecondaryTypeOther = 0x10
    216 const PutByIdSecondaryTypeInt32 = 0x18
    217 const PutByIdSecondaryTypeNumber = 0x20
    218 const PutByIdSecondaryTypeString = 0x28
    219 const PutByIdSecondaryTypeSymbol = 0x30
    220 const PutByIdSecondaryTypeObject = 0x38
    221 const PutByIdSecondaryTypeObjectOrOther = 0x40
    222 const PutByIdSecondaryTypeTop = 0x48
     208const PutByIdPrimaryTypeMask = constexpr PutByIdPrimaryTypeMask
     209const PutByIdPrimaryTypeSecondary = constexpr PutByIdPrimaryTypeSecondary
     210const PutByIdPrimaryTypeObjectWithStructure = constexpr PutByIdPrimaryTypeObjectWithStructure
     211const PutByIdPrimaryTypeObjectWithStructureOrOther = constexpr PutByIdPrimaryTypeObjectWithStructureOrOther
     212const PutByIdSecondaryTypeMask = constexpr PutByIdSecondaryTypeMask
     213const PutByIdSecondaryTypeBottom = constexpr PutByIdSecondaryTypeBottom
     214const PutByIdSecondaryTypeBoolean = constexpr PutByIdSecondaryTypeBoolean
     215const PutByIdSecondaryTypeOther = constexpr PutByIdSecondaryTypeOther
     216const PutByIdSecondaryTypeInt32 = constexpr PutByIdSecondaryTypeInt32
     217const PutByIdSecondaryTypeNumber = constexpr PutByIdSecondaryTypeNumber
     218const PutByIdSecondaryTypeString = constexpr PutByIdSecondaryTypeString
     219const PutByIdSecondaryTypeSymbol = constexpr PutByIdSecondaryTypeSymbol
     220const PutByIdSecondaryTypeObject = constexpr PutByIdSecondaryTypeObject
     221const PutByIdSecondaryTypeObjectOrOther = constexpr PutByIdSecondaryTypeObjectOrOther
     222const PutByIdSecondaryTypeTop = constexpr PutByIdSecondaryTypeTop
    223223
    224224const CallOpCodeSize = 9
     
    246246
    247247# Watchpoint states
    248 const ClearWatchpoint = 0
    249 const IsWatched = 1
    250 const IsInvalidated = 2
     248const ClearWatchpoint = constexpr ClearWatchpoint
     249const IsWatched = constexpr IsWatched
     250const IsInvalidated = constexpr IsInvalidated
    251251
    252252# ShadowChicken data
     
    334334
    335335# Constant for reasoning about butterflies.
    336 const IsArray                  = 0x01
    337 const IndexingShapeMask        = 0x0E
    338 const NoIndexingShape          = 0x00
    339 const Int32Shape               = 0x04
    340 const DoubleShape              = 0x06
    341 const ContiguousShape          = 0x08
    342 const ArrayStorageShape        = 0x0A
    343 const SlowPutArrayStorageShape = 0x0C
     336const IsArray                  = constexpr IsArray
     337const IndexingShapeMask        = constexpr IndexingShapeMask
     338const NoIndexingShape          = constexpr NoIndexingShape
     339const Int32Shape               = constexpr Int32Shape
     340const DoubleShape              = constexpr DoubleShape
     341const ContiguousShape          = constexpr ContiguousShape
     342const ArrayStorageShape        = constexpr ArrayStorageShape
     343const SlowPutArrayStorageShape = constexpr SlowPutArrayStorageShape
    344344
    345345# Type constants.
    346 const StringType = 6
    347 const SymbolType = 7
    348 const ObjectType = 23
    349 const FinalObjectType = 24
    350 const JSFunctionType = 26
    351 const ArrayType = 34
    352 const DerivedArrayType = 35
    353 const ProxyObjectType = 53
     346const StringType = constexpr StringType
     347const SymbolType = constexpr SymbolType
     348const ObjectType = constexpr ObjectType
     349const FinalObjectType = constexpr FinalObjectType
     350const JSFunctionType = constexpr JSFunctionType
     351const ArrayType = constexpr ArrayType
     352const DerivedArrayType = constexpr DerivedArrayType
     353const ProxyObjectType = constexpr ProxyObjectType
    354354
    355355# The typed array types need to be numbered in a particular order because of the manually written
    356356# switch statement in get_by_val and put_by_val.
    357 const Int8ArrayType = 36
    358 const Int16ArrayType = 37
    359 const Int32ArrayType = 38
    360 const Uint8ArrayType = 39
    361 const Uint8ClampedArrayType = 40
    362 const Uint16ArrayType = 41
    363 const Uint32ArrayType = 42
    364 const Float32ArrayType = 43
    365 const Float64ArrayType = 44
     357const Int8ArrayType = constexpr Int8ArrayType
     358const Int16ArrayType = constexpr Int16ArrayType
     359const Int32ArrayType = constexpr Int32ArrayType
     360const Uint8ArrayType = constexpr Uint8ArrayType
     361const Uint8ClampedArrayType = constexpr Uint8ClampedArrayType
     362const Uint16ArrayType = constexpr Uint16ArrayType
     363const Uint32ArrayType = constexpr Uint32ArrayType
     364const Float32ArrayType = constexpr Float32ArrayType
     365const Float64ArrayType = constexpr Float64ArrayType
    366366
    367367const FirstArrayType = Int8ArrayType
     
    369369
    370370# Type flags constants.
    371 const MasqueradesAsUndefined = 1
    372 const ImplementsDefaultHasInstance = 2
     371const MasqueradesAsUndefined = constexpr MasqueradesAsUndefined
     372const ImplementsDefaultHasInstance = constexpr ImplementsDefaultHasInstance
    373373
    374374# Bytecode operand constants.
    375 const FirstConstantRegisterIndex = 0x40000000
     375const FirstConstantRegisterIndex = constexpr FirstConstantRegisterIndex
    376376
    377377# Code type constants.
    378 const GlobalCode = 0
    379 const EvalCode = 1
    380 const FunctionCode = 2
    381 const ModuleCode = 3
     378const GlobalCode = constexpr GlobalCode
     379const EvalCode = constexpr EvalCode
     380const FunctionCode = constexpr FunctionCode
     381const ModuleCode = constexpr ModuleCode
    382382
    383383# The interpreter steals the tag word of the argument count.
     
    391391
    392392# ResolveType
    393 const GlobalProperty = 0
    394 const GlobalVar = 1
    395 const GlobalLexicalVar = 2
    396 const ClosureVar = 3
    397 const LocalClosureVar = 4
    398 const ModuleVar = 5
    399 const GlobalPropertyWithVarInjectionChecks = 6
    400 const GlobalVarWithVarInjectionChecks = 7
    401 const GlobalLexicalVarWithVarInjectionChecks = 8
    402 const ClosureVarWithVarInjectionChecks = 9
     393const GlobalProperty = constexpr GlobalProperty
     394const GlobalVar = constexpr GlobalVar
     395const GlobalLexicalVar = constexpr GlobalLexicalVar
     396const ClosureVar = constexpr ClosureVar
     397const LocalClosureVar = constexpr LocalClosureVar
     398const ModuleVar = constexpr ModuleVar
     399const GlobalPropertyWithVarInjectionChecks = constexpr GlobalPropertyWithVarInjectionChecks
     400const GlobalVarWithVarInjectionChecks = constexpr GlobalVarWithVarInjectionChecks
     401const GlobalLexicalVarWithVarInjectionChecks = constexpr GlobalLexicalVarWithVarInjectionChecks
     402const ClosureVarWithVarInjectionChecks = constexpr ClosureVarWithVarInjectionChecks
    403403
    404404const ResolveTypeMask = 0x3ff
     
    12571257    traceExecution()
    12581258    callOpcodeSlowPath(_slow_path_create_direct_arguments)
    1259     dispatch(2)
     1259    dispatch(constexpr op_create_direct_arguments_length)
    12601260
    12611261
     
    12631263    traceExecution()
    12641264    callOpcodeSlowPath(_slow_path_create_scoped_arguments)
    1265     dispatch(3)
     1265    dispatch(constexpr op_create_scoped_arguments_length)
    12661266
    12671267
     
    12691269    traceExecution()
    12701270    callOpcodeSlowPath(_slow_path_create_cloned_arguments)
    1271     dispatch(2)
     1271    dispatch(constexpr op_create_cloned_arguments_length)
    12721272
    12731273
     
    12751275    traceExecution()
    12761276    callOpcodeSlowPath(_slow_path_create_this)
    1277     dispatch(5)
     1277    dispatch(constexpr op_create_this_length)
    12781278
    12791279
     
    12811281    traceExecution()
    12821282    callOpcodeSlowPath(_llint_slow_path_new_object)
    1283     dispatch(4)
     1283    dispatch(constexpr op_new_object_length)
    12841284
    12851285
     
    12871287    traceExecution()
    12881288    callOpcodeSlowPath(_llint_slow_path_new_func)
    1289     dispatch(4)
     1289    dispatch(constexpr op_new_func_length)
    12901290
    12911291
     
    12931293    traceExecution()
    12941294    callOpcodeSlowPath(_llint_slow_path_new_generator_func)
    1295     dispatch(4)
     1295    dispatch(constexpr op_new_generator_func_length)
    12961296
    12971297
     
    12991299    traceExecution()
    13001300    callSlowPath(_llint_slow_path_new_async_func)
    1301     dispatch(4)
     1301    dispatch(constexpr op_new_async_func_length)
    13021302
    13031303
     
    13051305    traceExecution()
    13061306    callOpcodeSlowPath(_llint_slow_path_new_array)
    1307     dispatch(5)
     1307    dispatch(constexpr op_new_array_length)
    13081308
    13091309
     
    13111311    traceExecution()
    13121312    callOpcodeSlowPath(_slow_path_new_array_with_spread)
    1313     dispatch(5)
     1313    dispatch(constexpr op_new_array_with_spread_length)
    13141314
    13151315
     
    13171317    traceExecution()
    13181318    callOpcodeSlowPath(_slow_path_spread)
    1319     dispatch(3)
     1319    dispatch(constexpr op_spread_length)
    13201320
    13211321
     
    13231323    traceExecution()
    13241324    callOpcodeSlowPath(_llint_slow_path_new_array_with_size)
    1325     dispatch(4)
     1325    dispatch(constexpr op_new_array_with_size_length)
    13261326
    13271327
     
    13291329    traceExecution()
    13301330    callOpcodeSlowPath(_llint_slow_path_new_array_buffer)
    1331     dispatch(5)
     1331    dispatch(constexpr op_new_array_buffer_length)
    13321332
    13331333
     
    13351335    traceExecution()
    13361336    callOpcodeSlowPath(_llint_slow_path_new_regexp)
    1337     dispatch(3)
     1337    dispatch(constexpr op_new_regexp_length)
    13381338
    13391339
     
    13411341    traceExecution()
    13421342    callOpcodeSlowPath(_slow_path_less)
    1343     dispatch(4)
     1343    dispatch(constexpr op_less_length)
    13441344
    13451345
     
    13471347    traceExecution()
    13481348    callOpcodeSlowPath(_slow_path_lesseq)
    1349     dispatch(4)
     1349    dispatch(constexpr op_lesseq_length)
    13501350
    13511351
     
    13531353    traceExecution()
    13541354    callOpcodeSlowPath(_slow_path_greater)
    1355     dispatch(4)
     1355    dispatch(constexpr op_greater_length)
    13561356
    13571357
     
    13591359    traceExecution()
    13601360    callOpcodeSlowPath(_slow_path_greatereq)
    1361     dispatch(4)
     1361    dispatch(constexpr op_greatereq_length)
    13621362
    13631363
     
    13651365    traceExecution()
    13661366    callOpcodeSlowPath(_slow_path_mod)
    1367     dispatch(4)
     1367    dispatch(constexpr op_mod_length)
    13681368
    13691369
     
    13711371    traceExecution()
    13721372    callOpcodeSlowPath(_slow_path_pow)
    1373     dispatch(4)
     1373    dispatch(constexpr op_pow_length)
    13741374
    13751375
     
    13771377    traceExecution()
    13781378    callOpcodeSlowPath(_slow_path_typeof)
    1379     dispatch(3)
     1379    dispatch(constexpr op_typeof_length)
    13801380
    13811381
     
    13831383    traceExecution()
    13841384    callOpcodeSlowPath(_slow_path_is_object_or_null)
    1385     dispatch(3)
     1385    dispatch(constexpr op_is_object_or_null_length)
    13861386
    13871387_llint_op_is_function:
    13881388    traceExecution()
    13891389    callOpcodeSlowPath(_slow_path_is_function)
    1390     dispatch(3)
     1390    dispatch(constexpr op_is_function_length)
    13911391
    13921392
     
    13941394    traceExecution()
    13951395    callOpcodeSlowPath(_slow_path_in)
    1396     dispatch(5)
     1396    dispatch(constexpr op_in_length)
    13971397
    13981398
     
    14001400    traceExecution()
    14011401    callOpcodeSlowPath(_llint_slow_path_try_get_by_id)
    1402     dispatch(5)
     1402    dispatch(constexpr op_try_get_by_id_length)
    14031403
    14041404
     
    14061406    traceExecution()
    14071407    callOpcodeSlowPath(_llint_slow_path_del_by_id)
    1408     dispatch(4)
     1408    dispatch(constexpr op_del_by_id_length)
    14091409
    14101410
     
    14121412    traceExecution()
    14131413    callOpcodeSlowPath(_llint_slow_path_del_by_val)
    1414     dispatch(4)
     1414    dispatch(constexpr op_del_by_val_length)
    14151415
    14161416
     
    14181418    traceExecution()
    14191419    callOpcodeSlowPath(_llint_slow_path_put_by_index)
    1420     dispatch(4)
     1420    dispatch(constexpr op_put_by_index_length)
    14211421
    14221422
     
    14241424    traceExecution()
    14251425    callOpcodeSlowPath(_llint_slow_path_put_getter_by_id)
    1426     dispatch(5)
     1426    dispatch(constexpr op_put_getter_by_id_length)
    14271427
    14281428
     
    14301430    traceExecution()
    14311431    callOpcodeSlowPath(_llint_slow_path_put_setter_by_id)
    1432     dispatch(5)
     1432    dispatch(constexpr op_put_setter_by_id_length)
    14331433
    14341434
     
    14361436    traceExecution()
    14371437    callOpcodeSlowPath(_llint_slow_path_put_getter_setter_by_id)
    1438     dispatch(6)
     1438    dispatch(constexpr op_put_getter_setter_by_id_length)
    14391439
    14401440
     
    14421442    traceExecution()
    14431443    callOpcodeSlowPath(_llint_slow_path_put_getter_by_val)
    1444     dispatch(5)
     1444    dispatch(constexpr op_put_getter_by_val_length)
    14451445
    14461446
     
    14481448    traceExecution()
    14491449    callOpcodeSlowPath(_llint_slow_path_put_setter_by_val)
    1450     dispatch(5)
     1450    dispatch(constexpr op_put_setter_by_val_length)
    14511451
    14521452
     
    14541454    traceExecution()
    14551455    callOpcodeSlowPath(_slow_path_define_data_property)
    1456     dispatch(5)
     1456    dispatch(constexpr op_define_data_property_length)
    14571457
    14581458
     
    14601460    traceExecution()
    14611461    callOpcodeSlowPath(_slow_path_define_accessor_property)
    1462     dispatch(6)
     1462    dispatch(constexpr op_define_accessor_property_length)
    14631463
    14641464
     
    15441544    traceExecution()
    15451545    checkSwitchToJITForLoop()
    1546     dispatch(1)
     1546    dispatch(constexpr op_loop_hint_length)
    15471547
    15481548
     
    15541554    btpnz t0, .handleTraps
    15551555.afterHandlingTraps:
    1556     dispatch(1)
     1556    dispatch(constexpr op_check_traps_length)
    15571557.handleTraps:
    15581558    callTrapHandler(.throwHandler)
     
    15751575
    15761576_llint_op_nop:
    1577     dispatch(1)
     1577    dispatch(constexpr op_nop_length)
    15781578
    15791579
     
    15871587    traceExecution()
    15881588    callOpcodeSlowPath(_llint_slow_path_new_func_exp)
    1589     dispatch(4)
     1589    dispatch(constexpr op_new_func_exp_length)
    15901590
    15911591_llint_op_new_generator_func_exp:
    15921592    traceExecution()
    15931593    callOpcodeSlowPath(_llint_slow_path_new_generator_func_exp)
    1594     dispatch(4)
     1594    dispatch(constexpr op_new_generator_func_exp_length)
    15951595
    15961596_llint_op_new_async_func_exp:
    15971597    traceExecution()
    15981598    callSlowPath(_llint_slow_path_new_async_func_exp)
    1599     dispatch(4)
     1599    dispatch(constexpr op_new_async_func_exp_length)
    16001600
    16011601
     
    16031603    traceExecution()
    16041604    callOpcodeSlowPath(_llint_slow_path_set_function_name)
    1605     dispatch(3)
     1605    dispatch(constexpr op_set_function_name_length)
    16061606
    16071607_llint_op_call:
     
    17091709    traceExecution()
    17101710    callOpcodeSlowPath(_slow_path_strcat)
    1711     dispatch(4)
     1711    dispatch(constexpr op_strcat_length)
    17121712
    17131713
     
    17151715    traceExecution()
    17161716    callOpcodeSlowPath(_slow_path_push_with_scope)
    1717     dispatch(4)
     1717    dispatch(constexpr op_push_with_scope_length)
    17181718
    17191719
     
    17211721    traceExecution()
    17221722    callOpcodeSlowPath(_slow_path_assert)
    1723     dispatch(3)
     1723    dispatch(constexpr op_assert_length)
    17241724
    17251725
     
    17271727    traceExecution()
    17281728    callOpcodeSlowPath(_slow_path_unreachable)
    1729     dispatch(1)
     1729    dispatch(constexpr op_unreachable_length)
    17301730
    17311731
     
    17371737    traceExecution()
    17381738    callOpcodeSlowPath(_slow_path_create_lexical_environment)
    1739     dispatch(5)
     1739    dispatch(constexpr op_create_lexical_environment_length)
    17401740
    17411741
     
    17431743    traceExecution()
    17441744    callOpcodeSlowPath(_llint_slow_path_throw)
    1745     dispatch(2)
     1745    dispatch(constexpr op_throw_length)
    17461746
    17471747
     
    17491749    traceExecution()
    17501750    callOpcodeSlowPath(_slow_path_throw_static_error)
    1751     dispatch(3)
     1751    dispatch(constexpr op_throw_static_error_length)
    17521752
    17531753
     
    17591759    callOpcodeSlowPath(_llint_slow_path_debug)
    17601760.opDebugDone:                   
    1761     dispatch(3)
     1761    dispatch(constexpr op_debug_length)
    17621762
    17631763
     
    17721772    traceExecution()
    17731773    callOpcodeSlowPath(_slow_path_get_enumerable_length)
    1774     dispatch(3)
     1774    dispatch(constexpr op_get_enumerable_length_length)
    17751775
    17761776_llint_op_has_indexed_property:
    17771777    traceExecution()
    17781778    callOpcodeSlowPath(_slow_path_has_indexed_property)
    1779     dispatch(5)
     1779    dispatch(constexpr op_has_indexed_property_length)
    17801780
    17811781_llint_op_has_structure_property:
    17821782    traceExecution()
    17831783    callOpcodeSlowPath(_slow_path_has_structure_property)
    1784     dispatch(5)
     1784    dispatch(constexpr op_has_structure_property_length)
    17851785
    17861786_llint_op_has_generic_property:
    17871787    traceExecution()
    17881788    callOpcodeSlowPath(_slow_path_has_generic_property)
    1789     dispatch(4)
     1789    dispatch(constexpr op_has_generic_property_length)
    17901790
    17911791_llint_op_get_direct_pname:
    17921792    traceExecution()
    17931793    callOpcodeSlowPath(_slow_path_get_direct_pname)
    1794     dispatch(7)
     1794    dispatch(constexpr op_get_direct_pname_length)
    17951795
    17961796_llint_op_get_property_enumerator:
    17971797    traceExecution()
    17981798    callOpcodeSlowPath(_slow_path_get_property_enumerator)
    1799     dispatch(3)
     1799    dispatch(constexpr op_get_property_enumerator_length)
    18001800
    18011801_llint_op_enumerator_structure_pname:
    18021802    traceExecution()
    18031803    callOpcodeSlowPath(_slow_path_next_structure_enumerator_pname)
    1804     dispatch(4)
     1804    dispatch(constexpr op_enumerator_structure_pname_length)
    18051805
    18061806_llint_op_enumerator_generic_pname:
    18071807    traceExecution()
    18081808    callOpcodeSlowPath(_slow_path_next_generic_enumerator_pname)
    1809     dispatch(4)
     1809    dispatch(constexpr op_enumerator_generic_pname_length)
    18101810
    18111811_llint_op_to_index_string:
    18121812    traceExecution()
    18131813    callOpcodeSlowPath(_slow_path_to_index_string)
    1814     dispatch(3)
     1814    dispatch(constexpr op_to_index_string_length)
    18151815
    18161816_llint_op_create_rest:
    18171817    traceExecution()
    18181818    callOpcodeSlowPath(_slow_path_create_rest)
    1819     dispatch(4)
     1819    dispatch(constexpr op_create_rest_length)
    18201820
    18211821_llint_op_instanceof:
    18221822    traceExecution()
    18231823    callOpcodeSlowPath(_llint_slow_path_instanceof)
    1824     dispatch(4)
     1824    dispatch(constexpr op_instanceof_length)
    18251825
    18261826_llint_op_get_by_id_with_this:
    18271827    traceExecution()
    18281828    callOpcodeSlowPath(_slow_path_get_by_id_with_this)
    1829     dispatch(6)
     1829    dispatch(constexpr op_get_by_id_with_this_length)
    18301830
    18311831_llint_op_get_by_val_with_this:
    18321832    traceExecution()
    18331833    callOpcodeSlowPath(_slow_path_get_by_val_with_this)
    1834     dispatch(6)
     1834    dispatch(constexpr op_get_by_val_with_this_length)
    18351835
    18361836_llint_op_put_by_id_with_this:
    18371837    traceExecution()
    18381838    callOpcodeSlowPath(_slow_path_put_by_id_with_this)
    1839     dispatch(5)
     1839    dispatch(constexpr op_put_by_id_with_this_length)
    18401840
    18411841_llint_op_put_by_val_with_this:
    18421842    traceExecution()
    18431843    callOpcodeSlowPath(_slow_path_put_by_val_with_this)
    1844     dispatch(5)
     1844    dispatch(constexpr op_put_by_val_with_this_length)
    18451845
    18461846_llint_op_resolve_scope_for_hoisting_func_decl_in_eval:
    18471847    traceExecution()
    18481848    callOpcodeSlowPath(_slow_path_resolve_scope_for_hoisting_func_decl_in_eval)
    1849     dispatch(4)
     1849    dispatch(constexpr op_resolve_scope_for_hoisting_func_decl_in_eval_length)
    18501850
    18511851# Lastly, make sure that we can link even though we don't support all opcodes.
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm

    r218883 r220047  
    673673.opEnterDone:
    674674    callOpcodeSlowPath(_slow_path_enter)
    675     dispatch(1)
     675    dispatch(constexpr op_enter_length)
    676676
    677677
     
    687687    storei t3, PayloadOffset[cfr, t1, 8]
    688688    valueProfile(t0, t3, 12, t1)
    689     dispatch(4)
     689    dispatch(constexpr op_get_argument_length)
    690690
    691691.opGetArgumentOutOfBounds:
     
    693693    storei 0, PayloadOffset[cfr, t1, 8]
    694694    valueProfile(UndefinedTag, 0, 12, t1)
    695     dispatch(4)
     695    dispatch(constexpr op_get_argument_length)
    696696
    697697
     
    704704    storei t1, TagOffset[cfr, t2, 8]
    705705    storei t0, PayloadOffset[cfr, t2, 8]
    706     dispatch(2)
     706    dispatch(constexpr op_argument_count_length)
    707707
    708708
     
    714714    storei CellTag, TagOffset[cfr, t1, 8]
    715715    storei t0, PayloadOffset[cfr, t1, 8]
    716     dispatch(2)
     716    dispatch(constexpr op_get_scope_length)
    717717
    718718
     
    725725    loadpFromInstruction(2, t2)
    726726    bpneq JSCell::m_structureID[t0], t2, .opToThisSlow
    727     dispatch(4)
     727    dispatch(constexpr op_to_this_length)
    728728
    729729.opToThisSlow:
    730730    callOpcodeSlowPath(_slow_path_to_this)
    731     dispatch(4)
     731    dispatch(constexpr op_to_this_length)
    732732
    733733
     
    740740
    741741.opNotTDZ:
    742     dispatch(2)
     742    dispatch(constexpr op_check_tdz_length)
    743743
    744744
     
    750750    storei t2, TagOffset[cfr, t0, 8]
    751751    storei t3, PayloadOffset[cfr, t0, 8]
    752     dispatch(3)
     752    dispatch(constexpr op_mov_length)
    753753
    754754
     
    762762    storei t2, TagOffset[cfr, t1, 8]
    763763    storei t3, PayloadOffset[cfr, t1, 8]
    764     dispatch(3)
     764    dispatch(constexpr op_not_length)
    765765
    766766.opNotSlow:
    767767    callOpcodeSlowPath(_slow_path_not)
    768     dispatch(3)
     768    dispatch(constexpr op_not_length)
    769769
    770770
     
    782782    storei BooleanTag, TagOffset[cfr, t2, 8]
    783783    storei t0, PayloadOffset[cfr, t2, 8]
    784     dispatch(4)
     784    dispatch(constexpr op_eq_length)
    785785
    786786.opEqSlow:
    787787    callOpcodeSlowPath(_slow_path_eq)
    788     dispatch(4)
     788    dispatch(constexpr op_eq_length)
    789789
    790790
     
    813813    storei BooleanTag, TagOffset[cfr, t3, 8]
    814814    storei t1, PayloadOffset[cfr, t3, 8]
    815     dispatch(3)
     815    dispatch(constexpr op_eq_null_length)
    816816
    817817
     
    829829    storei BooleanTag, TagOffset[cfr, t2, 8]
    830830    storei t0, PayloadOffset[cfr, t2, 8]
    831     dispatch(4)
     831    dispatch(constexpr op_neq_length)
    832832
    833833.opNeqSlow:
    834834    callOpcodeSlowPath(_slow_path_neq)
    835     dispatch(4)
     835    dispatch(constexpr op_neq_length)
    836836   
    837837
     
    860860    storei BooleanTag, TagOffset[cfr, t3, 8]
    861861    storei t1, PayloadOffset[cfr, t3, 8]
    862     dispatch(3)
     862    dispatch(constexpr op_neq_null_length)
    863863
    864864
     
    902902    baddio 1, t1, .opIncSlow
    903903    storei t1, PayloadOffset[cfr, t0, 8]
    904     dispatch(2)
     904    dispatch(constexpr op_inc_length)
    905905
    906906.opIncSlow:
    907907    callOpcodeSlowPath(_slow_path_inc)
    908     dispatch(2)
     908    dispatch(constexpr op_inc_length)
    909909
    910910
     
    916916    bsubio 1, t1, .opDecSlow
    917917    storei t1, PayloadOffset[cfr, t0, 8]
    918     dispatch(2)
     918    dispatch(constexpr op_dec_length)
    919919
    920920.opDecSlow:
    921921    callOpcodeSlowPath(_slow_path_dec)
    922     dispatch(2)
     922    dispatch(constexpr op_dec_length)
    923923
    924924
     
    934934    storei t3, PayloadOffset[cfr, t1, 8]
    935935    valueProfile(t2, t3, 12, t1)
    936     dispatch(4)
     936    dispatch(constexpr op_to_number_length)
    937937
    938938.opToNumberSlow:
    939939    callOpcodeSlowPath(_slow_path_to_number)
    940     dispatch(4)
     940    dispatch(constexpr op_to_number_length)
    941941
    942942
     
    951951    storei t2, TagOffset[cfr, t1, 8]
    952952    storei t3, PayloadOffset[cfr, t1, 8]
    953     dispatch(3)
     953    dispatch(constexpr op_to_string_length)
    954954
    955955.opToStringSlow:
    956956    callOpcodeSlowPath(_slow_path_to_string)
    957     dispatch(3)
     957    dispatch(constexpr op_to_string_length)
    958958
    959959
     
    971971    storeisToInstruction(t0, 3)
    972972    storei t2, PayloadOffset[cfr, t3, 8]
    973     dispatch(4)
     973    dispatch(constexpr op_negate_length)
    974974.opNegateSrcNotInt:
    975975    bia t1, LowestTag, .opNegateSlow
     
    979979    storeisToInstruction(t0, 3)
    980980    storei t1, TagOffset[cfr, t3, 8]
    981     dispatch(4)
     981    dispatch(constexpr op_negate_length)
    982982
    983983.opNegateSlow:
    984984    callOpcodeSlowPath(_slow_path_negate)
    985     dispatch(4)
     985    dispatch(constexpr op_negate_length)
    986986
    987987
     
    11261126        macro (left, right) lshifti left, right end,
    11271127        _slow_path_lshift,
    1128         4)
     1128        constexpr op_lshift_length)
    11291129
    11301130
     
    11341134        macro (left, right) rshifti left, right end,
    11351135        _slow_path_rshift,
    1136         4)
     1136        constexpr op_rshift_length)
    11371137
    11381138
     
    11421142        macro (left, right) urshifti left, right end,
    11431143        _slow_path_urshift,
    1144         4)
     1144        constexpr op_urshift_length)
    11451145
    11461146
     
    11531153    storei t2, PayloadOffset[cfr, t0, 8]
    11541154    storei Int32Tag, TagOffset[cfr, t0, 8]
    1155     dispatch(3)
     1155    dispatch(constexpr op_unsigned_length)
    11561156.opUnsignedSlow:
    11571157    callOpcodeSlowPath(_slow_path_unsigned)
    1158     dispatch(3)
     1158    dispatch(constexpr op_unsigned_length)
    11591159
    11601160
     
    11641164        macro (left, right) andi left, right end,
    11651165        _slow_path_bitand,
    1166         5)
     1166        constexpr op_bitand_length)
    11671167
    11681168
     
    11721172        macro (left, right) xori left, right end,
    11731173        _slow_path_bitxor,
    1174         5)
     1174        constexpr op_bitxor_length)
    11751175
    11761176
     
    11801180        macro (left, right) ori left, right end,
    11811181        _slow_path_bitor,
    1182         5)
     1182        constexpr op_bitor_length)
    11831183
    11841184
     
    12061206    tbz JSCell::m_flags[t1], ImplementsDefaultHasInstance, t0
    12071207    storei t0, PayloadOffset[cfr, t3, 8]
    1208     dispatch(4)
     1208    dispatch(constexpr op_overrides_has_instance_length)
    12091209
    12101210.opOverrideshasInstanceValueNotCell:
    12111211.opOverrideshasInstanceValueNotDefault:
    12121212    storei 1, PayloadOffset[cfr, t3, 8]
    1213     dispatch(4)
     1213    dispatch(constexpr op_overrides_has_instance_length)
    12141214
    12151215_llint_op_instanceof_custom:
    12161216    traceExecution()
    12171217    callOpcodeSlowPath(_llint_slow_path_instanceof_custom)
    1218     dispatch(5)
     1218    dispatch(constexpr op_instanceof_custom_length)
    12191219
    12201220
     
    12271227    storei BooleanTag, TagOffset[cfr, t0, 8]
    12281228    storei t3, PayloadOffset[cfr, t0, 8]
    1229     dispatch(3)
     1229    dispatch(constexpr op_is_empty_length)
    12301230
    12311231
     
    12391239    cieq t2, UndefinedTag, t3
    12401240    storei t3, PayloadOffset[cfr, t0, 8]
    1241     dispatch(3)
     1241    dispatch(constexpr op_is_undefined_length)
    12421242.opIsUndefinedCell:
    12431243    btbnz JSCell::m_flags[t3], MasqueradesAsUndefined, .opIsUndefinedMasqueradesAsUndefined
    12441244    move 0, t1
    12451245    storei t1, PayloadOffset[cfr, t0, 8]
    1246     dispatch(3)
     1246    dispatch(constexpr op_is_undefined_length)
    12471247.opIsUndefinedMasqueradesAsUndefined:
    12481248    loadp JSCell::m_structureID[t3], t1
     
    12511251    cpeq Structure::m_globalObject[t1], t3, t1
    12521252    storei t1, PayloadOffset[cfr, t0, 8]
    1253     dispatch(3)
     1253    dispatch(constexpr op_is_undefined_length)
    12541254
    12551255
     
    12621262    storei BooleanTag, TagOffset[cfr, t2, 8]
    12631263    storei t0, PayloadOffset[cfr, t2, 8]
    1264     dispatch(3)
     1264    dispatch(constexpr op_is_boolean_length)
    12651265
    12661266
     
    12741274    cib t0, LowestTag + 1, t1
    12751275    storei t1, PayloadOffset[cfr, t2, 8]
    1276     dispatch(3)
     1276    dispatch(constexpr op_is_number_length)
    12771277
    12781278
     
    12871287    cbeq JSCell::m_type[t3], t0, t1
    12881288    storei t1, PayloadOffset[cfr, t2, 8]
    1289     dispatch(4)
     1289    dispatch(constexpr op_is_cell_with_type_length)
    12901290.notCellCase:
    12911291    storep 0, PayloadOffset[cfr, t2, 8]
    1292     dispatch(4)
     1292    dispatch(constexpr op_is_cell_with_type_length)
    12931293
    12941294
     
    13021302    cbaeq JSCell::m_type[t3], ObjectType, t1
    13031303    storei t1, PayloadOffset[cfr, t2, 8]
    1304     dispatch(3)
     1304    dispatch(constexpr op_is_object_length)
    13051305.opIsObjectNotCell:
    13061306    storep 0, PayloadOffset[cfr, t2, 8]
    1307     dispatch(3)
     1307    dispatch(constexpr op_is_object_length)
    13081308
    13091309
     
    13611361    storei t1, PayloadOffset[cfr, t2, 8]
    13621362    valueProfile(t0, t1, 32, t2)
    1363     dispatch(9)
     1363    dispatch(constexpr op_get_by_id_length)
    13641364
    13651365.opGetByIdSlow:
    13661366    callOpcodeSlowPath(_llint_slow_path_get_by_id)
    1367     dispatch(9)
     1367    dispatch(constexpr op_get_by_id_length)
    13681368
    13691369
     
    13811381    storei t1, PayloadOffset[cfr, t2, 8]
    13821382    valueProfile(t0, t1, 32, t2)
    1383     dispatch(9)
     1383    dispatch(constexpr op_get_by_id_proto_load_length)
    13841384
    13851385.opGetByIdProtoSlow:
    13861386    callOpcodeSlowPath(_llint_slow_path_get_by_id)
    1387     dispatch(9)
     1387    dispatch(constexpr op_get_by_id_proto_load_length)
    13881388
    13891389
     
    13981398    storei 0, PayloadOffset[cfr, t2, 8]
    13991399    valueProfile(UndefinedTag, 0, 32, t2)
    1400     dispatch(9)
     1400    dispatch(constexpr op_get_by_id_unset_length)
    14011401
    14021402.opGetByIdUnsetSlow:
    14031403    callOpcodeSlowPath(_llint_slow_path_get_by_id)
    1404     dispatch(9)
     1404    dispatch(constexpr op_get_by_id_unset_length)
    14051405
    14061406
     
    14211421    storep t0, PayloadOffset[cfr, t1, 8]
    14221422    storep Int32Tag, TagOffset[cfr, t1, 8]
    1423     dispatch(9)
     1423    dispatch(constexpr op_get_array_length_length)
    14241424
    14251425.opGetArrayLengthSlow:
    14261426    callOpcodeSlowPath(_llint_slow_path_get_by_id)
    1427     dispatch(9)
     1427    dispatch(constexpr op_get_array_length_length)
    14281428
    14291429
     
    15501550    storePropertyAtVariableOffset(t1, t0, t2, t3)
    15511551    writeBarrierOnOperand(1)
    1552     dispatch(9)
     1552    dispatch(constexpr op_put_by_id_length)
    15531553
    15541554.opPutByIdNotTransition:
     
    15581558    loadi 20[PC], t1
    15591559    storePropertyAtVariableOffset(t1, t0, t2, t3)
    1560     dispatch(9)
     1560    dispatch(constexpr op_put_by_id_length)
    15611561
    15621562.opPutByIdSlow:
    15631563    callOpcodeSlowPath(_llint_slow_path_put_by_id)
    1564     dispatch(9)
     1564    dispatch(constexpr op_put_by_id_length)
    15651565
    15661566
     
    16091609    storei t1, PayloadOffset[cfr, t0, 8]
    16101610    valueProfile(t2, t1, 20, t0)
    1611     dispatch(6)
     1611    dispatch(constexpr op_get_by_val_length)
    16121612
    16131613.opGetByValOutOfBounds:
     
    16161616.opGetByValSlow:
    16171617    callOpcodeSlowPath(_llint_slow_path_get_by_val)
    1618     dispatch(6)
     1618    dispatch(constexpr op_get_by_val_length)
    16191619
    16201620
     
    17941794    dispatchBranch(12[PC])
    17951795.opJneqPtrFallThrough:
    1796     dispatch(5)
     1796    dispatch(constexpr op_jneq_ptr_length)
    17971797
    17981798
     
    19531953    storei t1, TagOffset[cfr, t3, 8]
    19541954    storei t0, PayloadOffset[cfr, t3, 8]
    1955     dispatch(3)
     1955    dispatch(constexpr op_to_primitive_length)
    19561956
    19571957.opToPrimitiveSlowCase:
    19581958    callOpcodeSlowPath(_slow_path_to_primitive)
    1959     dispatch(3)
     1959    dispatch(constexpr op_to_primitive_length)
    19601960
    19611961
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm

    r218883 r220047  
    583583.opEnterDone:
    584584    callOpcodeSlowPath(_slow_path_enter)
    585     dispatch(1)
     585    dispatch(constexpr op_enter_length)
    586586
    587587
     
    595595    storeq t0, [cfr, t1, 8]
    596596    valueProfile(t0, 3, t2)
    597     dispatch(4)
     597    dispatch(constexpr op_get_argument_length)
    598598
    599599.opGetArgumentOutOfBounds:
    600600    storeq ValueUndefined, [cfr, t1, 8]
    601601    valueProfile(ValueUndefined, 3, t2)
    602     dispatch(4)
     602    dispatch(constexpr op_get_argument_length)
    603603
    604604
     
    610610    orq TagTypeNumber, t0
    611611    storeq t0, [cfr, t1, 8]
    612     dispatch(2)
     612    dispatch(constexpr op_argument_count_length)
    613613
    614614
     
    619619    loadisFromInstruction(1, t1)
    620620    storeq t0, [cfr, t1, 8]
    621     dispatch(2)
     621    dispatch(constexpr op_get_scope_length)
    622622
    623623
     
    631631    loadpFromInstruction(2, t2)
    632632    bpneq t1, t2, .opToThisSlow
    633     dispatch(4)
     633    dispatch(constexpr op_to_this_length)
    634634
    635635.opToThisSlow:
    636636    callOpcodeSlowPath(_slow_path_to_this)
    637     dispatch(4)
     637    dispatch(constexpr op_to_this_length)
    638638
    639639
     
    646646
    647647.opNotTDZ:
    648     dispatch(2)
     648    dispatch(constexpr op_check_tdz_length)
    649649
    650650
     
    655655    loadConstantOrVariable(t1, t2)
    656656    storeq t2, [cfr, t0, 8]
    657     dispatch(3)
     657    dispatch(constexpr op_mov_length)
    658658
    659659
     
    667667    xorq ValueTrue, t2
    668668    storeq t2, [cfr, t1, 8]
    669     dispatch(3)
     669    dispatch(constexpr op_not_length)
    670670
    671671.opNotSlow:
    672672    callOpcodeSlowPath(_slow_path_not)
    673     dispatch(3)
     673    dispatch(constexpr op_not_length)
    674674
    675675
     
    728728    orq ValueFalse, t0
    729729    storeq t0, [cfr, t1, 8]
    730     dispatch(3)
     730    dispatch(constexpr op_eq_null_length)
    731731
    732732
     
    737737    xorq ValueTrue, t0
    738738    storeq t0, [cfr, t1, 8]
    739     dispatch(3)
     739    dispatch(constexpr op_neq_null_length)
    740740
    741741
     
    815815    storeq t2, [cfr, t1, 8]
    816816    valueProfile(t2, 3, t0)
    817     dispatch(4)
     817    dispatch(constexpr op_to_number_length)
    818818
    819819.opToNumberSlow:
    820820    callOpcodeSlowPath(_slow_path_to_number)
    821     dispatch(4)
     821    dispatch(constexpr op_to_number_length)
    822822
    823823
     
    831831.opToStringIsString:
    832832    storeq t0, [cfr, t2, 8]
    833     dispatch(3)
     833    dispatch(constexpr op_to_string_length)
    834834
    835835.opToStringSlow:
    836836    callOpcodeSlowPath(_slow_path_to_string)
    837     dispatch(3)
     837    dispatch(constexpr op_to_string_length)
    838838
    839839
     
    851851    storeisToInstruction(t2, 3)
    852852    storeq t3, [cfr, t1, 8]
    853     dispatch(4)
     853    dispatch(constexpr op_negate_length)
    854854.opNegateNotInt:
    855855    btqz t3, tagTypeNumber, .opNegateSlow
     
    858858    storeq t3, [cfr, t1, 8]
    859859    storeisToInstruction(t2, 3)
    860     dispatch(4)
     860    dispatch(constexpr op_negate_length)
    861861
    862862.opNegateSlow:
    863863    callOpcodeSlowPath(_slow_path_negate)
    864     dispatch(4)
     864    dispatch(constexpr op_negate_length)
    865865
    866866
     
    995995    else
    996996        callOpcodeSlowPath(_slow_path_div)
    997         dispatch(5)
     997        dispatch(constexpr op_div_length)
    998998    end
    999999
     
    10221022        macro (left, right) lshifti left, right end,
    10231023        _slow_path_lshift,
    1024         4)
     1024        constexpr op_lshift_length)
    10251025
    10261026
     
    10301030        macro (left, right) rshifti left, right end,
    10311031        _slow_path_rshift,
    1032         4)
     1032        constexpr op_rshift_length)
    10331033
    10341034
     
    10381038        macro (left, right) urshifti left, right end,
    10391039        _slow_path_urshift,
    1040         4)
     1040        constexpr op_urshift_length)
    10411041
    10421042
     
    10481048    bilt t2, 0, .opUnsignedSlow
    10491049    storeq t2, [cfr, t0, 8]
    1050     dispatch(3)
     1050    dispatch(constexpr op_unsigned_length)
    10511051.opUnsignedSlow:
    10521052    callOpcodeSlowPath(_slow_path_unsigned)
    1053     dispatch(3)
     1053    dispatch(constexpr op_unsigned_length)
    10541054
    10551055
     
    10591059        macro (left, right) andi left, right end,
    10601060        _slow_path_bitand,
    1061         5)
     1061        constexpr op_bitand_length)
    10621062
    10631063
     
    10671067        macro (left, right) xori left, right end,
    10681068        _slow_path_bitxor,
    1069         5)
     1069        constexpr op_bitxor_length)
    10701070
    10711071
     
    10751075        macro (left, right) ori left, right end,
    10761076        _slow_path_bitor,
    1077         5)
     1077        constexpr op_bitor_length)
    10781078
    10791079
     
    10941094    orq ValueFalse, t1
    10951095    storeq t1, [cfr, t3, 8]
    1096     dispatch(4)
     1096    dispatch(constexpr op_overrides_has_instance_length)
    10971097
    10981098.opOverridesHasInstanceNotDefaultSymbol:
    10991099    storeq ValueTrue, [cfr, t3, 8]
    1100     dispatch(4)
     1100    dispatch(constexpr op_overrides_has_instance_length)
    11011101
    11021102
     
    11041104    traceExecution()
    11051105    callOpcodeSlowPath(_llint_slow_path_instanceof_custom)
    1106     dispatch(5)
     1106    dispatch(constexpr op_instanceof_custom_length)
    11071107
    11081108
     
    11151115    orq ValueFalse, t3
    11161116    storeq t3, [cfr, t2, 8]
    1117     dispatch(3)
     1117    dispatch(constexpr op_is_empty_length)
    11181118
    11191119
     
    11271127    orq ValueFalse, t3
    11281128    storeq t3, [cfr, t2, 8]
    1129     dispatch(3)
     1129    dispatch(constexpr op_is_undefined_length)
    11301130.opIsUndefinedCell:
    11311131    btbnz JSCell::m_flags[t0], MasqueradesAsUndefined, .masqueradesAsUndefined
    11321132    move ValueFalse, t1
    11331133    storeq t1, [cfr, t2, 8]
    1134     dispatch(3)
     1134    dispatch(constexpr op_is_undefined_length)
    11351135.masqueradesAsUndefined:
    11361136    loadStructureWithScratch(t0, t3, t1)
     
    11401140    orq ValueFalse, t0
    11411141    storeq t0, [cfr, t2, 8]
    1142     dispatch(3)
     1142    dispatch(constexpr op_is_undefined_length)
    11431143
    11441144
     
    11521152    orq ValueFalse, t0
    11531153    storeq t0, [cfr, t2, 8]
    1154     dispatch(3)
     1154    dispatch(constexpr op_is_boolean_length)
    11551155
    11561156
     
    11631163    orq ValueFalse, t1
    11641164    storeq t1, [cfr, t2, 8]
    1165     dispatch(3)
     1165    dispatch(constexpr op_is_number_length)
    11661166
    11671167
     
    11761176    orq ValueFalse, t1
    11771177    storeq t1, [cfr, t2, 8]
    1178     dispatch(4)
     1178    dispatch(constexpr op_is_cell_with_type_length)
    11791179.notCellCase:
    11801180    storeq ValueFalse, [cfr, t2, 8]
    1181     dispatch(4)
     1181    dispatch(constexpr op_is_cell_with_type_length)
    11821182
    11831183
     
    11911191    orq ValueFalse, t1
    11921192    storeq t1, [cfr, t2, 8]
    1193     dispatch(3)
     1193    dispatch(constexpr op_is_object_length)
    11941194.opIsObjectNotCell:
    11951195    storeq ValueFalse, [cfr, t2, 8]
    1196     dispatch(3)
     1196    dispatch(constexpr op_is_object_length)
    11971197
    11981198
     
    12341234    storeq t0, [cfr, t2, 8]
    12351235    valueProfile(t0, 8, t1)
    1236     dispatch(9)
     1236    dispatch(constexpr op_get_by_id_length)
    12371237
    12381238.opGetByIdSlow:
    12391239    callOpcodeSlowPath(_llint_slow_path_get_by_id)
    1240     dispatch(9)
     1240    dispatch(constexpr op_get_by_id_length)
    12411241
    12421242
     
    12541254    storeq t0, [cfr, t2, 8]
    12551255    valueProfile(t0, 8, t1)
    1256     dispatch(9)
     1256    dispatch(constexpr op_get_by_id_proto_load_length)
    12571257
    12581258.opGetByIdProtoSlow:
    12591259    callOpcodeSlowPath(_llint_slow_path_get_by_id)
    1260     dispatch(9)
     1260    dispatch(constexpr op_get_by_id_proto_load_length)
    12611261
    12621262
     
    12711271    storeq ValueUndefined, [cfr, t2, 8]
    12721272    valueProfile(ValueUndefined, 8, t1)
    1273     dispatch(9)
     1273    dispatch(constexpr op_get_by_id_unset_length)
    12741274
    12751275.opGetByIdUnsetSlow:
    12761276    callOpcodeSlowPath(_llint_slow_path_get_by_id)
    1277     dispatch(9)
     1277    dispatch(constexpr op_get_by_id_unset_length)
    12781278
    12791279
     
    12941294    valueProfile(t0, 8, t2)
    12951295    storeq t0, [cfr, t1, 8]
    1296     dispatch(9)
     1296    dispatch(constexpr op_get_array_length_length)
    12971297
    12981298.opGetArrayLengthSlow:
    12991299    callOpcodeSlowPath(_llint_slow_path_get_by_id)
    1300     dispatch(9)
     1300    dispatch(constexpr op_get_array_length_length)
    13011301
    13021302
     
    14371437    storePropertyAtVariableOffset(t1, t0, t2)
    14381438    writeBarrierOnOperands(1, 3)
    1439     dispatch(9)
     1439    dispatch(constexpr op_put_by_id_length)
    14401440
    14411441.opPutByIdSlow:
    14421442    callOpcodeSlowPath(_llint_slow_path_put_by_id)
    1443     dispatch(9)
     1443    dispatch(constexpr op_put_by_id_length)
    14441444
    14451445macro finishGetByVal(result, scratch)
     
    15041504    storeq t2, [cfr, t0, 8]
    15051505    valueProfile(t2, 5, t0)
    1506     dispatch(6)
     1506    dispatch(constexpr op_get_by_val_length)
    15071507
    15081508.opGetByValOutOfBounds:
     
    15801580.opGetByValSlow:
    15811581    callOpcodeSlowPath(_llint_slow_path_get_by_val)
    1582     dispatch(6)
     1582    dispatch(constexpr op_get_by_val_length)
    15831583
    15841584
     
    19181918.opToPrimitiveIsImm:
    19191919    storeq t0, [cfr, t3, 8]
    1920     dispatch(3)
     1920    dispatch(constexpr op_to_primitive_length)
    19211921
    19221922.opToPrimitiveSlowCase:
    19231923    callOpcodeSlowPath(_slow_path_to_primitive)
    1924     dispatch(3)
     1924    dispatch(constexpr op_to_primitive_length)
    19251925
    19261926
     
    19641964
    19651965    traceExecution()
    1966     dispatch(3)
     1966    dispatch(constexpr op_catch_length)
    19671967
    19681968
     
    20762076    bineq t0, GlobalProperty, .rGlobalVar
    20772077    getConstantScope(1)
    2078     dispatch(7)
     2078    dispatch(constexpr op_resolve_scope_length)
    20792079
    20802080.rGlobalVar:
    20812081    bineq t0, GlobalVar, .rGlobalLexicalVar
    20822082    getConstantScope(1)
    2083     dispatch(7)
     2083    dispatch(constexpr op_resolve_scope_length)
    20842084
    20852085.rGlobalLexicalVar:
    20862086    bineq t0, GlobalLexicalVar, .rClosureVar
    20872087    getConstantScope(1)
    2088     dispatch(7)
     2088    dispatch(constexpr op_resolve_scope_length)
    20892089
    20902090.rClosureVar:
    20912091    bineq t0, ClosureVar, .rModuleVar
    20922092    resolveScope()
    2093     dispatch(7)
     2093    dispatch(constexpr op_resolve_scope_length)
    20942094
    20952095.rModuleVar:
    20962096    bineq t0, ModuleVar, .rGlobalPropertyWithVarInjectionChecks
    20972097    getConstantScope(1)
    2098     dispatch(7)
     2098    dispatch(constexpr op_resolve_scope_length)
    20992099
    21002100.rGlobalPropertyWithVarInjectionChecks:
     
    21022102    varInjectionCheck(.rDynamic)
    21032103    getConstantScope(1)
    2104     dispatch(7)
     2104    dispatch(constexpr op_resolve_scope_length)
    21052105
    21062106.rGlobalVarWithVarInjectionChecks:
     
    21082108    varInjectionCheck(.rDynamic)
    21092109    getConstantScope(1)
    2110     dispatch(7)
     2110    dispatch(constexpr op_resolve_scope_length)
    21112111
    21122112.rGlobalLexicalVarWithVarInjectionChecks:
     
    21142114    varInjectionCheck(.rDynamic)
    21152115    getConstantScope(1)
    2116     dispatch(7)
     2116    dispatch(constexpr op_resolve_scope_length)
    21172117
    21182118.rClosureVarWithVarInjectionChecks:
     
    21202120    varInjectionCheck(.rDynamic)
    21212121    resolveScope()
    2122     dispatch(7)
     2122    dispatch(constexpr op_resolve_scope_length)
    21232123
    21242124.rDynamic:
    21252125    callOpcodeSlowPath(_slow_path_resolve_scope)
    2126     dispatch(7)
     2126    dispatch(constexpr op_resolve_scope_length)
    21272127
    21282128
     
    21692169    loadWithStructureCheck(2, .gDynamic)
    21702170    getProperty()
    2171     dispatch(8)
     2171    dispatch(constexpr op_get_from_scope_length)
    21722172
    21732173.gGlobalVar:
    21742174    bineq t0, GlobalVar, .gGlobalLexicalVar
    21752175    getGlobalVar(macro(v) end)
    2176     dispatch(8)
     2176    dispatch(constexpr op_get_from_scope_length)
    21772177
    21782178.gGlobalLexicalVar:
     
    21822182            bqeq value, ValueEmpty, .gDynamic
    21832183        end)
    2184     dispatch(8)
     2184    dispatch(constexpr op_get_from_scope_length)
    21852185
    21862186.gClosureVar:
     
    21882188    loadVariable(2, t0)
    21892189    getClosureVar()
    2190     dispatch(8)
     2190    dispatch(constexpr op_get_from_scope_length)
    21912191
    21922192.gGlobalPropertyWithVarInjectionChecks:
     
    21942194    loadWithStructureCheck(2, .gDynamic)
    21952195    getProperty()
    2196     dispatch(8)
     2196    dispatch(constexpr op_get_from_scope_length)
    21972197
    21982198.gGlobalVarWithVarInjectionChecks:
     
    22002200    varInjectionCheck(.gDynamic)
    22012201    getGlobalVar(macro(v) end)
    2202     dispatch(8)
     2202    dispatch(constexpr op_get_from_scope_length)
    22032203
    22042204.gGlobalLexicalVarWithVarInjectionChecks:
     
    22092209            bqeq value, ValueEmpty, .gDynamic
    22102210        end)
    2211     dispatch(8)
     2211    dispatch(constexpr op_get_from_scope_length)
    22122212
    22132213.gClosureVarWithVarInjectionChecks:
     
    22162216    loadVariable(2, t0)
    22172217    getClosureVar()
    2218     dispatch(8)
     2218    dispatch(constexpr op_get_from_scope_length)
    22192219
    22202220.gDynamic:
    22212221    callOpcodeSlowPath(_llint_slow_path_get_from_scope)
    2222     dispatch(8)
     2222    dispatch(constexpr op_get_from_scope_length)
    22232223
    22242224
     
    22792279    putLocalClosureVar()
    22802280    writeBarrierOnOperands(1, 3)
    2281     dispatch(7)
     2281    dispatch(constexpr op_put_to_scope_length)
    22822282
    22832283.pGlobalProperty:
     
    22862286    putProperty()
    22872287    writeBarrierOnOperands(1, 3)
    2288     dispatch(7)
     2288    dispatch(constexpr op_put_to_scope_length)
    22892289
    22902290.pGlobalVar:
     
    22922292    writeBarrierOnGlobalObject(3)
    22932293    putGlobalVariable()
    2294     dispatch(7)
     2294    dispatch(constexpr op_put_to_scope_length)
    22952295
    22962296.pGlobalLexicalVar:
     
    22992299    checkTDZInGlobalPutToScopeIfNecessary()
    23002300    putGlobalVariable()
    2301     dispatch(7)
     2301    dispatch(constexpr op_put_to_scope_length)
    23022302
    23032303.pClosureVar:
     
    23062306    putClosureVar()
    23072307    writeBarrierOnOperands(1, 3)
    2308     dispatch(7)
     2308    dispatch(constexpr op_put_to_scope_length)
    23092309
    23102310.pGlobalPropertyWithVarInjectionChecks:
     
    23132313    putProperty()
    23142314    writeBarrierOnOperands(1, 3)
    2315     dispatch(7)
     2315    dispatch(constexpr op_put_to_scope_length)
    23162316
    23172317.pGlobalVarWithVarInjectionChecks:
     
    23202320    varInjectionCheck(.pDynamic)
    23212321    putGlobalVariable()
    2322     dispatch(7)
     2322    dispatch(constexpr op_put_to_scope_length)
    23232323
    23242324.pGlobalLexicalVarWithVarInjectionChecks:
     
    23282328    checkTDZInGlobalPutToScopeIfNecessary()
    23292329    putGlobalVariable()
    2330     dispatch(7)
     2330    dispatch(constexpr op_put_to_scope_length)
    23312331
    23322332.pClosureVarWithVarInjectionChecks:
     
    23362336    putClosureVar()
    23372337    writeBarrierOnOperands(1, 3)
    2338     dispatch(7)
     2338    dispatch(constexpr op_put_to_scope_length)
    23392339
    23402340.pModuleVar:
    23412341    bineq t0, ModuleVar, .pDynamic
    23422342    callOpcodeSlowPath(_slow_path_throw_strict_mode_readonly_property_write_error)
    2343     dispatch(7)
     2343    dispatch(constexpr op_put_to_scope_length)
    23442344
    23452345.pDynamic:
    23462346    callOpcodeSlowPath(_llint_slow_path_put_to_scope)
    2347     dispatch(7)
     2347    dispatch(constexpr op_put_to_scope_length)
    23482348
    23492349
     
    23562356    loadisFromInstruction(1, t1)
    23572357    storeq t0, [cfr, t1, 8]
    2358     dispatch(5)
     2358    dispatch(constexpr op_get_from_arguments_length)
    23592359
    23602360
     
    23672367    storeq t2, DirectArguments_storage[t0, t1, 8]
    23682368    writeBarrierOnOperands(1, 3)
    2369     dispatch(4)
     2369    dispatch(constexpr op_put_to_arguments_length)
    23702370
    23712371
     
    23762376    loadisFromInstruction(1, t1)
    23772377    storeq t0, [cfr, t1, 8]
    2378     dispatch(3)
     2378    dispatch(constexpr op_get_parent_scope_length)
    23792379
    23802380
     
    24172417
    24182418.opProfileTypeDone:
    2419     dispatch(6)
     2419    dispatch(constexpr op_profile_type_length)
    24202420
    24212421_llint_op_profile_control_flow:
     
    24232423    loadpFromInstruction(1, t0)
    24242424    addq 1, BasicBlockLocation::m_executionCount[t0]
    2425     dispatch(2)
     2425    dispatch(constexpr op_profile_control_flow_length)
    24262426
    24272427
     
    24402440    loadisFromInstruction(1, t1)
    24412441    storeq t0, [cfr, t1, 8]
    2442     dispatch(3)
     2442    dispatch(constexpr op_get_rest_length_length)
    24432443
    24442444
     
    24532453    loadVariable(1, t1)
    24542454    storep t1, ShadowChicken::Packet::scope[t0]
    2455     dispatch(2)
     2455    dispatch(constexpr op_log_shadow_chicken_prologue_length)
    24562456.opLogShadowChickenPrologueSlow:
    24572457    callOpcodeSlowPath(_llint_slow_path_log_shadow_chicken_prologue)
    2458     dispatch(2)
     2458    dispatch(constexpr op_log_shadow_chicken_prologue_length)
    24592459
    24602460
     
    24712471    storep t1, ShadowChicken::Packet::codeBlock[t0]
    24722472    storei PC, ShadowChicken::Packet::callSiteIndex[t0]
    2473     dispatch(3)
     2473    dispatch(constexpr op_log_shadow_chicken_tail_length)
    24742474.opLogShadowChickenTailSlow:
    24752475    callOpcodeSlowPath(_llint_slow_path_log_shadow_chicken_tail)
    2476     dispatch(3)
     2476    dispatch(constexpr op_log_shadow_chicken_tail_length)
  • trunk/Source/JavaScriptCore/offlineasm/asm.rb

    r206759 r220047  
    316316rescue MissingMagicValuesException
    317317    $stderr.puts "offlineasm: No magic values found. Skipping assembly file generation."
    318     exit 0
     318    exit 1
    319319end
    320320
     
    367367            end
    368368
    369             lowLevelAST = lowLevelAST.resolve(*buildOffsetsMap(lowLevelAST, offsetsList))
     369            lowLevelAST = lowLevelAST.resolve(buildOffsetsMap(lowLevelAST, offsetsList))
    370370            lowLevelAST.validate
    371371            emitCodeInConfiguration(concreteSettings, lowLevelAST, backend) {
  • trunk/Source/JavaScriptCore/offlineasm/ast.rb

    r172429 r220047  
    946946end
    947947
     948class ConstExpr < NoChildren
     949    attr_reader :variable, :value
     950
     951    def initialize(codeOrigin, value)
     952        super(codeOrigin)
     953        @value = value
     954    end
     955
     956    @@mapping = {}
     957
     958    def self.forName(codeOrigin, text)
     959        unless @@mapping[text]
     960            @@mapping[text] = ConstExpr.new(codeOrigin, text)
     961        end
     962        @@mapping[text]
     963    end
     964
     965    def dump
     966        "constexpr (#{@value.dump})"
     967    end
     968
     969    def <=>(other)
     970        @value <=> other.value
     971    end
     972
     973    def immediate?
     974        true
     975    end
     976end
     977
    948978class ConstDecl < Node
    949979    attr_reader :variable, :value
    950    
     980
    951981    def initialize(codeOrigin, variable, value)
    952982        super(codeOrigin)
     
    954984        @value = value
    955985    end
    956    
     986
    957987    def children
    958988        [@variable, @value]
    959989    end
    960    
     990
    961991    def mapChildren
    962992        ConstDecl.new(codeOrigin, (yield @variable), (yield @value))
    963993    end
    964    
     994
    965995    def dump
    966996        "const #{@variable.dump} = #{@value.dump}"
  • trunk/Source/JavaScriptCore/offlineasm/generate_offset_extractor.rb

    r194531 r220047  
    109109end
    110110
     111class ConstExpr
     112    def offsetsPruneTo(sequence)
     113        sequence.list << self
     114    end
     115end
     116
    111117prunedAST = originalAST.offsetsPrune
    112118
     
    120126        offsetsList = ast.filter(StructOffset).uniq.sort
    121127        sizesList = ast.filter(Sizeof).uniq.sort
    122         length += OFFSET_HEADER_MAGIC_NUMBERS.size + (OFFSET_MAGIC_NUMBERS.size + 1) * (1 + offsetsList.size + sizesList.size)
     128        constsList = ast.filter(ConstExpr).uniq.sort
     129        length += OFFSET_HEADER_MAGIC_NUMBERS.size + (OFFSET_MAGIC_NUMBERS.size + 1) * (1 + offsetsList.size + sizesList.size + constsList.size)
    123130    }
    124     outp.puts "static const unsigned extractorTable[#{length}] = {"
     131    outp.puts "static const int64_t extractorTable[#{length}] = {"
    125132    emitCodeInAllConfigurations(prunedAST) {
    126133        | settings, ast, backend, index |
     
    132139        offsetsList = ast.filter(StructOffset).uniq.sort
    133140        sizesList = ast.filter(Sizeof).uniq.sort
    134        
     141        constsList = ast.filter(ConstExpr).uniq.sort
     142
    135143        emitMagicNumber
    136144        outp.puts "#{index},"
     
    141149        }
    142150        sizesList.each {
    143             | offset |
     151            | sizeof |
    144152            emitMagicNumber
    145             outp.puts "sizeof(#{offset.struct}),"
     153            outp.puts "sizeof(#{sizeof.struct}),"
     154        }
     155        constsList.each {
     156            | const |
     157            emitMagicNumber
     158            outp.puts "static_cast<int64_t>(#{const.value}),"
    146159        }
    147160    }
    148161    outp.puts "};"
     162
     163    emitCodeInAllConfigurations(prunedAST) {
     164        | settings, ast, backend, index |
     165        constsList = ast.filter(ConstExpr).uniq.sort
     166
     167        constsList.each_with_index {
     168            | const, index |
     169            outp.puts "constexpr int64_t isConst#{index} = static_cast<int64_t>(#{const.value});"
     170            # Make a trivally true static assert that uses the last value...
     171            outp.puts "static_assert(isConst#{index} || true, \"\");"
     172        }
     173    }
     174
    149175}
  • trunk/Source/JavaScriptCore/offlineasm/offsets.rb

    r132590 r220047  
    2525require "ast"
    2626
    27 def to32Bit(value)
    28     if value > 0x7fffffff
    29         value -= 1 << 32
    30     end
    31     value
    32 end
    33 
    34 OFFSET_HEADER_MAGIC_NUMBERS = [ to32Bit(0x9e43fd66), to32Bit(0x4379bfba) ]
    35 OFFSET_MAGIC_NUMBERS = [ to32Bit(0xec577ac7), to32Bit(0x0ff5e755) ]
     27OFFSET_HEADER_MAGIC_NUMBERS = [ 0x2e43fd66, 0x4379bfba ]
     28OFFSET_MAGIC_NUMBERS = [ 0x5c577ac7, 0x0ff5e755 ]
    3629
    3730#
     
    4740# offsetsList(ast)
    4841# sizesList(ast)
    49 #
    50 # Returns a list of offsets and sizes used by the AST.
     42# constsLists(ast)
     43#
     44# Returns a list of offsets, sizeofs, and consts used by the AST.
    5145#
    5246
     
    5751def sizesList(ast)
    5852    ast.filter(Sizeof).uniq.sort
     53end
     54
     55def constsList(ast)
     56    ast.filter(ConstExpr).uniq.sort
    5957end
    6058
     
    7472        if endianness == :little
    7573            # Little endian
    76             (bytes[0] << 0 |
    77              bytes[1] << 8 |
    78              bytes[2] << 16 |
    79              bytes[3] << 24)
     74            number = (bytes[0] << 0  |
     75                      bytes[1] << 8  |
     76                      bytes[2] << 16 |
     77                      bytes[3] << 24 |
     78                      bytes[4] << 32 |
     79                      bytes[5] << 40 |
     80                      bytes[6] << 48 |
     81                      bytes[7] << 56)
    8082        else
    8183            # Big endian
    82             (bytes[0] << 24 |
    83              bytes[1] << 16 |
    84              bytes[2] << 8 |
    85              bytes[3] << 0)
     84            number = (bytes[0] << 56 |
     85                      bytes[1] << 48 |
     86                      bytes[2] << 40 |
     87                      bytes[3] << 32 |
     88                      bytes[4] << 24 |
     89                      bytes[5] << 16 |
     90                      bytes[6] << 8  |
     91                      bytes[7] << 0)
    8692        end
     93        if number > 0x7fffffff_ffffffff
     94            number -= 1 << 64
     95        end
     96        number
    8797    end
    8898   
     
    92102            | number |
    93103            currentBytes = []
    94             4.times {
     104            8.times {
    95105                currentBytes << (number & 0xff)
    96106                number >>= 8
     
    171181
    172182#
    173 # buildOffsetsMap(ast, offsetsList) -> [offsets, sizes]
    174 #
    175 # Builds a mapping between StructOffset nodes and their values.
    176 #
    177 
    178 def buildOffsetsMap(ast, offsetsList)
    179     offsetsMap = {}
    180     sizesMap = {}
     183# buildOffsetsMap(ast, extractedConstants) -> map
     184#
     185# Builds a mapping between StructOffset, Sizeof, and ConstExpr nodes and their values.
     186#
     187
     188def buildOffsetsMap(ast, extractedConstants)
     189    map = {}
    181190    astOffsetsList = offsetsList(ast)
    182191    astSizesList = sizesList(ast)
    183     raise unless astOffsetsList.size + astSizesList.size == offsetsList.size
    184     offsetsList(ast).each_with_index {
     192    astConstsList = constsList(ast)
     193
     194    raise unless astOffsetsList.size + astSizesList.size + astConstsList.size == extractedConstants.size
     195    astOffsetsList.each_with_index {
    185196        | structOffset, index |
    186         offsetsMap[structOffset] = offsetsList.shift
    187     }
    188     sizesList(ast).each_with_index {
     197        map[structOffset] = extractedConstants.shift
     198    }
     199    astSizesList.each_with_index {
    189200        | sizeof, index |
    190         sizesMap[sizeof] = offsetsList.shift
    191     }
    192     [offsetsMap, sizesMap]
    193 end
    194 
     201        map[sizeof] = extractedConstants.shift
     202    }
     203    astConstsList.each_with_index {
     204        | const, index |
     205        map[const] = extractedConstants.shift
     206    }
     207    map
     208end
     209
  • trunk/Source/JavaScriptCore/offlineasm/parser.rb

    r200125 r220047  
    44# modification, are permitted provided that the following conditions
    55# are met:
    6 # 1. Redistributions of source code must retain the above copyright
     6# 1. Redistributions of source code must retain the above copyrighht
    77#    notice, this list of conditions and the following disclaimer.
    88# 2. Redistributions in binary form must reproduce the above copyright
     
    223223
    224224def isKeyword(token)
    225     token =~ /\A((true)|(false)|(if)|(then)|(else)|(elsif)|(end)|(and)|(or)|(not)|(global)|(macro)|(const)|(sizeof)|(error)|(include))\Z/ or
     225    token =~ /\A((true)|(false)|(if)|(then)|(else)|(elsif)|(end)|(and)|(or)|(not)|(global)|(macro)|(const)|(constexpr)|(sizeof)|(error)|(include))\Z/ or
    226226        token =~ REGISTER_PATTERN or
    227227        isInstruction(token)
     
    418418        [codeOrigin, names]
    419419    end
     420
     421    def parseTextInParens
     422        skipNewLine
     423        codeOrigin = @tokens[@idx].codeOrigin
     424        raise unless @tokens[@idx] == "("
     425        @idx += 1
     426        # need at least one item
     427        raise if @tokens[@idx] == ")"
     428        numEnclosedParens = 0
     429        text = []
     430        while @tokens[@idx] != ")" || numEnclosedParens > 0
     431            if @tokens[@idx] == "("
     432                numEnclosedParens += 1
     433            elsif @tokens[@idx] == ")"
     434                numEnclosedParens -= 1
     435            end
     436
     437            text << @tokens[@idx].string
     438            @idx += 1
     439        end
     440        @idx += 1
     441        return [codeOrigin, text]
     442    end
     443
    420444   
    421445    def parseExpressionAtom
     
    454478            codeOrigin, names = parseColonColon
    455479            Sizeof.forName(codeOrigin, names.join('::'))
     480        elsif @tokens[@idx] == "constexpr"
     481            @idx += 1
     482            skipNewLine
     483            if @tokens[@idx] == "("
     484                codeOrigin, text = parseTextInParens
     485                text = text.join
     486            else
     487                codeOrigin, text = parseColonColon
     488                text = text.join("::")
     489            end
     490            ConstExpr.forName(codeOrigin, text)
    456491        elsif isLabel @tokens[@idx]
    457492            result = LabelReference.new(@tokens[@idx].codeOrigin, Label.forName(@tokens[@idx].codeOrigin, @tokens[@idx].string))
     
    482517   
    483518    def couldBeExpression
    484         @tokens[@idx] == "-" or @tokens[@idx] == "~" or @tokens[@idx] == "sizeof" or isInteger(@tokens[@idx]) or isString(@tokens[@idx]) or isVariable(@tokens[@idx]) or @tokens[@idx] == "("
     519        @tokens[@idx] == "-" or @tokens[@idx] == "~" or @tokens[@idx] == "sizeof" or @tokens[@idx] == "constexpr" or isInteger(@tokens[@idx]) or isString(@tokens[@idx]) or isVariable(@tokens[@idx]) or @tokens[@idx] == "("
    485520    end
    486521   
  • trunk/Source/JavaScriptCore/offlineasm/transform.rb

    r172429 r220047  
    250250
    251251class Node
    252     def resolveOffsets(offsets, sizes)
    253         mapChildren {
    254             | child |
    255             child.resolveOffsets(offsets, sizes)
     252    def resolveOffsets(constantsMap)
     253        mapChildren {
     254            | child |
     255            child.resolveOffsets(constantsMap)
    256256        }
    257257    end
     
    259259
    260260class StructOffset
    261     def resolveOffsets(offsets, sizes)
    262         if offsets[self]
    263             Immediate.new(codeOrigin, offsets[self])
     261    def resolveOffsets(constantsMap)
     262        if constantsMap[self]
     263            Immediate.new(codeOrigin, constantsMap[self])
    264264        else
    265             self
     265            puts "Could not find #{self.inspect} in #{constantsMap.keys.inspect}"
     266            puts "sizes = #{constantsMap.inspect}"
     267            raise
    266268        end
    267269    end
     
    269271
    270272class Sizeof
    271     def resolveOffsets(offsets, sizes)
    272         if sizes[self]
    273             Immediate.new(codeOrigin, sizes[self])
     273    def resolveOffsets(constantsMap)
     274        if constantsMap[self]
     275            Immediate.new(codeOrigin, constantsMap[self])
    274276        else
    275             puts "Could not find #{self.inspect} in #{sizes.keys.inspect}"
    276             puts "sizes = #{sizes.inspect}"
    277             self
     277            puts "Could not find #{self.inspect} in #{constantsMap.keys.inspect}"
     278            puts "sizes = #{constantsMap.inspect}"
     279            raise
     280        end
     281    end
     282end
     283
     284class ConstExpr
     285    def resolveOffsets(constantsMap)
     286        if constantsMap[self]
     287            Immediate.new(codeOrigin, constantsMap[self])
     288        else
     289            puts "Could not find #{self.inspect} in #{constantsMap.keys.inspect}"
     290            puts "sizes = #{constantsMap.inspect}"
     291            raise
    278292        end
    279293    end
     
    378392
    379393class Node
    380     def resolve(offsets, sizes)
    381         demacroify({}).resolveOffsets(offsets, sizes).fold
     394    def resolve(constantsMap)
     395        demacroify({}).resolveOffsets(constantsMap).fold
    382396    end
    383397end
Note: See TracChangeset for help on using the changeset viewer.