| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 // heap.cc and mark-compact.cc. | 448 // heap.cc and mark-compact.cc. |
| 449 const uint32_t kShortcutTypeMask = | 449 const uint32_t kShortcutTypeMask = |
| 450 kIsNotStringMask | | 450 kIsNotStringMask | |
| 451 kIsSymbolMask | | 451 kIsSymbolMask | |
| 452 kStringRepresentationMask; | 452 kStringRepresentationMask; |
| 453 const uint32_t kShortcutTypeTag = kConsStringTag; | 453 const uint32_t kShortcutTypeTag = kConsStringTag; |
| 454 | 454 |
| 455 | 455 |
| 456 enum InstanceType { | 456 enum InstanceType { |
| 457 // String types. | 457 // String types. |
| 458 // FIRST_STRING_TYPE |
| 458 SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | kSeqStringTag, | 459 SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | kSeqStringTag, |
| 459 ASCII_SYMBOL_TYPE = kAsciiStringTag | kSymbolTag | kSeqStringTag, | 460 ASCII_SYMBOL_TYPE = kAsciiStringTag | kSymbolTag | kSeqStringTag, |
| 460 CONS_SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | kConsStringTag, | 461 CONS_SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | kConsStringTag, |
| 461 CONS_ASCII_SYMBOL_TYPE = kAsciiStringTag | kSymbolTag | kConsStringTag, | 462 CONS_ASCII_SYMBOL_TYPE = kAsciiStringTag | kSymbolTag | kConsStringTag, |
| 462 EXTERNAL_SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | kExternalStringTag, | 463 EXTERNAL_SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | kExternalStringTag, |
| 463 EXTERNAL_SYMBOL_WITH_ASCII_DATA_TYPE = | 464 EXTERNAL_SYMBOL_WITH_ASCII_DATA_TYPE = |
| 464 kTwoByteStringTag | kSymbolTag | kExternalStringTag | kAsciiDataHintTag, | 465 kTwoByteStringTag | kSymbolTag | kExternalStringTag | kAsciiDataHintTag, |
| 465 EXTERNAL_ASCII_SYMBOL_TYPE = | 466 EXTERNAL_ASCII_SYMBOL_TYPE = |
| 466 kAsciiStringTag | kSymbolTag | kExternalStringTag, | 467 kAsciiStringTag | kSymbolTag | kExternalStringTag, |
| 467 STRING_TYPE = kTwoByteStringTag | kSeqStringTag, | 468 STRING_TYPE = kTwoByteStringTag | kSeqStringTag, |
| 468 ASCII_STRING_TYPE = kAsciiStringTag | kSeqStringTag, | 469 ASCII_STRING_TYPE = kAsciiStringTag | kSeqStringTag, |
| 469 CONS_STRING_TYPE = kTwoByteStringTag | kConsStringTag, | 470 CONS_STRING_TYPE = kTwoByteStringTag | kConsStringTag, |
| 470 CONS_ASCII_STRING_TYPE = kAsciiStringTag | kConsStringTag, | 471 CONS_ASCII_STRING_TYPE = kAsciiStringTag | kConsStringTag, |
| 471 EXTERNAL_STRING_TYPE = kTwoByteStringTag | kExternalStringTag, | 472 EXTERNAL_STRING_TYPE = kTwoByteStringTag | kExternalStringTag, |
| 472 EXTERNAL_STRING_WITH_ASCII_DATA_TYPE = | 473 EXTERNAL_STRING_WITH_ASCII_DATA_TYPE = |
| 473 kTwoByteStringTag | kExternalStringTag | kAsciiDataHintTag, | 474 kTwoByteStringTag | kExternalStringTag | kAsciiDataHintTag, |
| 475 // LAST_STRING_TYPE |
| 474 EXTERNAL_ASCII_STRING_TYPE = kAsciiStringTag | kExternalStringTag, | 476 EXTERNAL_ASCII_STRING_TYPE = kAsciiStringTag | kExternalStringTag, |
| 475 PRIVATE_EXTERNAL_ASCII_STRING_TYPE = EXTERNAL_ASCII_STRING_TYPE, | 477 PRIVATE_EXTERNAL_ASCII_STRING_TYPE = EXTERNAL_ASCII_STRING_TYPE, |
| 476 | 478 |
| 477 // Objects allocated in their own spaces (never in new space). | 479 // Objects allocated in their own spaces (never in new space). |
| 478 MAP_TYPE = kNotStringTag, // FIRST_NONSTRING_TYPE | 480 MAP_TYPE = kNotStringTag, // FIRST_NONSTRING_TYPE |
| 479 CODE_TYPE, | 481 CODE_TYPE, |
| 480 ODDBALL_TYPE, | 482 ODDBALL_TYPE, |
| 481 JS_GLOBAL_PROPERTY_CELL_TYPE, | 483 JS_GLOBAL_PROPERTY_CELL_TYPE, |
| 482 | 484 |
| 483 // "Data", objects that cannot contain non-map-word pointers to heap | 485 // "Data", objects that cannot contain non-map-word pointers to heap |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 FIXED_ARRAY_TYPE, | 518 FIXED_ARRAY_TYPE, |
| 517 SHARED_FUNCTION_INFO_TYPE, | 519 SHARED_FUNCTION_INFO_TYPE, |
| 518 | 520 |
| 519 JS_VALUE_TYPE, // FIRST_JS_OBJECT_TYPE | 521 JS_VALUE_TYPE, // FIRST_JS_OBJECT_TYPE |
| 520 JS_OBJECT_TYPE, | 522 JS_OBJECT_TYPE, |
| 521 JS_CONTEXT_EXTENSION_OBJECT_TYPE, | 523 JS_CONTEXT_EXTENSION_OBJECT_TYPE, |
| 522 JS_GLOBAL_OBJECT_TYPE, | 524 JS_GLOBAL_OBJECT_TYPE, |
| 523 JS_BUILTINS_OBJECT_TYPE, | 525 JS_BUILTINS_OBJECT_TYPE, |
| 524 JS_GLOBAL_PROXY_TYPE, | 526 JS_GLOBAL_PROXY_TYPE, |
| 525 JS_ARRAY_TYPE, | 527 JS_ARRAY_TYPE, |
| 526 JS_REGEXP_TYPE, // LAST_JS_OBJECT_TYPE | 528 |
| 529 JS_REGEXP_TYPE, // LAST_JS_OBJECT_TYPE, FIRST_FUNCTION_CLASS_TYPE |
| 527 | 530 |
| 528 JS_FUNCTION_TYPE, | 531 JS_FUNCTION_TYPE, |
| 529 | 532 |
| 530 // Pseudo-types | 533 // Pseudo-types |
| 531 FIRST_TYPE = 0x0, | 534 FIRST_TYPE = 0x0, |
| 532 LAST_TYPE = JS_FUNCTION_TYPE, | 535 LAST_TYPE = JS_FUNCTION_TYPE, |
| 533 INVALID_TYPE = FIRST_TYPE - 1, | 536 INVALID_TYPE = FIRST_TYPE - 1, |
| 534 FIRST_NONSTRING_TYPE = MAP_TYPE, | 537 FIRST_NONSTRING_TYPE = MAP_TYPE, |
| 538 FIRST_STRING_TYPE = FIRST_TYPE, |
| 539 LAST_STRING_TYPE = FIRST_NONSTRING_TYPE - 1, |
| 535 // Boundaries for testing for an external array. | 540 // Boundaries for testing for an external array. |
| 536 FIRST_EXTERNAL_ARRAY_TYPE = EXTERNAL_BYTE_ARRAY_TYPE, | 541 FIRST_EXTERNAL_ARRAY_TYPE = EXTERNAL_BYTE_ARRAY_TYPE, |
| 537 LAST_EXTERNAL_ARRAY_TYPE = EXTERNAL_FLOAT_ARRAY_TYPE, | 542 LAST_EXTERNAL_ARRAY_TYPE = EXTERNAL_FLOAT_ARRAY_TYPE, |
| 538 // Boundary for promotion to old data space/old pointer space. | 543 // Boundary for promotion to old data space/old pointer space. |
| 539 LAST_DATA_TYPE = FILLER_TYPE, | 544 LAST_DATA_TYPE = FILLER_TYPE, |
| 540 // Boundaries for testing the type is a JavaScript "object". Note that | 545 // Boundaries for testing the type is a JavaScript "object". Note that |
| 541 // function objects are not counted as objects, even though they are | 546 // function objects are not counted as objects, even though they are |
| 542 // implemented as such; only values whose typeof is "object" are included. | 547 // implemented as such; only values whose typeof is "object" are included. |
| 543 FIRST_JS_OBJECT_TYPE = JS_VALUE_TYPE, | 548 FIRST_JS_OBJECT_TYPE = JS_VALUE_TYPE, |
| 544 LAST_JS_OBJECT_TYPE = JS_REGEXP_TYPE | 549 LAST_JS_OBJECT_TYPE = JS_REGEXP_TYPE, |
| 550 // RegExp objects have [[Class]] "function" because they are callable. |
| 551 // All types from this type and above are objects with [[Class]] "function". |
| 552 FIRST_FUNCTION_CLASS_TYPE = JS_REGEXP_TYPE |
| 545 }; | 553 }; |
| 546 | 554 |
| 547 | 555 |
| 548 STATIC_CHECK(JS_OBJECT_TYPE == Internals::kJSObjectType); | 556 STATIC_CHECK(JS_OBJECT_TYPE == Internals::kJSObjectType); |
| 549 STATIC_CHECK(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType); | 557 STATIC_CHECK(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType); |
| 550 STATIC_CHECK(PROXY_TYPE == Internals::kProxyType); | 558 STATIC_CHECK(PROXY_TYPE == Internals::kProxyType); |
| 551 | 559 |
| 552 | 560 |
| 553 enum CompareResult { | 561 enum CompareResult { |
| 554 LESS = -1, | 562 LESS = -1, |
| (...skipping 3504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4059 // Currently it either has FunctionTemplateInfo to make benefit the API | 4067 // Currently it either has FunctionTemplateInfo to make benefit the API |
| 4060 // or Smi identifying a builtin function. | 4068 // or Smi identifying a builtin function. |
| 4061 // In the long run we don't want all functions to have this field but | 4069 // In the long run we don't want all functions to have this field but |
| 4062 // we can fix that when we have a better model for storing hidden data | 4070 // we can fix that when we have a better model for storing hidden data |
| 4063 // on objects. | 4071 // on objects. |
| 4064 DECL_ACCESSORS(function_data, Object) | 4072 DECL_ACCESSORS(function_data, Object) |
| 4065 | 4073 |
| 4066 inline bool IsApiFunction(); | 4074 inline bool IsApiFunction(); |
| 4067 inline FunctionTemplateInfo* get_api_func_data(); | 4075 inline FunctionTemplateInfo* get_api_func_data(); |
| 4068 inline bool HasBuiltinFunctionId(); | 4076 inline bool HasBuiltinFunctionId(); |
| 4069 inline bool IsBuiltinMathFunction(); | |
| 4070 inline BuiltinFunctionId builtin_function_id(); | 4077 inline BuiltinFunctionId builtin_function_id(); |
| 4071 | 4078 |
| 4072 // [script info]: Script from which the function originates. | 4079 // [script info]: Script from which the function originates. |
| 4073 DECL_ACCESSORS(script, Object) | 4080 DECL_ACCESSORS(script, Object) |
| 4074 | 4081 |
| 4075 // [num_literals]: Number of literals used by this function. | 4082 // [num_literals]: Number of literals used by this function. |
| 4076 inline int num_literals(); | 4083 inline int num_literals(); |
| 4077 inline void set_num_literals(int value); | 4084 inline void set_num_literals(int value); |
| 4078 | 4085 |
| 4079 // [start_position_and_type]: Field used to store both the source code | 4086 // [start_position_and_type]: Field used to store both the source code |
| (...skipping 2337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6417 } else { | 6424 } else { |
| 6418 value &= ~(1 << bit_position); | 6425 value &= ~(1 << bit_position); |
| 6419 } | 6426 } |
| 6420 return value; | 6427 return value; |
| 6421 } | 6428 } |
| 6422 }; | 6429 }; |
| 6423 | 6430 |
| 6424 } } // namespace v8::internal | 6431 } } // namespace v8::internal |
| 6425 | 6432 |
| 6426 #endif // V8_OBJECTS_H_ | 6433 #endif // V8_OBJECTS_H_ |
| OLD | NEW |