Changeset 220047 in webkit
- Timestamp:
- Jul 29, 2017, 8:01:12 PM (9 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 11 edited
-
ChangeLog (modified) (1 diff)
-
llint/LLIntOffsetsExtractor.cpp (modified) (1 diff)
-
llint/LowLevelInterpreter.asm (modified) (54 diffs)
-
llint/LowLevelInterpreter32_64.asm (modified) (44 diffs)
-
llint/LowLevelInterpreter64.asm (modified) (69 diffs)
-
offlineasm/asm.rb (modified) (2 diffs)
-
offlineasm/ast.rb (modified) (2 diffs)
-
offlineasm/generate_offset_extractor.rb (modified) (4 diffs)
-
offlineasm/offsets.rb (modified) (6 diffs)
-
offlineasm/parser.rb (modified) (5 diffs)
-
offlineasm/transform.rb (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r220036 r220047 1 2017-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 1 34 2017-07-28 Matt Baker <mattbaker@apple.com> 2 35 -
trunk/Source/JavaScriptCore/llint/LLIntOffsetsExtractor.cpp
r208712 r220047 68 68 class LLIntOffsetsExtractor { 69 69 public: 70 static const unsigned* dummy();70 static const int64_t* dummy(); 71 71 }; 72 72 73 const unsigned* LLIntOffsetsExtractor::dummy()73 const int64_t* LLIntOffsetsExtractor::dummy() 74 74 { 75 75 // This is a file generated by offlineasm/generate_offsets_extractor.rb, and contains code -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm
r218883 r220047 154 154 # These declarations must match interpreter/JSStack.h. 155 155 156 const PtrSize = constexpr (sizeof(void*)) 157 156 158 if JSVALUE64 157 const PtrSize = 8158 159 const CallFrameHeaderSlots = 5 159 160 else 160 const PtrSize = 4161 161 const CallFrameHeaderSlots = 4 162 162 const CallFrameAlignSlots = 1 … … 206 206 207 207 # NOTE: The values below must be in sync with what is in PutByIdFlags.h. 208 const PutByIdPrimaryTypeMask = 0x6209 const PutByIdPrimaryTypeSecondary = 0x0210 const PutByIdPrimaryTypeObjectWithStructure = 0x2211 const PutByIdPrimaryTypeObjectWithStructureOrOther = 0x4212 const PutByIdSecondaryTypeMask = -0x8213 const PutByIdSecondaryTypeBottom = 0x0214 const PutByIdSecondaryTypeBoolean = 0x8215 const PutByIdSecondaryTypeOther = 0x10216 const PutByIdSecondaryTypeInt32 = 0x18217 const PutByIdSecondaryTypeNumber = 0x20218 const PutByIdSecondaryTypeString = 0x28219 const PutByIdSecondaryTypeSymbol = 0x30220 const PutByIdSecondaryTypeObject = 0x38221 const PutByIdSecondaryTypeObjectOrOther = 0x40222 const PutByIdSecondaryTypeTop = 0x48208 const PutByIdPrimaryTypeMask = constexpr PutByIdPrimaryTypeMask 209 const PutByIdPrimaryTypeSecondary = constexpr PutByIdPrimaryTypeSecondary 210 const PutByIdPrimaryTypeObjectWithStructure = constexpr PutByIdPrimaryTypeObjectWithStructure 211 const PutByIdPrimaryTypeObjectWithStructureOrOther = constexpr PutByIdPrimaryTypeObjectWithStructureOrOther 212 const PutByIdSecondaryTypeMask = constexpr PutByIdSecondaryTypeMask 213 const PutByIdSecondaryTypeBottom = constexpr PutByIdSecondaryTypeBottom 214 const PutByIdSecondaryTypeBoolean = constexpr PutByIdSecondaryTypeBoolean 215 const PutByIdSecondaryTypeOther = constexpr PutByIdSecondaryTypeOther 216 const PutByIdSecondaryTypeInt32 = constexpr PutByIdSecondaryTypeInt32 217 const PutByIdSecondaryTypeNumber = constexpr PutByIdSecondaryTypeNumber 218 const PutByIdSecondaryTypeString = constexpr PutByIdSecondaryTypeString 219 const PutByIdSecondaryTypeSymbol = constexpr PutByIdSecondaryTypeSymbol 220 const PutByIdSecondaryTypeObject = constexpr PutByIdSecondaryTypeObject 221 const PutByIdSecondaryTypeObjectOrOther = constexpr PutByIdSecondaryTypeObjectOrOther 222 const PutByIdSecondaryTypeTop = constexpr PutByIdSecondaryTypeTop 223 223 224 224 const CallOpCodeSize = 9 … … 246 246 247 247 # Watchpoint states 248 const ClearWatchpoint = 0249 const IsWatched = 1250 const IsInvalidated = 2248 const ClearWatchpoint = constexpr ClearWatchpoint 249 const IsWatched = constexpr IsWatched 250 const IsInvalidated = constexpr IsInvalidated 251 251 252 252 # ShadowChicken data … … 334 334 335 335 # Constant for reasoning about butterflies. 336 const IsArray = 0x01337 const IndexingShapeMask = 0x0E338 const NoIndexingShape = 0x00339 const Int32Shape = 0x04340 const DoubleShape = 0x06341 const ContiguousShape = 0x08342 const ArrayStorageShape = 0x0A343 const SlowPutArrayStorageShape = 0x0C336 const IsArray = constexpr IsArray 337 const IndexingShapeMask = constexpr IndexingShapeMask 338 const NoIndexingShape = constexpr NoIndexingShape 339 const Int32Shape = constexpr Int32Shape 340 const DoubleShape = constexpr DoubleShape 341 const ContiguousShape = constexpr ContiguousShape 342 const ArrayStorageShape = constexpr ArrayStorageShape 343 const SlowPutArrayStorageShape = constexpr SlowPutArrayStorageShape 344 344 345 345 # Type constants. 346 const StringType = 6347 const SymbolType = 7348 const ObjectType = 23349 const FinalObjectType = 24350 const JSFunctionType = 26351 const ArrayType = 34352 const DerivedArrayType = 35353 const ProxyObjectType = 53346 const StringType = constexpr StringType 347 const SymbolType = constexpr SymbolType 348 const ObjectType = constexpr ObjectType 349 const FinalObjectType = constexpr FinalObjectType 350 const JSFunctionType = constexpr JSFunctionType 351 const ArrayType = constexpr ArrayType 352 const DerivedArrayType = constexpr DerivedArrayType 353 const ProxyObjectType = constexpr ProxyObjectType 354 354 355 355 # The typed array types need to be numbered in a particular order because of the manually written 356 356 # switch statement in get_by_val and put_by_val. 357 const Int8ArrayType = 36358 const Int16ArrayType = 37359 const Int32ArrayType = 38360 const Uint8ArrayType = 39361 const Uint8ClampedArrayType = 40362 const Uint16ArrayType = 41363 const Uint32ArrayType = 42364 const Float32ArrayType = 43365 const Float64ArrayType = 44357 const Int8ArrayType = constexpr Int8ArrayType 358 const Int16ArrayType = constexpr Int16ArrayType 359 const Int32ArrayType = constexpr Int32ArrayType 360 const Uint8ArrayType = constexpr Uint8ArrayType 361 const Uint8ClampedArrayType = constexpr Uint8ClampedArrayType 362 const Uint16ArrayType = constexpr Uint16ArrayType 363 const Uint32ArrayType = constexpr Uint32ArrayType 364 const Float32ArrayType = constexpr Float32ArrayType 365 const Float64ArrayType = constexpr Float64ArrayType 366 366 367 367 const FirstArrayType = Int8ArrayType … … 369 369 370 370 # Type flags constants. 371 const MasqueradesAsUndefined = 1372 const ImplementsDefaultHasInstance = 2371 const MasqueradesAsUndefined = constexpr MasqueradesAsUndefined 372 const ImplementsDefaultHasInstance = constexpr ImplementsDefaultHasInstance 373 373 374 374 # Bytecode operand constants. 375 const FirstConstantRegisterIndex = 0x40000000375 const FirstConstantRegisterIndex = constexpr FirstConstantRegisterIndex 376 376 377 377 # Code type constants. 378 const GlobalCode = 0379 const EvalCode = 1380 const FunctionCode = 2381 const ModuleCode = 3378 const GlobalCode = constexpr GlobalCode 379 const EvalCode = constexpr EvalCode 380 const FunctionCode = constexpr FunctionCode 381 const ModuleCode = constexpr ModuleCode 382 382 383 383 # The interpreter steals the tag word of the argument count. … … 391 391 392 392 # ResolveType 393 const GlobalProperty = 0394 const GlobalVar = 1395 const GlobalLexicalVar = 2396 const ClosureVar = 3397 const LocalClosureVar = 4398 const ModuleVar = 5399 const GlobalPropertyWithVarInjectionChecks = 6400 const GlobalVarWithVarInjectionChecks = 7401 const GlobalLexicalVarWithVarInjectionChecks = 8402 const ClosureVarWithVarInjectionChecks = 9393 const GlobalProperty = constexpr GlobalProperty 394 const GlobalVar = constexpr GlobalVar 395 const GlobalLexicalVar = constexpr GlobalLexicalVar 396 const ClosureVar = constexpr ClosureVar 397 const LocalClosureVar = constexpr LocalClosureVar 398 const ModuleVar = constexpr ModuleVar 399 const GlobalPropertyWithVarInjectionChecks = constexpr GlobalPropertyWithVarInjectionChecks 400 const GlobalVarWithVarInjectionChecks = constexpr GlobalVarWithVarInjectionChecks 401 const GlobalLexicalVarWithVarInjectionChecks = constexpr GlobalLexicalVarWithVarInjectionChecks 402 const ClosureVarWithVarInjectionChecks = constexpr ClosureVarWithVarInjectionChecks 403 403 404 404 const ResolveTypeMask = 0x3ff … … 1257 1257 traceExecution() 1258 1258 callOpcodeSlowPath(_slow_path_create_direct_arguments) 1259 dispatch( 2)1259 dispatch(constexpr op_create_direct_arguments_length) 1260 1260 1261 1261 … … 1263 1263 traceExecution() 1264 1264 callOpcodeSlowPath(_slow_path_create_scoped_arguments) 1265 dispatch( 3)1265 dispatch(constexpr op_create_scoped_arguments_length) 1266 1266 1267 1267 … … 1269 1269 traceExecution() 1270 1270 callOpcodeSlowPath(_slow_path_create_cloned_arguments) 1271 dispatch( 2)1271 dispatch(constexpr op_create_cloned_arguments_length) 1272 1272 1273 1273 … … 1275 1275 traceExecution() 1276 1276 callOpcodeSlowPath(_slow_path_create_this) 1277 dispatch( 5)1277 dispatch(constexpr op_create_this_length) 1278 1278 1279 1279 … … 1281 1281 traceExecution() 1282 1282 callOpcodeSlowPath(_llint_slow_path_new_object) 1283 dispatch( 4)1283 dispatch(constexpr op_new_object_length) 1284 1284 1285 1285 … … 1287 1287 traceExecution() 1288 1288 callOpcodeSlowPath(_llint_slow_path_new_func) 1289 dispatch( 4)1289 dispatch(constexpr op_new_func_length) 1290 1290 1291 1291 … … 1293 1293 traceExecution() 1294 1294 callOpcodeSlowPath(_llint_slow_path_new_generator_func) 1295 dispatch( 4)1295 dispatch(constexpr op_new_generator_func_length) 1296 1296 1297 1297 … … 1299 1299 traceExecution() 1300 1300 callSlowPath(_llint_slow_path_new_async_func) 1301 dispatch( 4)1301 dispatch(constexpr op_new_async_func_length) 1302 1302 1303 1303 … … 1305 1305 traceExecution() 1306 1306 callOpcodeSlowPath(_llint_slow_path_new_array) 1307 dispatch( 5)1307 dispatch(constexpr op_new_array_length) 1308 1308 1309 1309 … … 1311 1311 traceExecution() 1312 1312 callOpcodeSlowPath(_slow_path_new_array_with_spread) 1313 dispatch( 5)1313 dispatch(constexpr op_new_array_with_spread_length) 1314 1314 1315 1315 … … 1317 1317 traceExecution() 1318 1318 callOpcodeSlowPath(_slow_path_spread) 1319 dispatch( 3)1319 dispatch(constexpr op_spread_length) 1320 1320 1321 1321 … … 1323 1323 traceExecution() 1324 1324 callOpcodeSlowPath(_llint_slow_path_new_array_with_size) 1325 dispatch( 4)1325 dispatch(constexpr op_new_array_with_size_length) 1326 1326 1327 1327 … … 1329 1329 traceExecution() 1330 1330 callOpcodeSlowPath(_llint_slow_path_new_array_buffer) 1331 dispatch( 5)1331 dispatch(constexpr op_new_array_buffer_length) 1332 1332 1333 1333 … … 1335 1335 traceExecution() 1336 1336 callOpcodeSlowPath(_llint_slow_path_new_regexp) 1337 dispatch( 3)1337 dispatch(constexpr op_new_regexp_length) 1338 1338 1339 1339 … … 1341 1341 traceExecution() 1342 1342 callOpcodeSlowPath(_slow_path_less) 1343 dispatch( 4)1343 dispatch(constexpr op_less_length) 1344 1344 1345 1345 … … 1347 1347 traceExecution() 1348 1348 callOpcodeSlowPath(_slow_path_lesseq) 1349 dispatch( 4)1349 dispatch(constexpr op_lesseq_length) 1350 1350 1351 1351 … … 1353 1353 traceExecution() 1354 1354 callOpcodeSlowPath(_slow_path_greater) 1355 dispatch( 4)1355 dispatch(constexpr op_greater_length) 1356 1356 1357 1357 … … 1359 1359 traceExecution() 1360 1360 callOpcodeSlowPath(_slow_path_greatereq) 1361 dispatch( 4)1361 dispatch(constexpr op_greatereq_length) 1362 1362 1363 1363 … … 1365 1365 traceExecution() 1366 1366 callOpcodeSlowPath(_slow_path_mod) 1367 dispatch( 4)1367 dispatch(constexpr op_mod_length) 1368 1368 1369 1369 … … 1371 1371 traceExecution() 1372 1372 callOpcodeSlowPath(_slow_path_pow) 1373 dispatch( 4)1373 dispatch(constexpr op_pow_length) 1374 1374 1375 1375 … … 1377 1377 traceExecution() 1378 1378 callOpcodeSlowPath(_slow_path_typeof) 1379 dispatch( 3)1379 dispatch(constexpr op_typeof_length) 1380 1380 1381 1381 … … 1383 1383 traceExecution() 1384 1384 callOpcodeSlowPath(_slow_path_is_object_or_null) 1385 dispatch( 3)1385 dispatch(constexpr op_is_object_or_null_length) 1386 1386 1387 1387 _llint_op_is_function: 1388 1388 traceExecution() 1389 1389 callOpcodeSlowPath(_slow_path_is_function) 1390 dispatch( 3)1390 dispatch(constexpr op_is_function_length) 1391 1391 1392 1392 … … 1394 1394 traceExecution() 1395 1395 callOpcodeSlowPath(_slow_path_in) 1396 dispatch( 5)1396 dispatch(constexpr op_in_length) 1397 1397 1398 1398 … … 1400 1400 traceExecution() 1401 1401 callOpcodeSlowPath(_llint_slow_path_try_get_by_id) 1402 dispatch( 5)1402 dispatch(constexpr op_try_get_by_id_length) 1403 1403 1404 1404 … … 1406 1406 traceExecution() 1407 1407 callOpcodeSlowPath(_llint_slow_path_del_by_id) 1408 dispatch( 4)1408 dispatch(constexpr op_del_by_id_length) 1409 1409 1410 1410 … … 1412 1412 traceExecution() 1413 1413 callOpcodeSlowPath(_llint_slow_path_del_by_val) 1414 dispatch( 4)1414 dispatch(constexpr op_del_by_val_length) 1415 1415 1416 1416 … … 1418 1418 traceExecution() 1419 1419 callOpcodeSlowPath(_llint_slow_path_put_by_index) 1420 dispatch( 4)1420 dispatch(constexpr op_put_by_index_length) 1421 1421 1422 1422 … … 1424 1424 traceExecution() 1425 1425 callOpcodeSlowPath(_llint_slow_path_put_getter_by_id) 1426 dispatch( 5)1426 dispatch(constexpr op_put_getter_by_id_length) 1427 1427 1428 1428 … … 1430 1430 traceExecution() 1431 1431 callOpcodeSlowPath(_llint_slow_path_put_setter_by_id) 1432 dispatch( 5)1432 dispatch(constexpr op_put_setter_by_id_length) 1433 1433 1434 1434 … … 1436 1436 traceExecution() 1437 1437 callOpcodeSlowPath(_llint_slow_path_put_getter_setter_by_id) 1438 dispatch( 6)1438 dispatch(constexpr op_put_getter_setter_by_id_length) 1439 1439 1440 1440 … … 1442 1442 traceExecution() 1443 1443 callOpcodeSlowPath(_llint_slow_path_put_getter_by_val) 1444 dispatch( 5)1444 dispatch(constexpr op_put_getter_by_val_length) 1445 1445 1446 1446 … … 1448 1448 traceExecution() 1449 1449 callOpcodeSlowPath(_llint_slow_path_put_setter_by_val) 1450 dispatch( 5)1450 dispatch(constexpr op_put_setter_by_val_length) 1451 1451 1452 1452 … … 1454 1454 traceExecution() 1455 1455 callOpcodeSlowPath(_slow_path_define_data_property) 1456 dispatch( 5)1456 dispatch(constexpr op_define_data_property_length) 1457 1457 1458 1458 … … 1460 1460 traceExecution() 1461 1461 callOpcodeSlowPath(_slow_path_define_accessor_property) 1462 dispatch( 6)1462 dispatch(constexpr op_define_accessor_property_length) 1463 1463 1464 1464 … … 1544 1544 traceExecution() 1545 1545 checkSwitchToJITForLoop() 1546 dispatch( 1)1546 dispatch(constexpr op_loop_hint_length) 1547 1547 1548 1548 … … 1554 1554 btpnz t0, .handleTraps 1555 1555 .afterHandlingTraps: 1556 dispatch( 1)1556 dispatch(constexpr op_check_traps_length) 1557 1557 .handleTraps: 1558 1558 callTrapHandler(.throwHandler) … … 1575 1575 1576 1576 _llint_op_nop: 1577 dispatch( 1)1577 dispatch(constexpr op_nop_length) 1578 1578 1579 1579 … … 1587 1587 traceExecution() 1588 1588 callOpcodeSlowPath(_llint_slow_path_new_func_exp) 1589 dispatch( 4)1589 dispatch(constexpr op_new_func_exp_length) 1590 1590 1591 1591 _llint_op_new_generator_func_exp: 1592 1592 traceExecution() 1593 1593 callOpcodeSlowPath(_llint_slow_path_new_generator_func_exp) 1594 dispatch( 4)1594 dispatch(constexpr op_new_generator_func_exp_length) 1595 1595 1596 1596 _llint_op_new_async_func_exp: 1597 1597 traceExecution() 1598 1598 callSlowPath(_llint_slow_path_new_async_func_exp) 1599 dispatch( 4)1599 dispatch(constexpr op_new_async_func_exp_length) 1600 1600 1601 1601 … … 1603 1603 traceExecution() 1604 1604 callOpcodeSlowPath(_llint_slow_path_set_function_name) 1605 dispatch( 3)1605 dispatch(constexpr op_set_function_name_length) 1606 1606 1607 1607 _llint_op_call: … … 1709 1709 traceExecution() 1710 1710 callOpcodeSlowPath(_slow_path_strcat) 1711 dispatch( 4)1711 dispatch(constexpr op_strcat_length) 1712 1712 1713 1713 … … 1715 1715 traceExecution() 1716 1716 callOpcodeSlowPath(_slow_path_push_with_scope) 1717 dispatch( 4)1717 dispatch(constexpr op_push_with_scope_length) 1718 1718 1719 1719 … … 1721 1721 traceExecution() 1722 1722 callOpcodeSlowPath(_slow_path_assert) 1723 dispatch( 3)1723 dispatch(constexpr op_assert_length) 1724 1724 1725 1725 … … 1727 1727 traceExecution() 1728 1728 callOpcodeSlowPath(_slow_path_unreachable) 1729 dispatch( 1)1729 dispatch(constexpr op_unreachable_length) 1730 1730 1731 1731 … … 1737 1737 traceExecution() 1738 1738 callOpcodeSlowPath(_slow_path_create_lexical_environment) 1739 dispatch( 5)1739 dispatch(constexpr op_create_lexical_environment_length) 1740 1740 1741 1741 … … 1743 1743 traceExecution() 1744 1744 callOpcodeSlowPath(_llint_slow_path_throw) 1745 dispatch( 2)1745 dispatch(constexpr op_throw_length) 1746 1746 1747 1747 … … 1749 1749 traceExecution() 1750 1750 callOpcodeSlowPath(_slow_path_throw_static_error) 1751 dispatch( 3)1751 dispatch(constexpr op_throw_static_error_length) 1752 1752 1753 1753 … … 1759 1759 callOpcodeSlowPath(_llint_slow_path_debug) 1760 1760 .opDebugDone: 1761 dispatch( 3)1761 dispatch(constexpr op_debug_length) 1762 1762 1763 1763 … … 1772 1772 traceExecution() 1773 1773 callOpcodeSlowPath(_slow_path_get_enumerable_length) 1774 dispatch( 3)1774 dispatch(constexpr op_get_enumerable_length_length) 1775 1775 1776 1776 _llint_op_has_indexed_property: 1777 1777 traceExecution() 1778 1778 callOpcodeSlowPath(_slow_path_has_indexed_property) 1779 dispatch( 5)1779 dispatch(constexpr op_has_indexed_property_length) 1780 1780 1781 1781 _llint_op_has_structure_property: 1782 1782 traceExecution() 1783 1783 callOpcodeSlowPath(_slow_path_has_structure_property) 1784 dispatch( 5)1784 dispatch(constexpr op_has_structure_property_length) 1785 1785 1786 1786 _llint_op_has_generic_property: 1787 1787 traceExecution() 1788 1788 callOpcodeSlowPath(_slow_path_has_generic_property) 1789 dispatch( 4)1789 dispatch(constexpr op_has_generic_property_length) 1790 1790 1791 1791 _llint_op_get_direct_pname: 1792 1792 traceExecution() 1793 1793 callOpcodeSlowPath(_slow_path_get_direct_pname) 1794 dispatch( 7)1794 dispatch(constexpr op_get_direct_pname_length) 1795 1795 1796 1796 _llint_op_get_property_enumerator: 1797 1797 traceExecution() 1798 1798 callOpcodeSlowPath(_slow_path_get_property_enumerator) 1799 dispatch( 3)1799 dispatch(constexpr op_get_property_enumerator_length) 1800 1800 1801 1801 _llint_op_enumerator_structure_pname: 1802 1802 traceExecution() 1803 1803 callOpcodeSlowPath(_slow_path_next_structure_enumerator_pname) 1804 dispatch( 4)1804 dispatch(constexpr op_enumerator_structure_pname_length) 1805 1805 1806 1806 _llint_op_enumerator_generic_pname: 1807 1807 traceExecution() 1808 1808 callOpcodeSlowPath(_slow_path_next_generic_enumerator_pname) 1809 dispatch( 4)1809 dispatch(constexpr op_enumerator_generic_pname_length) 1810 1810 1811 1811 _llint_op_to_index_string: 1812 1812 traceExecution() 1813 1813 callOpcodeSlowPath(_slow_path_to_index_string) 1814 dispatch( 3)1814 dispatch(constexpr op_to_index_string_length) 1815 1815 1816 1816 _llint_op_create_rest: 1817 1817 traceExecution() 1818 1818 callOpcodeSlowPath(_slow_path_create_rest) 1819 dispatch( 4)1819 dispatch(constexpr op_create_rest_length) 1820 1820 1821 1821 _llint_op_instanceof: 1822 1822 traceExecution() 1823 1823 callOpcodeSlowPath(_llint_slow_path_instanceof) 1824 dispatch( 4)1824 dispatch(constexpr op_instanceof_length) 1825 1825 1826 1826 _llint_op_get_by_id_with_this: 1827 1827 traceExecution() 1828 1828 callOpcodeSlowPath(_slow_path_get_by_id_with_this) 1829 dispatch( 6)1829 dispatch(constexpr op_get_by_id_with_this_length) 1830 1830 1831 1831 _llint_op_get_by_val_with_this: 1832 1832 traceExecution() 1833 1833 callOpcodeSlowPath(_slow_path_get_by_val_with_this) 1834 dispatch( 6)1834 dispatch(constexpr op_get_by_val_with_this_length) 1835 1835 1836 1836 _llint_op_put_by_id_with_this: 1837 1837 traceExecution() 1838 1838 callOpcodeSlowPath(_slow_path_put_by_id_with_this) 1839 dispatch( 5)1839 dispatch(constexpr op_put_by_id_with_this_length) 1840 1840 1841 1841 _llint_op_put_by_val_with_this: 1842 1842 traceExecution() 1843 1843 callOpcodeSlowPath(_slow_path_put_by_val_with_this) 1844 dispatch( 5)1844 dispatch(constexpr op_put_by_val_with_this_length) 1845 1845 1846 1846 _llint_op_resolve_scope_for_hoisting_func_decl_in_eval: 1847 1847 traceExecution() 1848 1848 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) 1850 1850 1851 1851 # Lastly, make sure that we can link even though we don't support all opcodes. -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm
r218883 r220047 673 673 .opEnterDone: 674 674 callOpcodeSlowPath(_slow_path_enter) 675 dispatch( 1)675 dispatch(constexpr op_enter_length) 676 676 677 677 … … 687 687 storei t3, PayloadOffset[cfr, t1, 8] 688 688 valueProfile(t0, t3, 12, t1) 689 dispatch( 4)689 dispatch(constexpr op_get_argument_length) 690 690 691 691 .opGetArgumentOutOfBounds: … … 693 693 storei 0, PayloadOffset[cfr, t1, 8] 694 694 valueProfile(UndefinedTag, 0, 12, t1) 695 dispatch( 4)695 dispatch(constexpr op_get_argument_length) 696 696 697 697 … … 704 704 storei t1, TagOffset[cfr, t2, 8] 705 705 storei t0, PayloadOffset[cfr, t2, 8] 706 dispatch( 2)706 dispatch(constexpr op_argument_count_length) 707 707 708 708 … … 714 714 storei CellTag, TagOffset[cfr, t1, 8] 715 715 storei t0, PayloadOffset[cfr, t1, 8] 716 dispatch( 2)716 dispatch(constexpr op_get_scope_length) 717 717 718 718 … … 725 725 loadpFromInstruction(2, t2) 726 726 bpneq JSCell::m_structureID[t0], t2, .opToThisSlow 727 dispatch( 4)727 dispatch(constexpr op_to_this_length) 728 728 729 729 .opToThisSlow: 730 730 callOpcodeSlowPath(_slow_path_to_this) 731 dispatch( 4)731 dispatch(constexpr op_to_this_length) 732 732 733 733 … … 740 740 741 741 .opNotTDZ: 742 dispatch( 2)742 dispatch(constexpr op_check_tdz_length) 743 743 744 744 … … 750 750 storei t2, TagOffset[cfr, t0, 8] 751 751 storei t3, PayloadOffset[cfr, t0, 8] 752 dispatch( 3)752 dispatch(constexpr op_mov_length) 753 753 754 754 … … 762 762 storei t2, TagOffset[cfr, t1, 8] 763 763 storei t3, PayloadOffset[cfr, t1, 8] 764 dispatch( 3)764 dispatch(constexpr op_not_length) 765 765 766 766 .opNotSlow: 767 767 callOpcodeSlowPath(_slow_path_not) 768 dispatch( 3)768 dispatch(constexpr op_not_length) 769 769 770 770 … … 782 782 storei BooleanTag, TagOffset[cfr, t2, 8] 783 783 storei t0, PayloadOffset[cfr, t2, 8] 784 dispatch( 4)784 dispatch(constexpr op_eq_length) 785 785 786 786 .opEqSlow: 787 787 callOpcodeSlowPath(_slow_path_eq) 788 dispatch( 4)788 dispatch(constexpr op_eq_length) 789 789 790 790 … … 813 813 storei BooleanTag, TagOffset[cfr, t3, 8] 814 814 storei t1, PayloadOffset[cfr, t3, 8] 815 dispatch( 3)815 dispatch(constexpr op_eq_null_length) 816 816 817 817 … … 829 829 storei BooleanTag, TagOffset[cfr, t2, 8] 830 830 storei t0, PayloadOffset[cfr, t2, 8] 831 dispatch( 4)831 dispatch(constexpr op_neq_length) 832 832 833 833 .opNeqSlow: 834 834 callOpcodeSlowPath(_slow_path_neq) 835 dispatch( 4)835 dispatch(constexpr op_neq_length) 836 836 837 837 … … 860 860 storei BooleanTag, TagOffset[cfr, t3, 8] 861 861 storei t1, PayloadOffset[cfr, t3, 8] 862 dispatch( 3)862 dispatch(constexpr op_neq_null_length) 863 863 864 864 … … 902 902 baddio 1, t1, .opIncSlow 903 903 storei t1, PayloadOffset[cfr, t0, 8] 904 dispatch( 2)904 dispatch(constexpr op_inc_length) 905 905 906 906 .opIncSlow: 907 907 callOpcodeSlowPath(_slow_path_inc) 908 dispatch( 2)908 dispatch(constexpr op_inc_length) 909 909 910 910 … … 916 916 bsubio 1, t1, .opDecSlow 917 917 storei t1, PayloadOffset[cfr, t0, 8] 918 dispatch( 2)918 dispatch(constexpr op_dec_length) 919 919 920 920 .opDecSlow: 921 921 callOpcodeSlowPath(_slow_path_dec) 922 dispatch( 2)922 dispatch(constexpr op_dec_length) 923 923 924 924 … … 934 934 storei t3, PayloadOffset[cfr, t1, 8] 935 935 valueProfile(t2, t3, 12, t1) 936 dispatch( 4)936 dispatch(constexpr op_to_number_length) 937 937 938 938 .opToNumberSlow: 939 939 callOpcodeSlowPath(_slow_path_to_number) 940 dispatch( 4)940 dispatch(constexpr op_to_number_length) 941 941 942 942 … … 951 951 storei t2, TagOffset[cfr, t1, 8] 952 952 storei t3, PayloadOffset[cfr, t1, 8] 953 dispatch( 3)953 dispatch(constexpr op_to_string_length) 954 954 955 955 .opToStringSlow: 956 956 callOpcodeSlowPath(_slow_path_to_string) 957 dispatch( 3)957 dispatch(constexpr op_to_string_length) 958 958 959 959 … … 971 971 storeisToInstruction(t0, 3) 972 972 storei t2, PayloadOffset[cfr, t3, 8] 973 dispatch( 4)973 dispatch(constexpr op_negate_length) 974 974 .opNegateSrcNotInt: 975 975 bia t1, LowestTag, .opNegateSlow … … 979 979 storeisToInstruction(t0, 3) 980 980 storei t1, TagOffset[cfr, t3, 8] 981 dispatch( 4)981 dispatch(constexpr op_negate_length) 982 982 983 983 .opNegateSlow: 984 984 callOpcodeSlowPath(_slow_path_negate) 985 dispatch( 4)985 dispatch(constexpr op_negate_length) 986 986 987 987 … … 1126 1126 macro (left, right) lshifti left, right end, 1127 1127 _slow_path_lshift, 1128 4)1128 constexpr op_lshift_length) 1129 1129 1130 1130 … … 1134 1134 macro (left, right) rshifti left, right end, 1135 1135 _slow_path_rshift, 1136 4)1136 constexpr op_rshift_length) 1137 1137 1138 1138 … … 1142 1142 macro (left, right) urshifti left, right end, 1143 1143 _slow_path_urshift, 1144 4)1144 constexpr op_urshift_length) 1145 1145 1146 1146 … … 1153 1153 storei t2, PayloadOffset[cfr, t0, 8] 1154 1154 storei Int32Tag, TagOffset[cfr, t0, 8] 1155 dispatch( 3)1155 dispatch(constexpr op_unsigned_length) 1156 1156 .opUnsignedSlow: 1157 1157 callOpcodeSlowPath(_slow_path_unsigned) 1158 dispatch( 3)1158 dispatch(constexpr op_unsigned_length) 1159 1159 1160 1160 … … 1164 1164 macro (left, right) andi left, right end, 1165 1165 _slow_path_bitand, 1166 5)1166 constexpr op_bitand_length) 1167 1167 1168 1168 … … 1172 1172 macro (left, right) xori left, right end, 1173 1173 _slow_path_bitxor, 1174 5)1174 constexpr op_bitxor_length) 1175 1175 1176 1176 … … 1180 1180 macro (left, right) ori left, right end, 1181 1181 _slow_path_bitor, 1182 5)1182 constexpr op_bitor_length) 1183 1183 1184 1184 … … 1206 1206 tbz JSCell::m_flags[t1], ImplementsDefaultHasInstance, t0 1207 1207 storei t0, PayloadOffset[cfr, t3, 8] 1208 dispatch( 4)1208 dispatch(constexpr op_overrides_has_instance_length) 1209 1209 1210 1210 .opOverrideshasInstanceValueNotCell: 1211 1211 .opOverrideshasInstanceValueNotDefault: 1212 1212 storei 1, PayloadOffset[cfr, t3, 8] 1213 dispatch( 4)1213 dispatch(constexpr op_overrides_has_instance_length) 1214 1214 1215 1215 _llint_op_instanceof_custom: 1216 1216 traceExecution() 1217 1217 callOpcodeSlowPath(_llint_slow_path_instanceof_custom) 1218 dispatch( 5)1218 dispatch(constexpr op_instanceof_custom_length) 1219 1219 1220 1220 … … 1227 1227 storei BooleanTag, TagOffset[cfr, t0, 8] 1228 1228 storei t3, PayloadOffset[cfr, t0, 8] 1229 dispatch( 3)1229 dispatch(constexpr op_is_empty_length) 1230 1230 1231 1231 … … 1239 1239 cieq t2, UndefinedTag, t3 1240 1240 storei t3, PayloadOffset[cfr, t0, 8] 1241 dispatch( 3)1241 dispatch(constexpr op_is_undefined_length) 1242 1242 .opIsUndefinedCell: 1243 1243 btbnz JSCell::m_flags[t3], MasqueradesAsUndefined, .opIsUndefinedMasqueradesAsUndefined 1244 1244 move 0, t1 1245 1245 storei t1, PayloadOffset[cfr, t0, 8] 1246 dispatch( 3)1246 dispatch(constexpr op_is_undefined_length) 1247 1247 .opIsUndefinedMasqueradesAsUndefined: 1248 1248 loadp JSCell::m_structureID[t3], t1 … … 1251 1251 cpeq Structure::m_globalObject[t1], t3, t1 1252 1252 storei t1, PayloadOffset[cfr, t0, 8] 1253 dispatch( 3)1253 dispatch(constexpr op_is_undefined_length) 1254 1254 1255 1255 … … 1262 1262 storei BooleanTag, TagOffset[cfr, t2, 8] 1263 1263 storei t0, PayloadOffset[cfr, t2, 8] 1264 dispatch( 3)1264 dispatch(constexpr op_is_boolean_length) 1265 1265 1266 1266 … … 1274 1274 cib t0, LowestTag + 1, t1 1275 1275 storei t1, PayloadOffset[cfr, t2, 8] 1276 dispatch( 3)1276 dispatch(constexpr op_is_number_length) 1277 1277 1278 1278 … … 1287 1287 cbeq JSCell::m_type[t3], t0, t1 1288 1288 storei t1, PayloadOffset[cfr, t2, 8] 1289 dispatch( 4)1289 dispatch(constexpr op_is_cell_with_type_length) 1290 1290 .notCellCase: 1291 1291 storep 0, PayloadOffset[cfr, t2, 8] 1292 dispatch( 4)1292 dispatch(constexpr op_is_cell_with_type_length) 1293 1293 1294 1294 … … 1302 1302 cbaeq JSCell::m_type[t3], ObjectType, t1 1303 1303 storei t1, PayloadOffset[cfr, t2, 8] 1304 dispatch( 3)1304 dispatch(constexpr op_is_object_length) 1305 1305 .opIsObjectNotCell: 1306 1306 storep 0, PayloadOffset[cfr, t2, 8] 1307 dispatch( 3)1307 dispatch(constexpr op_is_object_length) 1308 1308 1309 1309 … … 1361 1361 storei t1, PayloadOffset[cfr, t2, 8] 1362 1362 valueProfile(t0, t1, 32, t2) 1363 dispatch( 9)1363 dispatch(constexpr op_get_by_id_length) 1364 1364 1365 1365 .opGetByIdSlow: 1366 1366 callOpcodeSlowPath(_llint_slow_path_get_by_id) 1367 dispatch( 9)1367 dispatch(constexpr op_get_by_id_length) 1368 1368 1369 1369 … … 1381 1381 storei t1, PayloadOffset[cfr, t2, 8] 1382 1382 valueProfile(t0, t1, 32, t2) 1383 dispatch( 9)1383 dispatch(constexpr op_get_by_id_proto_load_length) 1384 1384 1385 1385 .opGetByIdProtoSlow: 1386 1386 callOpcodeSlowPath(_llint_slow_path_get_by_id) 1387 dispatch( 9)1387 dispatch(constexpr op_get_by_id_proto_load_length) 1388 1388 1389 1389 … … 1398 1398 storei 0, PayloadOffset[cfr, t2, 8] 1399 1399 valueProfile(UndefinedTag, 0, 32, t2) 1400 dispatch( 9)1400 dispatch(constexpr op_get_by_id_unset_length) 1401 1401 1402 1402 .opGetByIdUnsetSlow: 1403 1403 callOpcodeSlowPath(_llint_slow_path_get_by_id) 1404 dispatch( 9)1404 dispatch(constexpr op_get_by_id_unset_length) 1405 1405 1406 1406 … … 1421 1421 storep t0, PayloadOffset[cfr, t1, 8] 1422 1422 storep Int32Tag, TagOffset[cfr, t1, 8] 1423 dispatch( 9)1423 dispatch(constexpr op_get_array_length_length) 1424 1424 1425 1425 .opGetArrayLengthSlow: 1426 1426 callOpcodeSlowPath(_llint_slow_path_get_by_id) 1427 dispatch( 9)1427 dispatch(constexpr op_get_array_length_length) 1428 1428 1429 1429 … … 1550 1550 storePropertyAtVariableOffset(t1, t0, t2, t3) 1551 1551 writeBarrierOnOperand(1) 1552 dispatch( 9)1552 dispatch(constexpr op_put_by_id_length) 1553 1553 1554 1554 .opPutByIdNotTransition: … … 1558 1558 loadi 20[PC], t1 1559 1559 storePropertyAtVariableOffset(t1, t0, t2, t3) 1560 dispatch( 9)1560 dispatch(constexpr op_put_by_id_length) 1561 1561 1562 1562 .opPutByIdSlow: 1563 1563 callOpcodeSlowPath(_llint_slow_path_put_by_id) 1564 dispatch( 9)1564 dispatch(constexpr op_put_by_id_length) 1565 1565 1566 1566 … … 1609 1609 storei t1, PayloadOffset[cfr, t0, 8] 1610 1610 valueProfile(t2, t1, 20, t0) 1611 dispatch( 6)1611 dispatch(constexpr op_get_by_val_length) 1612 1612 1613 1613 .opGetByValOutOfBounds: … … 1616 1616 .opGetByValSlow: 1617 1617 callOpcodeSlowPath(_llint_slow_path_get_by_val) 1618 dispatch( 6)1618 dispatch(constexpr op_get_by_val_length) 1619 1619 1620 1620 … … 1794 1794 dispatchBranch(12[PC]) 1795 1795 .opJneqPtrFallThrough: 1796 dispatch( 5)1796 dispatch(constexpr op_jneq_ptr_length) 1797 1797 1798 1798 … … 1953 1953 storei t1, TagOffset[cfr, t3, 8] 1954 1954 storei t0, PayloadOffset[cfr, t3, 8] 1955 dispatch( 3)1955 dispatch(constexpr op_to_primitive_length) 1956 1956 1957 1957 .opToPrimitiveSlowCase: 1958 1958 callOpcodeSlowPath(_slow_path_to_primitive) 1959 dispatch( 3)1959 dispatch(constexpr op_to_primitive_length) 1960 1960 1961 1961 -
trunk/Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
r218883 r220047 583 583 .opEnterDone: 584 584 callOpcodeSlowPath(_slow_path_enter) 585 dispatch( 1)585 dispatch(constexpr op_enter_length) 586 586 587 587 … … 595 595 storeq t0, [cfr, t1, 8] 596 596 valueProfile(t0, 3, t2) 597 dispatch( 4)597 dispatch(constexpr op_get_argument_length) 598 598 599 599 .opGetArgumentOutOfBounds: 600 600 storeq ValueUndefined, [cfr, t1, 8] 601 601 valueProfile(ValueUndefined, 3, t2) 602 dispatch( 4)602 dispatch(constexpr op_get_argument_length) 603 603 604 604 … … 610 610 orq TagTypeNumber, t0 611 611 storeq t0, [cfr, t1, 8] 612 dispatch( 2)612 dispatch(constexpr op_argument_count_length) 613 613 614 614 … … 619 619 loadisFromInstruction(1, t1) 620 620 storeq t0, [cfr, t1, 8] 621 dispatch( 2)621 dispatch(constexpr op_get_scope_length) 622 622 623 623 … … 631 631 loadpFromInstruction(2, t2) 632 632 bpneq t1, t2, .opToThisSlow 633 dispatch( 4)633 dispatch(constexpr op_to_this_length) 634 634 635 635 .opToThisSlow: 636 636 callOpcodeSlowPath(_slow_path_to_this) 637 dispatch( 4)637 dispatch(constexpr op_to_this_length) 638 638 639 639 … … 646 646 647 647 .opNotTDZ: 648 dispatch( 2)648 dispatch(constexpr op_check_tdz_length) 649 649 650 650 … … 655 655 loadConstantOrVariable(t1, t2) 656 656 storeq t2, [cfr, t0, 8] 657 dispatch( 3)657 dispatch(constexpr op_mov_length) 658 658 659 659 … … 667 667 xorq ValueTrue, t2 668 668 storeq t2, [cfr, t1, 8] 669 dispatch( 3)669 dispatch(constexpr op_not_length) 670 670 671 671 .opNotSlow: 672 672 callOpcodeSlowPath(_slow_path_not) 673 dispatch( 3)673 dispatch(constexpr op_not_length) 674 674 675 675 … … 728 728 orq ValueFalse, t0 729 729 storeq t0, [cfr, t1, 8] 730 dispatch( 3)730 dispatch(constexpr op_eq_null_length) 731 731 732 732 … … 737 737 xorq ValueTrue, t0 738 738 storeq t0, [cfr, t1, 8] 739 dispatch( 3)739 dispatch(constexpr op_neq_null_length) 740 740 741 741 … … 815 815 storeq t2, [cfr, t1, 8] 816 816 valueProfile(t2, 3, t0) 817 dispatch( 4)817 dispatch(constexpr op_to_number_length) 818 818 819 819 .opToNumberSlow: 820 820 callOpcodeSlowPath(_slow_path_to_number) 821 dispatch( 4)821 dispatch(constexpr op_to_number_length) 822 822 823 823 … … 831 831 .opToStringIsString: 832 832 storeq t0, [cfr, t2, 8] 833 dispatch( 3)833 dispatch(constexpr op_to_string_length) 834 834 835 835 .opToStringSlow: 836 836 callOpcodeSlowPath(_slow_path_to_string) 837 dispatch( 3)837 dispatch(constexpr op_to_string_length) 838 838 839 839 … … 851 851 storeisToInstruction(t2, 3) 852 852 storeq t3, [cfr, t1, 8] 853 dispatch( 4)853 dispatch(constexpr op_negate_length) 854 854 .opNegateNotInt: 855 855 btqz t3, tagTypeNumber, .opNegateSlow … … 858 858 storeq t3, [cfr, t1, 8] 859 859 storeisToInstruction(t2, 3) 860 dispatch( 4)860 dispatch(constexpr op_negate_length) 861 861 862 862 .opNegateSlow: 863 863 callOpcodeSlowPath(_slow_path_negate) 864 dispatch( 4)864 dispatch(constexpr op_negate_length) 865 865 866 866 … … 995 995 else 996 996 callOpcodeSlowPath(_slow_path_div) 997 dispatch( 5)997 dispatch(constexpr op_div_length) 998 998 end 999 999 … … 1022 1022 macro (left, right) lshifti left, right end, 1023 1023 _slow_path_lshift, 1024 4)1024 constexpr op_lshift_length) 1025 1025 1026 1026 … … 1030 1030 macro (left, right) rshifti left, right end, 1031 1031 _slow_path_rshift, 1032 4)1032 constexpr op_rshift_length) 1033 1033 1034 1034 … … 1038 1038 macro (left, right) urshifti left, right end, 1039 1039 _slow_path_urshift, 1040 4)1040 constexpr op_urshift_length) 1041 1041 1042 1042 … … 1048 1048 bilt t2, 0, .opUnsignedSlow 1049 1049 storeq t2, [cfr, t0, 8] 1050 dispatch( 3)1050 dispatch(constexpr op_unsigned_length) 1051 1051 .opUnsignedSlow: 1052 1052 callOpcodeSlowPath(_slow_path_unsigned) 1053 dispatch( 3)1053 dispatch(constexpr op_unsigned_length) 1054 1054 1055 1055 … … 1059 1059 macro (left, right) andi left, right end, 1060 1060 _slow_path_bitand, 1061 5)1061 constexpr op_bitand_length) 1062 1062 1063 1063 … … 1067 1067 macro (left, right) xori left, right end, 1068 1068 _slow_path_bitxor, 1069 5)1069 constexpr op_bitxor_length) 1070 1070 1071 1071 … … 1075 1075 macro (left, right) ori left, right end, 1076 1076 _slow_path_bitor, 1077 5)1077 constexpr op_bitor_length) 1078 1078 1079 1079 … … 1094 1094 orq ValueFalse, t1 1095 1095 storeq t1, [cfr, t3, 8] 1096 dispatch( 4)1096 dispatch(constexpr op_overrides_has_instance_length) 1097 1097 1098 1098 .opOverridesHasInstanceNotDefaultSymbol: 1099 1099 storeq ValueTrue, [cfr, t3, 8] 1100 dispatch( 4)1100 dispatch(constexpr op_overrides_has_instance_length) 1101 1101 1102 1102 … … 1104 1104 traceExecution() 1105 1105 callOpcodeSlowPath(_llint_slow_path_instanceof_custom) 1106 dispatch( 5)1106 dispatch(constexpr op_instanceof_custom_length) 1107 1107 1108 1108 … … 1115 1115 orq ValueFalse, t3 1116 1116 storeq t3, [cfr, t2, 8] 1117 dispatch( 3)1117 dispatch(constexpr op_is_empty_length) 1118 1118 1119 1119 … … 1127 1127 orq ValueFalse, t3 1128 1128 storeq t3, [cfr, t2, 8] 1129 dispatch( 3)1129 dispatch(constexpr op_is_undefined_length) 1130 1130 .opIsUndefinedCell: 1131 1131 btbnz JSCell::m_flags[t0], MasqueradesAsUndefined, .masqueradesAsUndefined 1132 1132 move ValueFalse, t1 1133 1133 storeq t1, [cfr, t2, 8] 1134 dispatch( 3)1134 dispatch(constexpr op_is_undefined_length) 1135 1135 .masqueradesAsUndefined: 1136 1136 loadStructureWithScratch(t0, t3, t1) … … 1140 1140 orq ValueFalse, t0 1141 1141 storeq t0, [cfr, t2, 8] 1142 dispatch( 3)1142 dispatch(constexpr op_is_undefined_length) 1143 1143 1144 1144 … … 1152 1152 orq ValueFalse, t0 1153 1153 storeq t0, [cfr, t2, 8] 1154 dispatch( 3)1154 dispatch(constexpr op_is_boolean_length) 1155 1155 1156 1156 … … 1163 1163 orq ValueFalse, t1 1164 1164 storeq t1, [cfr, t2, 8] 1165 dispatch( 3)1165 dispatch(constexpr op_is_number_length) 1166 1166 1167 1167 … … 1176 1176 orq ValueFalse, t1 1177 1177 storeq t1, [cfr, t2, 8] 1178 dispatch( 4)1178 dispatch(constexpr op_is_cell_with_type_length) 1179 1179 .notCellCase: 1180 1180 storeq ValueFalse, [cfr, t2, 8] 1181 dispatch( 4)1181 dispatch(constexpr op_is_cell_with_type_length) 1182 1182 1183 1183 … … 1191 1191 orq ValueFalse, t1 1192 1192 storeq t1, [cfr, t2, 8] 1193 dispatch( 3)1193 dispatch(constexpr op_is_object_length) 1194 1194 .opIsObjectNotCell: 1195 1195 storeq ValueFalse, [cfr, t2, 8] 1196 dispatch( 3)1196 dispatch(constexpr op_is_object_length) 1197 1197 1198 1198 … … 1234 1234 storeq t0, [cfr, t2, 8] 1235 1235 valueProfile(t0, 8, t1) 1236 dispatch( 9)1236 dispatch(constexpr op_get_by_id_length) 1237 1237 1238 1238 .opGetByIdSlow: 1239 1239 callOpcodeSlowPath(_llint_slow_path_get_by_id) 1240 dispatch( 9)1240 dispatch(constexpr op_get_by_id_length) 1241 1241 1242 1242 … … 1254 1254 storeq t0, [cfr, t2, 8] 1255 1255 valueProfile(t0, 8, t1) 1256 dispatch( 9)1256 dispatch(constexpr op_get_by_id_proto_load_length) 1257 1257 1258 1258 .opGetByIdProtoSlow: 1259 1259 callOpcodeSlowPath(_llint_slow_path_get_by_id) 1260 dispatch( 9)1260 dispatch(constexpr op_get_by_id_proto_load_length) 1261 1261 1262 1262 … … 1271 1271 storeq ValueUndefined, [cfr, t2, 8] 1272 1272 valueProfile(ValueUndefined, 8, t1) 1273 dispatch( 9)1273 dispatch(constexpr op_get_by_id_unset_length) 1274 1274 1275 1275 .opGetByIdUnsetSlow: 1276 1276 callOpcodeSlowPath(_llint_slow_path_get_by_id) 1277 dispatch( 9)1277 dispatch(constexpr op_get_by_id_unset_length) 1278 1278 1279 1279 … … 1294 1294 valueProfile(t0, 8, t2) 1295 1295 storeq t0, [cfr, t1, 8] 1296 dispatch( 9)1296 dispatch(constexpr op_get_array_length_length) 1297 1297 1298 1298 .opGetArrayLengthSlow: 1299 1299 callOpcodeSlowPath(_llint_slow_path_get_by_id) 1300 dispatch( 9)1300 dispatch(constexpr op_get_array_length_length) 1301 1301 1302 1302 … … 1437 1437 storePropertyAtVariableOffset(t1, t0, t2) 1438 1438 writeBarrierOnOperands(1, 3) 1439 dispatch( 9)1439 dispatch(constexpr op_put_by_id_length) 1440 1440 1441 1441 .opPutByIdSlow: 1442 1442 callOpcodeSlowPath(_llint_slow_path_put_by_id) 1443 dispatch( 9)1443 dispatch(constexpr op_put_by_id_length) 1444 1444 1445 1445 macro finishGetByVal(result, scratch) … … 1504 1504 storeq t2, [cfr, t0, 8] 1505 1505 valueProfile(t2, 5, t0) 1506 dispatch( 6)1506 dispatch(constexpr op_get_by_val_length) 1507 1507 1508 1508 .opGetByValOutOfBounds: … … 1580 1580 .opGetByValSlow: 1581 1581 callOpcodeSlowPath(_llint_slow_path_get_by_val) 1582 dispatch( 6)1582 dispatch(constexpr op_get_by_val_length) 1583 1583 1584 1584 … … 1918 1918 .opToPrimitiveIsImm: 1919 1919 storeq t0, [cfr, t3, 8] 1920 dispatch( 3)1920 dispatch(constexpr op_to_primitive_length) 1921 1921 1922 1922 .opToPrimitiveSlowCase: 1923 1923 callOpcodeSlowPath(_slow_path_to_primitive) 1924 dispatch( 3)1924 dispatch(constexpr op_to_primitive_length) 1925 1925 1926 1926 … … 1964 1964 1965 1965 traceExecution() 1966 dispatch( 3)1966 dispatch(constexpr op_catch_length) 1967 1967 1968 1968 … … 2076 2076 bineq t0, GlobalProperty, .rGlobalVar 2077 2077 getConstantScope(1) 2078 dispatch( 7)2078 dispatch(constexpr op_resolve_scope_length) 2079 2079 2080 2080 .rGlobalVar: 2081 2081 bineq t0, GlobalVar, .rGlobalLexicalVar 2082 2082 getConstantScope(1) 2083 dispatch( 7)2083 dispatch(constexpr op_resolve_scope_length) 2084 2084 2085 2085 .rGlobalLexicalVar: 2086 2086 bineq t0, GlobalLexicalVar, .rClosureVar 2087 2087 getConstantScope(1) 2088 dispatch( 7)2088 dispatch(constexpr op_resolve_scope_length) 2089 2089 2090 2090 .rClosureVar: 2091 2091 bineq t0, ClosureVar, .rModuleVar 2092 2092 resolveScope() 2093 dispatch( 7)2093 dispatch(constexpr op_resolve_scope_length) 2094 2094 2095 2095 .rModuleVar: 2096 2096 bineq t0, ModuleVar, .rGlobalPropertyWithVarInjectionChecks 2097 2097 getConstantScope(1) 2098 dispatch( 7)2098 dispatch(constexpr op_resolve_scope_length) 2099 2099 2100 2100 .rGlobalPropertyWithVarInjectionChecks: … … 2102 2102 varInjectionCheck(.rDynamic) 2103 2103 getConstantScope(1) 2104 dispatch( 7)2104 dispatch(constexpr op_resolve_scope_length) 2105 2105 2106 2106 .rGlobalVarWithVarInjectionChecks: … … 2108 2108 varInjectionCheck(.rDynamic) 2109 2109 getConstantScope(1) 2110 dispatch( 7)2110 dispatch(constexpr op_resolve_scope_length) 2111 2111 2112 2112 .rGlobalLexicalVarWithVarInjectionChecks: … … 2114 2114 varInjectionCheck(.rDynamic) 2115 2115 getConstantScope(1) 2116 dispatch( 7)2116 dispatch(constexpr op_resolve_scope_length) 2117 2117 2118 2118 .rClosureVarWithVarInjectionChecks: … … 2120 2120 varInjectionCheck(.rDynamic) 2121 2121 resolveScope() 2122 dispatch( 7)2122 dispatch(constexpr op_resolve_scope_length) 2123 2123 2124 2124 .rDynamic: 2125 2125 callOpcodeSlowPath(_slow_path_resolve_scope) 2126 dispatch( 7)2126 dispatch(constexpr op_resolve_scope_length) 2127 2127 2128 2128 … … 2169 2169 loadWithStructureCheck(2, .gDynamic) 2170 2170 getProperty() 2171 dispatch( 8)2171 dispatch(constexpr op_get_from_scope_length) 2172 2172 2173 2173 .gGlobalVar: 2174 2174 bineq t0, GlobalVar, .gGlobalLexicalVar 2175 2175 getGlobalVar(macro(v) end) 2176 dispatch( 8)2176 dispatch(constexpr op_get_from_scope_length) 2177 2177 2178 2178 .gGlobalLexicalVar: … … 2182 2182 bqeq value, ValueEmpty, .gDynamic 2183 2183 end) 2184 dispatch( 8)2184 dispatch(constexpr op_get_from_scope_length) 2185 2185 2186 2186 .gClosureVar: … … 2188 2188 loadVariable(2, t0) 2189 2189 getClosureVar() 2190 dispatch( 8)2190 dispatch(constexpr op_get_from_scope_length) 2191 2191 2192 2192 .gGlobalPropertyWithVarInjectionChecks: … … 2194 2194 loadWithStructureCheck(2, .gDynamic) 2195 2195 getProperty() 2196 dispatch( 8)2196 dispatch(constexpr op_get_from_scope_length) 2197 2197 2198 2198 .gGlobalVarWithVarInjectionChecks: … … 2200 2200 varInjectionCheck(.gDynamic) 2201 2201 getGlobalVar(macro(v) end) 2202 dispatch( 8)2202 dispatch(constexpr op_get_from_scope_length) 2203 2203 2204 2204 .gGlobalLexicalVarWithVarInjectionChecks: … … 2209 2209 bqeq value, ValueEmpty, .gDynamic 2210 2210 end) 2211 dispatch( 8)2211 dispatch(constexpr op_get_from_scope_length) 2212 2212 2213 2213 .gClosureVarWithVarInjectionChecks: … … 2216 2216 loadVariable(2, t0) 2217 2217 getClosureVar() 2218 dispatch( 8)2218 dispatch(constexpr op_get_from_scope_length) 2219 2219 2220 2220 .gDynamic: 2221 2221 callOpcodeSlowPath(_llint_slow_path_get_from_scope) 2222 dispatch( 8)2222 dispatch(constexpr op_get_from_scope_length) 2223 2223 2224 2224 … … 2279 2279 putLocalClosureVar() 2280 2280 writeBarrierOnOperands(1, 3) 2281 dispatch( 7)2281 dispatch(constexpr op_put_to_scope_length) 2282 2282 2283 2283 .pGlobalProperty: … … 2286 2286 putProperty() 2287 2287 writeBarrierOnOperands(1, 3) 2288 dispatch( 7)2288 dispatch(constexpr op_put_to_scope_length) 2289 2289 2290 2290 .pGlobalVar: … … 2292 2292 writeBarrierOnGlobalObject(3) 2293 2293 putGlobalVariable() 2294 dispatch( 7)2294 dispatch(constexpr op_put_to_scope_length) 2295 2295 2296 2296 .pGlobalLexicalVar: … … 2299 2299 checkTDZInGlobalPutToScopeIfNecessary() 2300 2300 putGlobalVariable() 2301 dispatch( 7)2301 dispatch(constexpr op_put_to_scope_length) 2302 2302 2303 2303 .pClosureVar: … … 2306 2306 putClosureVar() 2307 2307 writeBarrierOnOperands(1, 3) 2308 dispatch( 7)2308 dispatch(constexpr op_put_to_scope_length) 2309 2309 2310 2310 .pGlobalPropertyWithVarInjectionChecks: … … 2313 2313 putProperty() 2314 2314 writeBarrierOnOperands(1, 3) 2315 dispatch( 7)2315 dispatch(constexpr op_put_to_scope_length) 2316 2316 2317 2317 .pGlobalVarWithVarInjectionChecks: … … 2320 2320 varInjectionCheck(.pDynamic) 2321 2321 putGlobalVariable() 2322 dispatch( 7)2322 dispatch(constexpr op_put_to_scope_length) 2323 2323 2324 2324 .pGlobalLexicalVarWithVarInjectionChecks: … … 2328 2328 checkTDZInGlobalPutToScopeIfNecessary() 2329 2329 putGlobalVariable() 2330 dispatch( 7)2330 dispatch(constexpr op_put_to_scope_length) 2331 2331 2332 2332 .pClosureVarWithVarInjectionChecks: … … 2336 2336 putClosureVar() 2337 2337 writeBarrierOnOperands(1, 3) 2338 dispatch( 7)2338 dispatch(constexpr op_put_to_scope_length) 2339 2339 2340 2340 .pModuleVar: 2341 2341 bineq t0, ModuleVar, .pDynamic 2342 2342 callOpcodeSlowPath(_slow_path_throw_strict_mode_readonly_property_write_error) 2343 dispatch( 7)2343 dispatch(constexpr op_put_to_scope_length) 2344 2344 2345 2345 .pDynamic: 2346 2346 callOpcodeSlowPath(_llint_slow_path_put_to_scope) 2347 dispatch( 7)2347 dispatch(constexpr op_put_to_scope_length) 2348 2348 2349 2349 … … 2356 2356 loadisFromInstruction(1, t1) 2357 2357 storeq t0, [cfr, t1, 8] 2358 dispatch( 5)2358 dispatch(constexpr op_get_from_arguments_length) 2359 2359 2360 2360 … … 2367 2367 storeq t2, DirectArguments_storage[t0, t1, 8] 2368 2368 writeBarrierOnOperands(1, 3) 2369 dispatch( 4)2369 dispatch(constexpr op_put_to_arguments_length) 2370 2370 2371 2371 … … 2376 2376 loadisFromInstruction(1, t1) 2377 2377 storeq t0, [cfr, t1, 8] 2378 dispatch( 3)2378 dispatch(constexpr op_get_parent_scope_length) 2379 2379 2380 2380 … … 2417 2417 2418 2418 .opProfileTypeDone: 2419 dispatch( 6)2419 dispatch(constexpr op_profile_type_length) 2420 2420 2421 2421 _llint_op_profile_control_flow: … … 2423 2423 loadpFromInstruction(1, t0) 2424 2424 addq 1, BasicBlockLocation::m_executionCount[t0] 2425 dispatch( 2)2425 dispatch(constexpr op_profile_control_flow_length) 2426 2426 2427 2427 … … 2440 2440 loadisFromInstruction(1, t1) 2441 2441 storeq t0, [cfr, t1, 8] 2442 dispatch( 3)2442 dispatch(constexpr op_get_rest_length_length) 2443 2443 2444 2444 … … 2453 2453 loadVariable(1, t1) 2454 2454 storep t1, ShadowChicken::Packet::scope[t0] 2455 dispatch( 2)2455 dispatch(constexpr op_log_shadow_chicken_prologue_length) 2456 2456 .opLogShadowChickenPrologueSlow: 2457 2457 callOpcodeSlowPath(_llint_slow_path_log_shadow_chicken_prologue) 2458 dispatch( 2)2458 dispatch(constexpr op_log_shadow_chicken_prologue_length) 2459 2459 2460 2460 … … 2471 2471 storep t1, ShadowChicken::Packet::codeBlock[t0] 2472 2472 storei PC, ShadowChicken::Packet::callSiteIndex[t0] 2473 dispatch( 3)2473 dispatch(constexpr op_log_shadow_chicken_tail_length) 2474 2474 .opLogShadowChickenTailSlow: 2475 2475 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 316 316 rescue MissingMagicValuesException 317 317 $stderr.puts "offlineasm: No magic values found. Skipping assembly file generation." 318 exit 0318 exit 1 319 319 end 320 320 … … 367 367 end 368 368 369 lowLevelAST = lowLevelAST.resolve( *buildOffsetsMap(lowLevelAST, offsetsList))369 lowLevelAST = lowLevelAST.resolve(buildOffsetsMap(lowLevelAST, offsetsList)) 370 370 lowLevelAST.validate 371 371 emitCodeInConfiguration(concreteSettings, lowLevelAST, backend) { -
trunk/Source/JavaScriptCore/offlineasm/ast.rb
r172429 r220047 946 946 end 947 947 948 class 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 976 end 977 948 978 class ConstDecl < Node 949 979 attr_reader :variable, :value 950 980 951 981 def initialize(codeOrigin, variable, value) 952 982 super(codeOrigin) … … 954 984 @value = value 955 985 end 956 986 957 987 def children 958 988 [@variable, @value] 959 989 end 960 990 961 991 def mapChildren 962 992 ConstDecl.new(codeOrigin, (yield @variable), (yield @value)) 963 993 end 964 994 965 995 def dump 966 996 "const #{@variable.dump} = #{@value.dump}" -
trunk/Source/JavaScriptCore/offlineasm/generate_offset_extractor.rb
r194531 r220047 109 109 end 110 110 111 class ConstExpr 112 def offsetsPruneTo(sequence) 113 sequence.list << self 114 end 115 end 116 111 117 prunedAST = originalAST.offsetsPrune 112 118 … … 120 126 offsetsList = ast.filter(StructOffset).uniq.sort 121 127 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) 123 130 } 124 outp.puts "static const unsignedextractorTable[#{length}] = {"131 outp.puts "static const int64_t extractorTable[#{length}] = {" 125 132 emitCodeInAllConfigurations(prunedAST) { 126 133 | settings, ast, backend, index | … … 132 139 offsetsList = ast.filter(StructOffset).uniq.sort 133 140 sizesList = ast.filter(Sizeof).uniq.sort 134 141 constsList = ast.filter(ConstExpr).uniq.sort 142 135 143 emitMagicNumber 136 144 outp.puts "#{index}," … … 141 149 } 142 150 sizesList.each { 143 | offset|151 | sizeof | 144 152 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})," 146 159 } 147 160 } 148 161 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 149 175 } -
trunk/Source/JavaScriptCore/offlineasm/offsets.rb
r132590 r220047 25 25 require "ast" 26 26 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) ] 27 OFFSET_HEADER_MAGIC_NUMBERS = [ 0x2e43fd66, 0x4379bfba ] 28 OFFSET_MAGIC_NUMBERS = [ 0x5c577ac7, 0x0ff5e755 ] 36 29 37 30 # … … 47 40 # offsetsList(ast) 48 41 # 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. 51 45 # 52 46 … … 57 51 def sizesList(ast) 58 52 ast.filter(Sizeof).uniq.sort 53 end 54 55 def constsList(ast) 56 ast.filter(ConstExpr).uniq.sort 59 57 end 60 58 … … 74 72 if endianness == :little 75 73 # 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) 80 82 else 81 83 # 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) 86 92 end 93 if number > 0x7fffffff_ffffffff 94 number -= 1 << 64 95 end 96 number 87 97 end 88 98 … … 92 102 | number | 93 103 currentBytes = [] 94 4.times {104 8.times { 95 105 currentBytes << (number & 0xff) 96 106 number >>= 8 … … 171 181 172 182 # 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 188 def buildOffsetsMap(ast, extractedConstants) 189 map = {} 181 190 astOffsetsList = offsetsList(ast) 182 191 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 { 185 196 | structOffset, index | 186 offsetsMap[structOffset] = offsetsList.shift187 } 188 sizesList(ast).each_with_index {197 map[structOffset] = extractedConstants.shift 198 } 199 astSizesList.each_with_index { 189 200 | 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 208 end 209 -
trunk/Source/JavaScriptCore/offlineasm/parser.rb
r200125 r220047 4 4 # modification, are permitted provided that the following conditions 5 5 # are met: 6 # 1. Redistributions of source code must retain the above copyrigh t6 # 1. Redistributions of source code must retain the above copyrighht 7 7 # notice, this list of conditions and the following disclaimer. 8 8 # 2. Redistributions in binary form must reproduce the above copyright … … 223 223 224 224 def isKeyword(token) 225 token =~ /\A((true)|(false)|(if)|(then)|(else)|(elsif)|(end)|(and)|(or)|(not)|(global)|(macro)|(const)|( sizeof)|(error)|(include))\Z/ or225 token =~ /\A((true)|(false)|(if)|(then)|(else)|(elsif)|(end)|(and)|(or)|(not)|(global)|(macro)|(const)|(constexpr)|(sizeof)|(error)|(include))\Z/ or 226 226 token =~ REGISTER_PATTERN or 227 227 isInstruction(token) … … 418 418 [codeOrigin, names] 419 419 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 420 444 421 445 def parseExpressionAtom … … 454 478 codeOrigin, names = parseColonColon 455 479 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) 456 491 elsif isLabel @tokens[@idx] 457 492 result = LabelReference.new(@tokens[@idx].codeOrigin, Label.forName(@tokens[@idx].codeOrigin, @tokens[@idx].string)) … … 482 517 483 518 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] == "(" 485 520 end 486 521 -
trunk/Source/JavaScriptCore/offlineasm/transform.rb
r172429 r220047 250 250 251 251 class 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) 256 256 } 257 257 end … … 259 259 260 260 class 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]) 264 264 else 265 self 265 puts "Could not find #{self.inspect} in #{constantsMap.keys.inspect}" 266 puts "sizes = #{constantsMap.inspect}" 267 raise 266 268 end 267 269 end … … 269 271 270 272 class 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]) 274 276 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 282 end 283 284 class 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 278 292 end 279 293 end … … 378 392 379 393 class Node 380 def resolve( offsets, sizes)381 demacroify({}).resolveOffsets( offsets, sizes).fold394 def resolve(constantsMap) 395 demacroify({}).resolveOffsets(constantsMap).fold 382 396 end 383 397 end
Note:
See TracChangeset
for help on using the changeset viewer.