OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
379 V(EXECUTABLE_ACCESSOR_INFO_TYPE) \ | 379 V(EXECUTABLE_ACCESSOR_INFO_TYPE) \ |
380 V(ACCESSOR_PAIR_TYPE) \ | 380 V(ACCESSOR_PAIR_TYPE) \ |
381 V(ACCESS_CHECK_INFO_TYPE) \ | 381 V(ACCESS_CHECK_INFO_TYPE) \ |
382 V(INTERCEPTOR_INFO_TYPE) \ | 382 V(INTERCEPTOR_INFO_TYPE) \ |
383 V(CALL_HANDLER_INFO_TYPE) \ | 383 V(CALL_HANDLER_INFO_TYPE) \ |
384 V(FUNCTION_TEMPLATE_INFO_TYPE) \ | 384 V(FUNCTION_TEMPLATE_INFO_TYPE) \ |
385 V(OBJECT_TEMPLATE_INFO_TYPE) \ | 385 V(OBJECT_TEMPLATE_INFO_TYPE) \ |
386 V(SIGNATURE_INFO_TYPE) \ | 386 V(SIGNATURE_INFO_TYPE) \ |
387 V(TYPE_SWITCH_INFO_TYPE) \ | 387 V(TYPE_SWITCH_INFO_TYPE) \ |
388 V(ALLOCATION_SITE_INFO_TYPE) \ | 388 V(ALLOCATION_SITE_INFO_TYPE) \ |
389 V(ALLOCATION_SITE_TYPE) \ | |
389 V(SCRIPT_TYPE) \ | 390 V(SCRIPT_TYPE) \ |
390 V(CODE_CACHE_TYPE) \ | 391 V(CODE_CACHE_TYPE) \ |
391 V(POLYMORPHIC_CODE_CACHE_TYPE) \ | 392 V(POLYMORPHIC_CODE_CACHE_TYPE) \ |
392 V(TYPE_FEEDBACK_INFO_TYPE) \ | 393 V(TYPE_FEEDBACK_INFO_TYPE) \ |
393 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ | 394 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ |
394 \ | 395 \ |
395 V(FIXED_ARRAY_TYPE) \ | 396 V(FIXED_ARRAY_TYPE) \ |
396 V(FIXED_DOUBLE_ARRAY_TYPE) \ | 397 V(FIXED_DOUBLE_ARRAY_TYPE) \ |
397 V(SHARED_FUNCTION_INFO_TYPE) \ | 398 V(SHARED_FUNCTION_INFO_TYPE) \ |
398 \ | 399 \ |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
542 V(EXECUTABLE_ACCESSOR_INFO, ExecutableAccessorInfo, executable_accessor_info)\ | 543 V(EXECUTABLE_ACCESSOR_INFO, ExecutableAccessorInfo, executable_accessor_info)\ |
543 V(ACCESSOR_PAIR, AccessorPair, accessor_pair) \ | 544 V(ACCESSOR_PAIR, AccessorPair, accessor_pair) \ |
544 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \ | 545 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \ |
545 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \ | 546 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \ |
546 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \ | 547 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \ |
547 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ | 548 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ |
548 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ | 549 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ |
549 V(SIGNATURE_INFO, SignatureInfo, signature_info) \ | 550 V(SIGNATURE_INFO, SignatureInfo, signature_info) \ |
550 V(TYPE_SWITCH_INFO, TypeSwitchInfo, type_switch_info) \ | 551 V(TYPE_SWITCH_INFO, TypeSwitchInfo, type_switch_info) \ |
551 V(SCRIPT, Script, script) \ | 552 V(SCRIPT, Script, script) \ |
553 V(ALLOCATION_SITE, AllocationSite, allocation_site) \ | |
552 V(ALLOCATION_SITE_INFO, AllocationSiteInfo, allocation_site_info) \ | 554 V(ALLOCATION_SITE_INFO, AllocationSiteInfo, allocation_site_info) \ |
553 V(CODE_CACHE, CodeCache, code_cache) \ | 555 V(CODE_CACHE, CodeCache, code_cache) \ |
554 V(POLYMORPHIC_CODE_CACHE, PolymorphicCodeCache, polymorphic_code_cache) \ | 556 V(POLYMORPHIC_CODE_CACHE, PolymorphicCodeCache, polymorphic_code_cache) \ |
555 V(TYPE_FEEDBACK_INFO, TypeFeedbackInfo, type_feedback_info) \ | 557 V(TYPE_FEEDBACK_INFO, TypeFeedbackInfo, type_feedback_info) \ |
556 V(ALIASED_ARGUMENTS_ENTRY, AliasedArgumentsEntry, aliased_arguments_entry) | 558 V(ALIASED_ARGUMENTS_ENTRY, AliasedArgumentsEntry, aliased_arguments_entry) |
557 | 559 |
558 #ifdef ENABLE_DEBUGGER_SUPPORT | 560 #ifdef ENABLE_DEBUGGER_SUPPORT |
559 #define STRUCT_LIST_DEBUGGER(V) \ | 561 #define STRUCT_LIST_DEBUGGER(V) \ |
560 V(DEBUG_INFO, DebugInfo, debug_info) \ | 562 V(DEBUG_INFO, DebugInfo, debug_info) \ |
561 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) | 563 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
701 DECLARED_ACCESSOR_INFO_TYPE, | 703 DECLARED_ACCESSOR_INFO_TYPE, |
702 EXECUTABLE_ACCESSOR_INFO_TYPE, | 704 EXECUTABLE_ACCESSOR_INFO_TYPE, |
703 ACCESSOR_PAIR_TYPE, | 705 ACCESSOR_PAIR_TYPE, |
704 ACCESS_CHECK_INFO_TYPE, | 706 ACCESS_CHECK_INFO_TYPE, |
705 INTERCEPTOR_INFO_TYPE, | 707 INTERCEPTOR_INFO_TYPE, |
706 CALL_HANDLER_INFO_TYPE, | 708 CALL_HANDLER_INFO_TYPE, |
707 FUNCTION_TEMPLATE_INFO_TYPE, | 709 FUNCTION_TEMPLATE_INFO_TYPE, |
708 OBJECT_TEMPLATE_INFO_TYPE, | 710 OBJECT_TEMPLATE_INFO_TYPE, |
709 SIGNATURE_INFO_TYPE, | 711 SIGNATURE_INFO_TYPE, |
710 TYPE_SWITCH_INFO_TYPE, | 712 TYPE_SWITCH_INFO_TYPE, |
713 ALLOCATION_SITE_TYPE, | |
711 ALLOCATION_SITE_INFO_TYPE, | 714 ALLOCATION_SITE_INFO_TYPE, |
712 SCRIPT_TYPE, | 715 SCRIPT_TYPE, |
713 CODE_CACHE_TYPE, | 716 CODE_CACHE_TYPE, |
714 POLYMORPHIC_CODE_CACHE_TYPE, | 717 POLYMORPHIC_CODE_CACHE_TYPE, |
715 TYPE_FEEDBACK_INFO_TYPE, | 718 TYPE_FEEDBACK_INFO_TYPE, |
716 ALIASED_ARGUMENTS_ENTRY_TYPE, | 719 ALIASED_ARGUMENTS_ENTRY_TYPE, |
717 // The following two instance types are only used when ENABLE_DEBUGGER_SUPPORT | 720 // The following two instance types are only used when ENABLE_DEBUGGER_SUPPORT |
718 // is defined. However as include/v8.h contain some of the instance type | 721 // is defined. However as include/v8.h contain some of the instance type |
719 // constants always having them avoids them getting different numbers | 722 // constants always having them avoids them getting different numbers |
720 // depending on whether ENABLE_DEBUGGER_SUPPORT is defined or not. | 723 // depending on whether ENABLE_DEBUGGER_SUPPORT is defined or not. |
(...skipping 1489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2210 inline MUST_USE_RESULT MaybeObject* GetElementsTransitionMap( | 2213 inline MUST_USE_RESULT MaybeObject* GetElementsTransitionMap( |
2211 Isolate* isolate, | 2214 Isolate* isolate, |
2212 ElementsKind elements_kind); | 2215 ElementsKind elements_kind); |
2213 MUST_USE_RESULT MaybeObject* GetElementsTransitionMapSlow( | 2216 MUST_USE_RESULT MaybeObject* GetElementsTransitionMapSlow( |
2214 ElementsKind elements_kind); | 2217 ElementsKind elements_kind); |
2215 | 2218 |
2216 static Handle<Object> TransitionElementsKind(Handle<JSObject> object, | 2219 static Handle<Object> TransitionElementsKind(Handle<JSObject> object, |
2217 ElementsKind to_kind); | 2220 ElementsKind to_kind); |
2218 | 2221 |
2219 MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind); | 2222 MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind); |
2220 MUST_USE_RESULT MaybeObject* UpdateAllocationSiteInfo( | 2223 MUST_USE_RESULT MaybeObject* UpdateAllocationSite(ElementsKind to_kind); |
2221 ElementsKind to_kind); | |
2222 | 2224 |
2223 // Replaces an existing transition with a transition to a map with a FIELD. | 2225 // Replaces an existing transition with a transition to a map with a FIELD. |
2224 MUST_USE_RESULT MaybeObject* ConvertTransitionToMapTransition( | 2226 MUST_USE_RESULT MaybeObject* ConvertTransitionToMapTransition( |
2225 int transition_index, | 2227 int transition_index, |
2226 Name* name, | 2228 Name* name, |
2227 Object* new_value, | 2229 Object* new_value, |
2228 PropertyAttributes attributes); | 2230 PropertyAttributes attributes); |
2229 | 2231 |
2230 // Converts a descriptor of any other type to a real field, backed by the | 2232 // Converts a descriptor of any other type to a real field, backed by the |
2231 // properties array. | 2233 // properties array. |
(...skipping 5217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7449 }; | 7451 }; |
7450 | 7452 |
7451 | 7453 |
7452 enum AllocationSiteMode { | 7454 enum AllocationSiteMode { |
7453 DONT_TRACK_ALLOCATION_SITE, | 7455 DONT_TRACK_ALLOCATION_SITE, |
7454 TRACK_ALLOCATION_SITE, | 7456 TRACK_ALLOCATION_SITE, |
7455 LAST_ALLOCATION_SITE_MODE = TRACK_ALLOCATION_SITE | 7457 LAST_ALLOCATION_SITE_MODE = TRACK_ALLOCATION_SITE |
7456 }; | 7458 }; |
7457 | 7459 |
7458 | 7460 |
7461 class AllocationSite: public Struct { | |
7462 public: | |
7463 static const int kPayloadOffset = HeapObject::kHeaderSize; | |
7464 static const int kSize = kPayloadOffset + kPointerSize; | |
7465 static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024; | |
7466 | |
7467 // TODO(mvstanton): rename payload to transition_info. | |
7468 DECL_ACCESSORS(payload, Object) | |
7469 | |
7470 void Initialize() { | |
7471 SetElementsKindPayload(GetInitialFastElementsKind()); | |
7472 } | |
7473 | |
7474 ElementsKind GetElementsKindPayload() { | |
7475 ASSERT(!IsLiteralSite()); | |
7476 return static_cast<ElementsKind>(Smi::cast(payload())->value()); | |
7477 } | |
7478 | |
7479 void SetElementsKindPayload(ElementsKind kind) { | |
7480 set_payload(Smi::FromInt(static_cast<int>(kind))); | |
7481 } | |
7482 | |
7483 bool IsLiteralSite() { | |
7484 // If the payload is a smi, then it represents an ElementsKind | |
7485 // for a constructed array. Otherwise, it must be a boilerplate | |
7486 // for an array literal | |
7487 return payload()->IsJSArray(); | |
7488 } | |
7489 | |
7490 DECLARE_PRINTER(AllocationSite) | |
7491 DECLARE_VERIFIER(AllocationSite) | |
7492 | |
7493 static inline AllocationSite* cast(Object* obj); | |
7494 static inline AllocationSiteMode GetMode( | |
7495 ElementsKind boilerplate_elements_kind); | |
7496 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); | |
7497 | |
7498 private: | |
7499 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSite); | |
7500 }; | |
7501 | |
7502 | |
7459 class AllocationSiteInfo: public Struct { | 7503 class AllocationSiteInfo: public Struct { |
7460 public: | 7504 public: |
7461 DECL_ACCESSORS(payload, Object) | 7505 static const int kAllocationSiteOffset = HeapObject::kHeaderSize; |
7506 static const int kSize = kAllocationSiteOffset + kPointerSize; | |
7462 | 7507 |
7463 static inline AllocationSiteInfo* cast(Object* obj); | 7508 DECL_ACCESSORS(allocation_site, Object) |
7509 | |
7510 bool site_is_valid() { return allocation_site()->IsAllocationSite(); } | |
Hannes Payer (out of office)
2013/07/03 15:34:02
this is not a real getter.
mvstanton
2013/07/05 07:56:14
Done.
| |
7511 AllocationSite* allocation_site_casted() { | |
Hannes Payer (out of office)
2013/07/03 15:34:02
This is also not a real getter. Moreover can we ca
mvstanton
2013/07/05 07:56:14
Done.
| |
7512 ASSERT(site_is_valid()); | |
7513 return AllocationSite::cast(allocation_site()); | |
7514 } | |
7464 | 7515 |
7465 DECLARE_PRINTER(AllocationSiteInfo) | 7516 DECLARE_PRINTER(AllocationSiteInfo) |
7466 DECLARE_VERIFIER(AllocationSiteInfo) | 7517 DECLARE_VERIFIER(AllocationSiteInfo) |
7467 | 7518 |
7468 // Returns NULL if no AllocationSiteInfo is available for object. | 7519 // Returns NULL if no AllocationSiteInfo is available for object. |
7469 static AllocationSiteInfo* FindForJSObject(JSObject* object); | 7520 static AllocationSiteInfo* FindForJSObject(JSObject* object); |
7470 static inline AllocationSiteMode GetMode( | 7521 static inline AllocationSiteInfo* cast(Object* obj); |
7471 ElementsKind boilerplate_elements_kind); | |
7472 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); | |
7473 | 7522 |
7474 static const int kPayloadOffset = HeapObject::kHeaderSize; | |
7475 static const int kSize = kPayloadOffset + kPointerSize; | |
7476 static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024; | |
7477 | |
7478 bool GetElementsKindPayload(ElementsKind* kind); | |
7479 private: | 7523 private: |
7480 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSiteInfo); | 7524 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSiteInfo); |
7481 }; | 7525 }; |
7482 | 7526 |
7483 | 7527 |
7484 // Representation of a slow alias as part of a non-strict arguments objects. | 7528 // Representation of a slow alias as part of a non-strict arguments objects. |
7485 // For fast aliases (if HasNonStrictArgumentsElements()): | 7529 // For fast aliases (if HasNonStrictArgumentsElements()): |
7486 // - the parameter map contains an index into the context | 7530 // - the parameter map contains an index into the context |
7487 // - all attributes of the element have default values | 7531 // - all attributes of the element have default values |
7488 // For slow aliases (if HasDictionaryArgumentsElements()): | 7532 // For slow aliases (if HasDictionaryArgumentsElements()): |
(...skipping 2256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9745 } else { | 9789 } else { |
9746 value &= ~(1 << bit_position); | 9790 value &= ~(1 << bit_position); |
9747 } | 9791 } |
9748 return value; | 9792 return value; |
9749 } | 9793 } |
9750 }; | 9794 }; |
9751 | 9795 |
9752 } } // namespace v8::internal | 9796 } } // namespace v8::internal |
9753 | 9797 |
9754 #endif // V8_OBJECTS_H_ | 9798 #endif // V8_OBJECTS_H_ |
OLD | NEW |