| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 10 matching lines...) Expand all Loading... |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_OBJECTS_H_ | 28 #ifndef V8_OBJECTS_H_ |
| 29 #define V8_OBJECTS_H_ | 29 #define V8_OBJECTS_H_ |
| 30 | 30 |
| 31 #include "allocation.h" |
| 31 #include "builtins.h" | 32 #include "builtins.h" |
| 33 #include "list.h" |
| 32 #include "smart-pointer.h" | 34 #include "smart-pointer.h" |
| 33 #include "unicode-inl.h" | 35 #include "unicode-inl.h" |
| 34 #if V8_TARGET_ARCH_ARM | 36 #if V8_TARGET_ARCH_ARM |
| 35 #include "arm/constants-arm.h" | 37 #include "arm/constants-arm.h" |
| 36 #elif V8_TARGET_ARCH_MIPS | 38 #elif V8_TARGET_ARCH_MIPS |
| 37 #include "mips/constants-mips.h" | 39 #include "mips/constants-mips.h" |
| 38 #endif | 40 #endif |
| 39 #include "v8checks.h" | 41 #include "v8checks.h" |
| 40 | 42 |
| 41 // | 43 // |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 // - SeqAsciiString | 86 // - SeqAsciiString |
| 85 // - SeqTwoByteString | 87 // - SeqTwoByteString |
| 86 // - ConsString | 88 // - ConsString |
| 87 // - ExternalString | 89 // - ExternalString |
| 88 // - ExternalAsciiString | 90 // - ExternalAsciiString |
| 89 // - ExternalTwoByteString | 91 // - ExternalTwoByteString |
| 90 // - HeapNumber | 92 // - HeapNumber |
| 91 // - Code | 93 // - Code |
| 92 // - Map | 94 // - Map |
| 93 // - Oddball | 95 // - Oddball |
| 96 // - JSProxy |
| 94 // - Proxy | 97 // - Proxy |
| 95 // - SharedFunctionInfo | 98 // - SharedFunctionInfo |
| 96 // - Struct | 99 // - Struct |
| 97 // - AccessorInfo | 100 // - AccessorInfo |
| 98 // - AccessCheckInfo | 101 // - AccessCheckInfo |
| 99 // - InterceptorInfo | 102 // - InterceptorInfo |
| 100 // - CallHandlerInfo | 103 // - CallHandlerInfo |
| 101 // - TemplateInfo | 104 // - TemplateInfo |
| 102 // - FunctionTemplateInfo | 105 // - FunctionTemplateInfo |
| 103 // - ObjectTemplateInfo | 106 // - ObjectTemplateInfo |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 V(EXTERNAL_STRING_WITH_ASCII_DATA_TYPE) \ | 284 V(EXTERNAL_STRING_WITH_ASCII_DATA_TYPE) \ |
| 282 V(EXTERNAL_ASCII_STRING_TYPE) \ | 285 V(EXTERNAL_ASCII_STRING_TYPE) \ |
| 283 V(PRIVATE_EXTERNAL_ASCII_STRING_TYPE) \ | 286 V(PRIVATE_EXTERNAL_ASCII_STRING_TYPE) \ |
| 284 \ | 287 \ |
| 285 V(MAP_TYPE) \ | 288 V(MAP_TYPE) \ |
| 286 V(CODE_TYPE) \ | 289 V(CODE_TYPE) \ |
| 287 V(ODDBALL_TYPE) \ | 290 V(ODDBALL_TYPE) \ |
| 288 V(JS_GLOBAL_PROPERTY_CELL_TYPE) \ | 291 V(JS_GLOBAL_PROPERTY_CELL_TYPE) \ |
| 289 \ | 292 \ |
| 290 V(HEAP_NUMBER_TYPE) \ | 293 V(HEAP_NUMBER_TYPE) \ |
| 294 V(JS_PROXY_TYPE) \ |
| 291 V(PROXY_TYPE) \ | 295 V(PROXY_TYPE) \ |
| 292 V(BYTE_ARRAY_TYPE) \ | 296 V(BYTE_ARRAY_TYPE) \ |
| 293 V(FREE_SPACE_TYPE) \ | 297 V(FREE_SPACE_TYPE) \ |
| 294 /* Note: the order of these external array */ \ | 298 /* Note: the order of these external array */ \ |
| 295 /* types is relied upon in */ \ | 299 /* types is relied upon in */ \ |
| 296 /* Object::IsExternalArray(). */ \ | 300 /* Object::IsExternalArray(). */ \ |
| 297 V(EXTERNAL_BYTE_ARRAY_TYPE) \ | 301 V(EXTERNAL_BYTE_ARRAY_TYPE) \ |
| 298 V(EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE) \ | 302 V(EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE) \ |
| 299 V(EXTERNAL_SHORT_ARRAY_TYPE) \ | 303 V(EXTERNAL_SHORT_ARRAY_TYPE) \ |
| 300 V(EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE) \ | 304 V(EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE) \ |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 // heap.cc and mark-compact.cc. | 484 // heap.cc and mark-compact.cc. |
| 481 const uint32_t kShortcutTypeMask = | 485 const uint32_t kShortcutTypeMask = |
| 482 kIsNotStringMask | | 486 kIsNotStringMask | |
| 483 kIsSymbolMask | | 487 kIsSymbolMask | |
| 484 kStringRepresentationMask; | 488 kStringRepresentationMask; |
| 485 const uint32_t kShortcutTypeTag = kConsStringTag; | 489 const uint32_t kShortcutTypeTag = kConsStringTag; |
| 486 | 490 |
| 487 | 491 |
| 488 enum InstanceType { | 492 enum InstanceType { |
| 489 // String types. | 493 // String types. |
| 490 // FIRST_STRING_TYPE | |
| 491 SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | kSeqStringTag, | 494 SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | kSeqStringTag, |
| 492 ASCII_SYMBOL_TYPE = kAsciiStringTag | kSymbolTag | kSeqStringTag, | 495 ASCII_SYMBOL_TYPE = kAsciiStringTag | kSymbolTag | kSeqStringTag, |
| 493 CONS_SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | kConsStringTag, | 496 CONS_SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | kConsStringTag, |
| 494 CONS_ASCII_SYMBOL_TYPE = kAsciiStringTag | kSymbolTag | kConsStringTag, | 497 CONS_ASCII_SYMBOL_TYPE = kAsciiStringTag | kSymbolTag | kConsStringTag, |
| 495 EXTERNAL_SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | kExternalStringTag, | 498 EXTERNAL_SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | kExternalStringTag, |
| 496 EXTERNAL_SYMBOL_WITH_ASCII_DATA_TYPE = | 499 EXTERNAL_SYMBOL_WITH_ASCII_DATA_TYPE = |
| 497 kTwoByteStringTag | kSymbolTag | kExternalStringTag | kAsciiDataHintTag, | 500 kTwoByteStringTag | kSymbolTag | kExternalStringTag | kAsciiDataHintTag, |
| 498 EXTERNAL_ASCII_SYMBOL_TYPE = | 501 EXTERNAL_ASCII_SYMBOL_TYPE = |
| 499 kAsciiStringTag | kSymbolTag | kExternalStringTag, | 502 kAsciiStringTag | kSymbolTag | kExternalStringTag, |
| 500 STRING_TYPE = kTwoByteStringTag | kSeqStringTag, | 503 STRING_TYPE = kTwoByteStringTag | kSeqStringTag, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 511 // Objects allocated in their own spaces (never in new space). | 514 // Objects allocated in their own spaces (never in new space). |
| 512 MAP_TYPE = kNotStringTag, // FIRST_NONSTRING_TYPE | 515 MAP_TYPE = kNotStringTag, // FIRST_NONSTRING_TYPE |
| 513 CODE_TYPE, | 516 CODE_TYPE, |
| 514 ODDBALL_TYPE, | 517 ODDBALL_TYPE, |
| 515 JS_GLOBAL_PROPERTY_CELL_TYPE, | 518 JS_GLOBAL_PROPERTY_CELL_TYPE, |
| 516 | 519 |
| 517 // "Data", objects that cannot contain non-map-word pointers to heap | 520 // "Data", objects that cannot contain non-map-word pointers to heap |
| 518 // objects. | 521 // objects. |
| 519 HEAP_NUMBER_TYPE, | 522 HEAP_NUMBER_TYPE, |
| 520 PROXY_TYPE, | 523 PROXY_TYPE, |
| 524 JS_PROXY_TYPE, |
| 521 BYTE_ARRAY_TYPE, | 525 BYTE_ARRAY_TYPE, |
| 522 FREE_SPACE_TYPE, | 526 FREE_SPACE_TYPE, |
| 523 EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE | 527 EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE |
| 524 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE, | 528 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE, |
| 525 EXTERNAL_SHORT_ARRAY_TYPE, | 529 EXTERNAL_SHORT_ARRAY_TYPE, |
| 526 EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE, | 530 EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE, |
| 527 EXTERNAL_INT_ARRAY_TYPE, | 531 EXTERNAL_INT_ARRAY_TYPE, |
| 528 EXTERNAL_UNSIGNED_INT_ARRAY_TYPE, | 532 EXTERNAL_UNSIGNED_INT_ARRAY_TYPE, |
| 529 EXTERNAL_FLOAT_ARRAY_TYPE, | 533 EXTERNAL_FLOAT_ARRAY_TYPE, |
| 530 EXTERNAL_DOUBLE_ARRAY_TYPE, | 534 EXTERNAL_DOUBLE_ARRAY_TYPE, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 | 568 |
| 565 JS_REGEXP_TYPE, // LAST_JS_OBJECT_TYPE, FIRST_FUNCTION_CLASS_TYPE | 569 JS_REGEXP_TYPE, // LAST_JS_OBJECT_TYPE, FIRST_FUNCTION_CLASS_TYPE |
| 566 | 570 |
| 567 JS_FUNCTION_TYPE, | 571 JS_FUNCTION_TYPE, |
| 568 | 572 |
| 569 // Pseudo-types | 573 // Pseudo-types |
| 570 FIRST_TYPE = 0x0, | 574 FIRST_TYPE = 0x0, |
| 571 LAST_TYPE = JS_FUNCTION_TYPE, | 575 LAST_TYPE = JS_FUNCTION_TYPE, |
| 572 INVALID_TYPE = FIRST_TYPE - 1, | 576 INVALID_TYPE = FIRST_TYPE - 1, |
| 573 FIRST_NONSTRING_TYPE = MAP_TYPE, | 577 FIRST_NONSTRING_TYPE = MAP_TYPE, |
| 574 FIRST_STRING_TYPE = FIRST_TYPE, | |
| 575 LAST_STRING_TYPE = FIRST_NONSTRING_TYPE - 1, | |
| 576 // Boundaries for testing for an external array. | 578 // Boundaries for testing for an external array. |
| 577 FIRST_EXTERNAL_ARRAY_TYPE = EXTERNAL_BYTE_ARRAY_TYPE, | 579 FIRST_EXTERNAL_ARRAY_TYPE = EXTERNAL_BYTE_ARRAY_TYPE, |
| 578 LAST_EXTERNAL_ARRAY_TYPE = EXTERNAL_PIXEL_ARRAY_TYPE, | 580 LAST_EXTERNAL_ARRAY_TYPE = EXTERNAL_PIXEL_ARRAY_TYPE, |
| 579 // Boundary for promotion to old data space/old pointer space. | 581 // Boundary for promotion to old data space/old pointer space. |
| 580 LAST_DATA_TYPE = FILLER_TYPE, | 582 LAST_DATA_TYPE = FILLER_TYPE, |
| 581 // Boundaries for testing the type is a JavaScript "object". Note that | 583 // Boundaries for testing the type is a JavaScript "object". Note that |
| 582 // function objects are not counted as objects, even though they are | 584 // function objects are not counted as objects, even though they are |
| 583 // implemented as such; only values whose typeof is "object" are included. | 585 // implemented as such; only values whose typeof is "object" are included. |
| 584 FIRST_JS_OBJECT_TYPE = JS_VALUE_TYPE, | 586 FIRST_JS_OBJECT_TYPE = JS_VALUE_TYPE, |
| 585 LAST_JS_OBJECT_TYPE = JS_REGEXP_TYPE, | 587 LAST_JS_OBJECT_TYPE = JS_REGEXP_TYPE, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 624 InstanceType type; | 626 InstanceType type; |
| 625 Object* ptr; | 627 Object* ptr; |
| 626 const char* str; | 628 const char* str; |
| 627 double number; | 629 double number; |
| 628 }; | 630 }; |
| 629 | 631 |
| 630 | 632 |
| 631 // A template-ized version of the IsXXX functions. | 633 // A template-ized version of the IsXXX functions. |
| 632 template <class C> static inline bool Is(Object* obj); | 634 template <class C> static inline bool Is(Object* obj); |
| 633 | 635 |
| 636 class Failure; |
| 634 | 637 |
| 635 class MaybeObject BASE_EMBEDDED { | 638 class MaybeObject BASE_EMBEDDED { |
| 636 public: | 639 public: |
| 637 inline bool IsFailure(); | 640 inline bool IsFailure(); |
| 638 inline bool IsRetryAfterGC(); | 641 inline bool IsRetryAfterGC(); |
| 639 inline bool IsOutOfMemory(); | 642 inline bool IsOutOfMemory(); |
| 640 inline bool IsException(); | 643 inline bool IsException(); |
| 641 INLINE(bool IsTheHole()); | 644 INLINE(bool IsTheHole()); |
| 642 inline bool ToObject(Object** obj) { | 645 inline bool ToObject(Object** obj) { |
| 643 if (IsFailure()) return false; | 646 if (IsFailure()) return false; |
| 644 *obj = reinterpret_cast<Object*>(this); | 647 *obj = reinterpret_cast<Object*>(this); |
| 645 return true; | 648 return true; |
| 646 } | 649 } |
| 650 inline Failure* ToFailureUnchecked() { |
| 651 ASSERT(IsFailure()); |
| 652 return reinterpret_cast<Failure*>(this); |
| 653 } |
| 647 inline Object* ToObjectUnchecked() { | 654 inline Object* ToObjectUnchecked() { |
| 648 ASSERT(!IsFailure()); | 655 ASSERT(!IsFailure()); |
| 649 return reinterpret_cast<Object*>(this); | 656 return reinterpret_cast<Object*>(this); |
| 650 } | 657 } |
| 651 inline Object* ToObjectChecked() { | 658 inline Object* ToObjectChecked() { |
| 652 CHECK(!IsFailure()); | 659 CHECK(!IsFailure()); |
| 653 return reinterpret_cast<Object*>(this); | 660 return reinterpret_cast<Object*>(this); |
| 654 } | 661 } |
| 655 | 662 |
| 656 template<typename T> | 663 template<typename T> |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 720 V(JSFunction) \ | 727 V(JSFunction) \ |
| 721 V(Code) \ | 728 V(Code) \ |
| 722 V(Oddball) \ | 729 V(Oddball) \ |
| 723 V(SharedFunctionInfo) \ | 730 V(SharedFunctionInfo) \ |
| 724 V(JSValue) \ | 731 V(JSValue) \ |
| 725 V(JSMessageObject) \ | 732 V(JSMessageObject) \ |
| 726 V(StringWrapper) \ | 733 V(StringWrapper) \ |
| 727 V(Proxy) \ | 734 V(Proxy) \ |
| 728 V(Boolean) \ | 735 V(Boolean) \ |
| 729 V(JSArray) \ | 736 V(JSArray) \ |
| 737 V(JSProxy) \ |
| 730 V(JSRegExp) \ | 738 V(JSRegExp) \ |
| 731 V(HashTable) \ | 739 V(HashTable) \ |
| 732 V(Dictionary) \ | 740 V(Dictionary) \ |
| 733 V(SymbolTable) \ | 741 V(SymbolTable) \ |
| 734 V(JSFunctionResultCache) \ | 742 V(JSFunctionResultCache) \ |
| 735 V(NormalizedMapCache) \ | 743 V(NormalizedMapCache) \ |
| 736 V(CompilationCacheTable) \ | 744 V(CompilationCacheTable) \ |
| 737 V(CodeCacheHashTable) \ | 745 V(CodeCacheHashTable) \ |
| 738 V(MapCache) \ | 746 V(MapCache) \ |
| 739 V(Primitive) \ | 747 V(Primitive) \ |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 808 String* key, | 816 String* key, |
| 809 PropertyAttributes* attributes); | 817 PropertyAttributes* attributes); |
| 810 MUST_USE_RESULT MaybeObject* GetProperty(Object* receiver, | 818 MUST_USE_RESULT MaybeObject* GetProperty(Object* receiver, |
| 811 LookupResult* result, | 819 LookupResult* result, |
| 812 String* key, | 820 String* key, |
| 813 PropertyAttributes* attributes); | 821 PropertyAttributes* attributes); |
| 814 MUST_USE_RESULT MaybeObject* GetPropertyWithCallback(Object* receiver, | 822 MUST_USE_RESULT MaybeObject* GetPropertyWithCallback(Object* receiver, |
| 815 Object* structure, | 823 Object* structure, |
| 816 String* name, | 824 String* name, |
| 817 Object* holder); | 825 Object* holder); |
| 826 MUST_USE_RESULT MaybeObject* GetPropertyWithHandler(Object* receiver, |
| 827 String* name, |
| 828 Object* handler); |
| 818 MUST_USE_RESULT MaybeObject* GetPropertyWithDefinedGetter(Object* receiver, | 829 MUST_USE_RESULT MaybeObject* GetPropertyWithDefinedGetter(Object* receiver, |
| 819 JSFunction* getter); | 830 JSFunction* getter); |
| 820 | 831 |
| 821 inline MaybeObject* GetElement(uint32_t index); | 832 inline MaybeObject* GetElement(uint32_t index); |
| 822 // For use when we know that no exception can be thrown. | 833 // For use when we know that no exception can be thrown. |
| 823 inline Object* GetElementNoExceptionThrown(uint32_t index); | 834 inline Object* GetElementNoExceptionThrown(uint32_t index); |
| 824 MaybeObject* GetElementWithReceiver(Object* receiver, uint32_t index); | 835 MaybeObject* GetElementWithReceiver(Object* receiver, uint32_t index); |
| 825 | 836 |
| 826 // Return the object's prototype (might be Heap::null_value()). | 837 // Return the object's prototype (might be Heap::null_value()). |
| 827 Object* GetPrototype(); | 838 Object* GetPrototype(); |
| (...skipping 2370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3198 FLAGS_MAX_VALUE = kMaxInt | 3209 FLAGS_MAX_VALUE = kMaxInt |
| 3199 }; | 3210 }; |
| 3200 | 3211 |
| 3201 enum Kind { | 3212 enum Kind { |
| 3202 FUNCTION, | 3213 FUNCTION, |
| 3203 OPTIMIZED_FUNCTION, | 3214 OPTIMIZED_FUNCTION, |
| 3204 STUB, | 3215 STUB, |
| 3205 BUILTIN, | 3216 BUILTIN, |
| 3206 LOAD_IC, | 3217 LOAD_IC, |
| 3207 KEYED_LOAD_IC, | 3218 KEYED_LOAD_IC, |
| 3208 KEYED_EXTERNAL_ARRAY_LOAD_IC, | |
| 3209 CALL_IC, | 3219 CALL_IC, |
| 3210 KEYED_CALL_IC, | 3220 KEYED_CALL_IC, |
| 3211 STORE_IC, | 3221 STORE_IC, |
| 3212 KEYED_STORE_IC, | 3222 KEYED_STORE_IC, |
| 3213 KEYED_EXTERNAL_ARRAY_STORE_IC, | |
| 3214 TYPE_RECORDING_UNARY_OP_IC, | 3223 TYPE_RECORDING_UNARY_OP_IC, |
| 3215 TYPE_RECORDING_BINARY_OP_IC, | 3224 TYPE_RECORDING_BINARY_OP_IC, |
| 3216 COMPARE_IC, | 3225 COMPARE_IC, |
| 3217 // No more than 16 kinds. The value currently encoded in four bits in | 3226 // No more than 16 kinds. The value currently encoded in four bits in |
| 3218 // Flags. | 3227 // Flags. |
| 3219 | 3228 |
| 3220 // Pseudo-kinds. | 3229 // Pseudo-kinds. |
| 3221 REGEXP = BUILTIN, | 3230 REGEXP = BUILTIN, |
| 3222 FIRST_IC_KIND = LOAD_IC, | 3231 FIRST_IC_KIND = LOAD_IC, |
| 3223 LAST_IC_KIND = COMPARE_IC | 3232 LAST_IC_KIND = COMPARE_IC |
| (...skipping 23 matching lines...) Expand all Loading... |
| 3247 inline int instruction_size(); | 3256 inline int instruction_size(); |
| 3248 inline void set_instruction_size(int value); | 3257 inline void set_instruction_size(int value); |
| 3249 | 3258 |
| 3250 // [relocation_info]: Code relocation information | 3259 // [relocation_info]: Code relocation information |
| 3251 DECL_ACCESSORS(relocation_info, ByteArray) | 3260 DECL_ACCESSORS(relocation_info, ByteArray) |
| 3252 void InvalidateRelocation(); | 3261 void InvalidateRelocation(); |
| 3253 | 3262 |
| 3254 // [deoptimization_data]: Array containing data for deopt. | 3263 // [deoptimization_data]: Array containing data for deopt. |
| 3255 DECL_ACCESSORS(deoptimization_data, FixedArray) | 3264 DECL_ACCESSORS(deoptimization_data, FixedArray) |
| 3256 | 3265 |
| 3266 // [code_flushing_candidate]: Field only used during garbage |
| 3267 // collection to hold code flushing candidates. The contents of this |
| 3268 // field does not have to be traced during garbage collection since |
| 3269 // it is only used by the garbage collector itself. |
| 3270 DECL_ACCESSORS(next_code_flushing_candidate, Object) |
| 3271 |
| 3257 // Unchecked accessors to be used during GC. | 3272 // Unchecked accessors to be used during GC. |
| 3258 inline ByteArray* unchecked_relocation_info(); | 3273 inline ByteArray* unchecked_relocation_info(); |
| 3259 inline FixedArray* unchecked_deoptimization_data(); | 3274 inline FixedArray* unchecked_deoptimization_data(); |
| 3260 | 3275 |
| 3261 inline int relocation_size(); | 3276 inline int relocation_size(); |
| 3262 | 3277 |
| 3263 // [flags]: Various code flags. | 3278 // [flags]: Various code flags. |
| 3264 inline Flags flags(); | 3279 inline Flags flags(); |
| 3265 inline void set_flags(Flags flags); | 3280 inline void set_flags(Flags flags); |
| 3266 | 3281 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 3280 inline bool is_keyed_store_stub() { return kind() == KEYED_STORE_IC; } | 3295 inline bool is_keyed_store_stub() { return kind() == KEYED_STORE_IC; } |
| 3281 inline bool is_call_stub() { return kind() == CALL_IC; } | 3296 inline bool is_call_stub() { return kind() == CALL_IC; } |
| 3282 inline bool is_keyed_call_stub() { return kind() == KEYED_CALL_IC; } | 3297 inline bool is_keyed_call_stub() { return kind() == KEYED_CALL_IC; } |
| 3283 inline bool is_type_recording_unary_op_stub() { | 3298 inline bool is_type_recording_unary_op_stub() { |
| 3284 return kind() == TYPE_RECORDING_UNARY_OP_IC; | 3299 return kind() == TYPE_RECORDING_UNARY_OP_IC; |
| 3285 } | 3300 } |
| 3286 inline bool is_type_recording_binary_op_stub() { | 3301 inline bool is_type_recording_binary_op_stub() { |
| 3287 return kind() == TYPE_RECORDING_BINARY_OP_IC; | 3302 return kind() == TYPE_RECORDING_BINARY_OP_IC; |
| 3288 } | 3303 } |
| 3289 inline bool is_compare_ic_stub() { return kind() == COMPARE_IC; } | 3304 inline bool is_compare_ic_stub() { return kind() == COMPARE_IC; } |
| 3290 inline bool is_external_array_load_stub() { | |
| 3291 return kind() == KEYED_EXTERNAL_ARRAY_LOAD_IC; | |
| 3292 } | |
| 3293 inline bool is_external_array_store_stub() { | |
| 3294 return kind() == KEYED_EXTERNAL_ARRAY_STORE_IC; | |
| 3295 } | |
| 3296 | 3305 |
| 3297 // [major_key]: For kind STUB or BINARY_OP_IC, the major key. | 3306 // [major_key]: For kind STUB or BINARY_OP_IC, the major key. |
| 3298 inline int major_key(); | 3307 inline int major_key(); |
| 3299 inline void set_major_key(int value); | 3308 inline void set_major_key(int value); |
| 3300 | 3309 |
| 3301 // [optimizable]: For FUNCTION kind, tells if it is optimizable. | 3310 // [optimizable]: For FUNCTION kind, tells if it is optimizable. |
| 3302 inline bool optimizable(); | 3311 inline bool optimizable(); |
| 3303 inline void set_optimizable(bool value); | 3312 inline void set_optimizable(bool value); |
| 3304 | 3313 |
| 3305 // [has_deoptimization_support]: For FUNCTION kind, tells if it has | 3314 // [has_deoptimization_support]: For FUNCTION kind, tells if it has |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3463 | 3472 |
| 3464 // Max loop nesting marker used to postpose OSR. We don't take loop | 3473 // Max loop nesting marker used to postpose OSR. We don't take loop |
| 3465 // nesting that is deeper than 5 levels into account. | 3474 // nesting that is deeper than 5 levels into account. |
| 3466 static const int kMaxLoopNestingMarker = 6; | 3475 static const int kMaxLoopNestingMarker = 6; |
| 3467 | 3476 |
| 3468 // Layout description. | 3477 // Layout description. |
| 3469 static const int kInstructionSizeOffset = HeapObject::kHeaderSize; | 3478 static const int kInstructionSizeOffset = HeapObject::kHeaderSize; |
| 3470 static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize; | 3479 static const int kRelocationInfoOffset = kInstructionSizeOffset + kIntSize; |
| 3471 static const int kDeoptimizationDataOffset = | 3480 static const int kDeoptimizationDataOffset = |
| 3472 kRelocationInfoOffset + kPointerSize; | 3481 kRelocationInfoOffset + kPointerSize; |
| 3473 static const int kFlagsOffset = kDeoptimizationDataOffset + kPointerSize; | 3482 static const int kNextCodeFlushingCandidateOffset = |
| 3474 static const int kKindSpecificFlagsOffset = kFlagsOffset + kIntSize; | 3483 kDeoptimizationDataOffset + kPointerSize; |
| 3484 static const int kFlagsOffset = |
| 3485 kNextCodeFlushingCandidateOffset + kPointerSize; |
| 3475 | 3486 |
| 3487 static const int kKindSpecificFlagsOffset = kFlagsOffset + kIntSize; |
| 3476 static const int kKindSpecificFlagsSize = 2 * kIntSize; | 3488 static const int kKindSpecificFlagsSize = 2 * kIntSize; |
| 3477 | 3489 |
| 3478 static const int kHeaderPaddingStart = kKindSpecificFlagsOffset + | 3490 static const int kHeaderPaddingStart = kKindSpecificFlagsOffset + |
| 3479 kKindSpecificFlagsSize; | 3491 kKindSpecificFlagsSize; |
| 3480 | 3492 |
| 3481 // Add padding to align the instruction start following right after | 3493 // Add padding to align the instruction start following right after |
| 3482 // the Code object header. | 3494 // the Code object header. |
| 3483 static const int kHeaderSize = | 3495 static const int kHeaderSize = |
| 3484 (kHeaderPaddingStart + kCodeAlignmentMask) & ~kCodeAlignmentMask; | 3496 (kHeaderPaddingStart + kCodeAlignmentMask) & ~kCodeAlignmentMask; |
| 3485 | 3497 |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3869 typedef FixedBodyDescriptor<kPointerFieldsBeginOffset, | 3881 typedef FixedBodyDescriptor<kPointerFieldsBeginOffset, |
| 3870 kPointerFieldsEndOffset, | 3882 kPointerFieldsEndOffset, |
| 3871 kSize> BodyDescriptor; | 3883 kSize> BodyDescriptor; |
| 3872 | 3884 |
| 3873 private: | 3885 private: |
| 3874 DISALLOW_IMPLICIT_CONSTRUCTORS(Map); | 3886 DISALLOW_IMPLICIT_CONSTRUCTORS(Map); |
| 3875 }; | 3887 }; |
| 3876 | 3888 |
| 3877 | 3889 |
| 3878 // An abstract superclass, a marker class really, for simple structure classes. | 3890 // An abstract superclass, a marker class really, for simple structure classes. |
| 3879 // It doesn't carry much functionality but allows struct classes to me | 3891 // It doesn't carry much functionality but allows struct classes to be |
| 3880 // identified in the type system. | 3892 // identified in the type system. |
| 3881 class Struct: public HeapObject { | 3893 class Struct: public HeapObject { |
| 3882 public: | 3894 public: |
| 3883 inline void InitializeBody(int object_size); | 3895 inline void InitializeBody(int object_size); |
| 3884 static inline Struct* cast(Object* that); | 3896 static inline Struct* cast(Object* that); |
| 3885 }; | 3897 }; |
| 3886 | 3898 |
| 3887 | 3899 |
| 3888 // Script describes a script which has been added to the VM. | 3900 // Script describes a script which has been added to the VM. |
| 3889 class Script: public Struct { | 3901 class Script: public Struct { |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4262 // shared function info. If a function is repeatedly optimized or if | 4274 // shared function info. If a function is repeatedly optimized or if |
| 4263 // we cannot optimize the function we disable optimization to avoid | 4275 // we cannot optimize the function we disable optimization to avoid |
| 4264 // spending time attempting to optimize it again. | 4276 // spending time attempting to optimize it again. |
| 4265 inline bool optimization_disabled(); | 4277 inline bool optimization_disabled(); |
| 4266 inline void set_optimization_disabled(bool value); | 4278 inline void set_optimization_disabled(bool value); |
| 4267 | 4279 |
| 4268 // Indicates whether the function is a strict mode function. | 4280 // Indicates whether the function is a strict mode function. |
| 4269 inline bool strict_mode(); | 4281 inline bool strict_mode(); |
| 4270 inline void set_strict_mode(bool value); | 4282 inline void set_strict_mode(bool value); |
| 4271 | 4283 |
| 4284 // Indicates whether the function is a native ES5 function. |
| 4285 // These needs special threatment in .call and .apply since |
| 4286 // null passed as the receiver should not be translated to the |
| 4287 // global object. |
| 4288 inline bool es5_native(); |
| 4289 inline void set_es5_native(bool value); |
| 4290 |
| 4272 // Indicates whether or not the code in the shared function support | 4291 // Indicates whether or not the code in the shared function support |
| 4273 // deoptimization. | 4292 // deoptimization. |
| 4274 inline bool has_deoptimization_support(); | 4293 inline bool has_deoptimization_support(); |
| 4275 | 4294 |
| 4276 // Enable deoptimization support through recompiled code. | 4295 // Enable deoptimization support through recompiled code. |
| 4277 void EnableDeoptimizationSupport(Code* recompiled); | 4296 void EnableDeoptimizationSupport(Code* recompiled); |
| 4278 | 4297 |
| 4279 // Lookup the bailout ID and ASSERT that it exists in the non-optimized | 4298 // Lookup the bailout ID and ASSERT that it exists in the non-optimized |
| 4280 // code, returns whether it asserted (i.e., always true if assertions are | 4299 // code, returns whether it asserted (i.e., always true if assertions are |
| 4281 // disabled). | 4300 // disabled). |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4442 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); | 4461 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); |
| 4443 | 4462 |
| 4444 // Bit positions in compiler_hints. | 4463 // Bit positions in compiler_hints. |
| 4445 static const int kHasOnlySimpleThisPropertyAssignments = 0; | 4464 static const int kHasOnlySimpleThisPropertyAssignments = 0; |
| 4446 static const int kAllowLazyCompilation = 1; | 4465 static const int kAllowLazyCompilation = 1; |
| 4447 static const int kLiveObjectsMayExist = 2; | 4466 static const int kLiveObjectsMayExist = 2; |
| 4448 static const int kCodeAgeShift = 3; | 4467 static const int kCodeAgeShift = 3; |
| 4449 static const int kCodeAgeMask = 0x7; | 4468 static const int kCodeAgeMask = 0x7; |
| 4450 static const int kOptimizationDisabled = 6; | 4469 static const int kOptimizationDisabled = 6; |
| 4451 static const int kStrictModeFunction = 7; | 4470 static const int kStrictModeFunction = 7; |
| 4471 static const int kES5Native = 8; |
| 4452 | 4472 |
| 4453 private: | 4473 private: |
| 4454 #if V8_HOST_ARCH_32_BIT | 4474 #if V8_HOST_ARCH_32_BIT |
| 4455 // On 32 bit platforms, compiler hints is a smi. | 4475 // On 32 bit platforms, compiler hints is a smi. |
| 4456 static const int kCompilerHintsSmiTagSize = kSmiTagSize; | 4476 static const int kCompilerHintsSmiTagSize = kSmiTagSize; |
| 4457 static const int kCompilerHintsSize = kPointerSize; | 4477 static const int kCompilerHintsSize = kPointerSize; |
| 4458 #else | 4478 #else |
| 4459 // On 64 bit platforms, compiler hints is not a smi, see comment above. | 4479 // On 64 bit platforms, compiler hints is not a smi, see comment above. |
| 4460 static const int kCompilerHintsSmiTagSize = 0; | 4480 static const int kCompilerHintsSmiTagSize = 0; |
| 4461 static const int kCompilerHintsSize = kIntSize; | 4481 static const int kCompilerHintsSize = kIntSize; |
| 4462 #endif | 4482 #endif |
| 4463 | 4483 |
| 4464 public: | 4484 public: |
| 4465 // Constants for optimizing codegen for strict mode function tests. | 4485 // Constants for optimizing codegen for strict mode function and |
| 4486 // es5 native tests. |
| 4466 // Allows to use byte-widgh instructions. | 4487 // Allows to use byte-widgh instructions. |
| 4467 static const int kStrictModeBitWithinByte = | 4488 static const int kStrictModeBitWithinByte = |
| 4468 (kStrictModeFunction + kCompilerHintsSmiTagSize) % kBitsPerByte; | 4489 (kStrictModeFunction + kCompilerHintsSmiTagSize) % kBitsPerByte; |
| 4469 | 4490 |
| 4491 static const int kES5NativeBitWithinByte = |
| 4492 (kES5Native + kCompilerHintsSmiTagSize) % kBitsPerByte; |
| 4493 |
| 4470 #if __BYTE_ORDER == __LITTLE_ENDIAN | 4494 #if __BYTE_ORDER == __LITTLE_ENDIAN |
| 4471 static const int kStrictModeByteOffset = kCompilerHintsOffset + | 4495 static const int kStrictModeByteOffset = kCompilerHintsOffset + |
| 4472 (kStrictModeFunction + kCompilerHintsSmiTagSize) / kBitsPerByte; | 4496 (kStrictModeFunction + kCompilerHintsSmiTagSize) / kBitsPerByte; |
| 4497 static const int kES5NativeByteOffset = kCompilerHintsOffset + |
| 4498 (kES5Native + kCompilerHintsSmiTagSize) / kBitsPerByte; |
| 4473 #elif __BYTE_ORDER == __BIG_ENDIAN | 4499 #elif __BYTE_ORDER == __BIG_ENDIAN |
| 4474 static const int kStrictModeByteOffset = kCompilerHintsOffset + | 4500 static const int kStrictModeByteOffset = kCompilerHintsOffset + |
| 4475 (kCompilerHintsSize - 1) - | 4501 (kCompilerHintsSize - 1) - |
| 4476 ((kStrictModeFunction + kCompilerHintsSmiTagSize) / kBitsPerByte); | 4502 ((kStrictModeFunction + kCompilerHintsSmiTagSize) / kBitsPerByte); |
| 4503 static const int kES5NativeByteOffset = kCompilerHintsOffset + |
| 4504 (kCompilerHintsSize - 1) - |
| 4505 ((kES5Native + kCompilerHintsSmiTagSize) / kBitsPerByte); |
| 4477 #else | 4506 #else |
| 4478 #error Unknown byte ordering | 4507 #error Unknown byte ordering |
| 4479 #endif | 4508 #endif |
| 4480 | 4509 |
| 4481 private: | 4510 private: |
| 4482 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo); | 4511 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo); |
| 4483 }; | 4512 }; |
| 4484 | 4513 |
| 4485 | 4514 |
| 4486 // JSFunction describes JavaScript functions. | 4515 // JSFunction describes JavaScript functions. |
| (...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5844 // iterating or updating after gc. | 5873 // iterating or updating after gc. |
| 5845 class Relocatable BASE_EMBEDDED { | 5874 class Relocatable BASE_EMBEDDED { |
| 5846 public: | 5875 public: |
| 5847 explicit inline Relocatable(Isolate* isolate); | 5876 explicit inline Relocatable(Isolate* isolate); |
| 5848 inline virtual ~Relocatable(); | 5877 inline virtual ~Relocatable(); |
| 5849 virtual void IterateInstance(ObjectVisitor* v) { } | 5878 virtual void IterateInstance(ObjectVisitor* v) { } |
| 5850 virtual void PostGarbageCollection() { } | 5879 virtual void PostGarbageCollection() { } |
| 5851 | 5880 |
| 5852 static void PostGarbageCollectionProcessing(); | 5881 static void PostGarbageCollectionProcessing(); |
| 5853 static int ArchiveSpacePerThread(); | 5882 static int ArchiveSpacePerThread(); |
| 5854 static char* ArchiveState(char* to); | 5883 static char* ArchiveState(Isolate* isolate, char* to); |
| 5855 static char* RestoreState(char* from); | 5884 static char* RestoreState(Isolate* isolate, char* from); |
| 5856 static void Iterate(ObjectVisitor* v); | 5885 static void Iterate(ObjectVisitor* v); |
| 5857 static void Iterate(ObjectVisitor* v, Relocatable* top); | 5886 static void Iterate(ObjectVisitor* v, Relocatable* top); |
| 5858 static char* Iterate(ObjectVisitor* v, char* t); | 5887 static char* Iterate(ObjectVisitor* v, char* t); |
| 5859 private: | 5888 private: |
| 5860 Isolate* isolate_; | 5889 Isolate* isolate_; |
| 5861 Relocatable* prev_; | 5890 Relocatable* prev_; |
| 5862 }; | 5891 }; |
| 5863 | 5892 |
| 5864 | 5893 |
| 5865 // A flat string reader provides random access to the contents of a | 5894 // A flat string reader provides random access to the contents of a |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5995 | 6024 |
| 5996 typedef FixedBodyDescriptor<kValueOffset, | 6025 typedef FixedBodyDescriptor<kValueOffset, |
| 5997 kValueOffset + kPointerSize, | 6026 kValueOffset + kPointerSize, |
| 5998 kSize> BodyDescriptor; | 6027 kSize> BodyDescriptor; |
| 5999 | 6028 |
| 6000 private: | 6029 private: |
| 6001 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalPropertyCell); | 6030 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalPropertyCell); |
| 6002 }; | 6031 }; |
| 6003 | 6032 |
| 6004 | 6033 |
| 6034 // The JSProxy describes EcmaScript Harmony proxies |
| 6035 class JSProxy: public HeapObject { |
| 6036 public: |
| 6037 // [handler]: The handler property. |
| 6038 DECL_ACCESSORS(handler, Object) |
| 6039 |
| 6040 // Casting. |
| 6041 static inline JSProxy* cast(Object* obj); |
| 6042 |
| 6043 // Dispatched behavior. |
| 6044 #ifdef OBJECT_PRINT |
| 6045 inline void JSProxyPrint() { |
| 6046 JSProxyPrint(stdout); |
| 6047 } |
| 6048 void JSProxyPrint(FILE* out); |
| 6049 #endif |
| 6050 #ifdef DEBUG |
| 6051 void JSProxyVerify(); |
| 6052 #endif |
| 6053 |
| 6054 // Layout description. |
| 6055 static const int kHandlerOffset = HeapObject::kHeaderSize; |
| 6056 static const int kSize = kHandlerOffset + kPointerSize; |
| 6057 |
| 6058 typedef FixedBodyDescriptor<kHandlerOffset, |
| 6059 kHandlerOffset + kPointerSize, |
| 6060 kSize> BodyDescriptor; |
| 6061 |
| 6062 private: |
| 6063 DISALLOW_IMPLICIT_CONSTRUCTORS(JSProxy); |
| 6064 }; |
| 6065 |
| 6066 |
| 6005 | 6067 |
| 6006 // Proxy describes objects pointing from JavaScript to C structures. | 6068 // Proxy describes objects pointing from JavaScript to C structures. |
| 6007 // Since they cannot contain references to JS HeapObjects they can be | 6069 // Since they cannot contain references to JS HeapObjects they can be |
| 6008 // placed in old_data_space. | 6070 // placed in old_data_space. |
| 6009 class Proxy: public HeapObject { | 6071 class Proxy: public HeapObject { |
| 6010 public: | 6072 public: |
| 6011 // [proxy]: field containing the address. | 6073 // [proxy]: field containing the address. |
| 6012 inline Address proxy(); | 6074 inline Address proxy(); |
| 6013 inline void set_proxy(Address value); | 6075 inline void set_proxy(Address value); |
| 6014 | 6076 |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6637 } else { | 6699 } else { |
| 6638 value &= ~(1 << bit_position); | 6700 value &= ~(1 << bit_position); |
| 6639 } | 6701 } |
| 6640 return value; | 6702 return value; |
| 6641 } | 6703 } |
| 6642 }; | 6704 }; |
| 6643 | 6705 |
| 6644 } } // namespace v8::internal | 6706 } } // namespace v8::internal |
| 6645 | 6707 |
| 6646 #endif // V8_OBJECTS_H_ | 6708 #endif // V8_OBJECTS_H_ |
| OLD | NEW |