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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
374 V(EXECUTABLE_ACCESSOR_INFO_TYPE) \ | 374 V(EXECUTABLE_ACCESSOR_INFO_TYPE) \ |
375 V(ACCESSOR_PAIR_TYPE) \ | 375 V(ACCESSOR_PAIR_TYPE) \ |
376 V(ACCESS_CHECK_INFO_TYPE) \ | 376 V(ACCESS_CHECK_INFO_TYPE) \ |
377 V(INTERCEPTOR_INFO_TYPE) \ | 377 V(INTERCEPTOR_INFO_TYPE) \ |
378 V(CALL_HANDLER_INFO_TYPE) \ | 378 V(CALL_HANDLER_INFO_TYPE) \ |
379 V(FUNCTION_TEMPLATE_INFO_TYPE) \ | 379 V(FUNCTION_TEMPLATE_INFO_TYPE) \ |
380 V(OBJECT_TEMPLATE_INFO_TYPE) \ | 380 V(OBJECT_TEMPLATE_INFO_TYPE) \ |
381 V(SIGNATURE_INFO_TYPE) \ | 381 V(SIGNATURE_INFO_TYPE) \ |
382 V(TYPE_SWITCH_INFO_TYPE) \ | 382 V(TYPE_SWITCH_INFO_TYPE) \ |
383 V(ALLOCATION_SITE_INFO_TYPE) \ | 383 V(ALLOCATION_SITE_INFO_TYPE) \ |
384 V(ALLOCATION_SITE_TYPE) \ | |
384 V(SCRIPT_TYPE) \ | 385 V(SCRIPT_TYPE) \ |
385 V(CODE_CACHE_TYPE) \ | 386 V(CODE_CACHE_TYPE) \ |
386 V(POLYMORPHIC_CODE_CACHE_TYPE) \ | 387 V(POLYMORPHIC_CODE_CACHE_TYPE) \ |
387 V(TYPE_FEEDBACK_INFO_TYPE) \ | 388 V(TYPE_FEEDBACK_INFO_TYPE) \ |
388 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ | 389 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ |
389 \ | 390 \ |
390 V(FIXED_ARRAY_TYPE) \ | 391 V(FIXED_ARRAY_TYPE) \ |
391 V(FIXED_DOUBLE_ARRAY_TYPE) \ | 392 V(FIXED_DOUBLE_ARRAY_TYPE) \ |
392 V(SHARED_FUNCTION_INFO_TYPE) \ | 393 V(SHARED_FUNCTION_INFO_TYPE) \ |
393 \ | 394 \ |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
536 V(EXECUTABLE_ACCESSOR_INFO, ExecutableAccessorInfo, executable_accessor_info)\ | 537 V(EXECUTABLE_ACCESSOR_INFO, ExecutableAccessorInfo, executable_accessor_info)\ |
537 V(ACCESSOR_PAIR, AccessorPair, accessor_pair) \ | 538 V(ACCESSOR_PAIR, AccessorPair, accessor_pair) \ |
538 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \ | 539 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \ |
539 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \ | 540 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \ |
540 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \ | 541 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \ |
541 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ | 542 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ |
542 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ | 543 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ |
543 V(SIGNATURE_INFO, SignatureInfo, signature_info) \ | 544 V(SIGNATURE_INFO, SignatureInfo, signature_info) \ |
544 V(TYPE_SWITCH_INFO, TypeSwitchInfo, type_switch_info) \ | 545 V(TYPE_SWITCH_INFO, TypeSwitchInfo, type_switch_info) \ |
545 V(SCRIPT, Script, script) \ | 546 V(SCRIPT, Script, script) \ |
547 V(ALLOCATION_SITE, AllocationSite, allocation_site) \ | |
546 V(ALLOCATION_SITE_INFO, AllocationSiteInfo, allocation_site_info) \ | 548 V(ALLOCATION_SITE_INFO, AllocationSiteInfo, allocation_site_info) \ |
547 V(CODE_CACHE, CodeCache, code_cache) \ | 549 V(CODE_CACHE, CodeCache, code_cache) \ |
548 V(POLYMORPHIC_CODE_CACHE, PolymorphicCodeCache, polymorphic_code_cache) \ | 550 V(POLYMORPHIC_CODE_CACHE, PolymorphicCodeCache, polymorphic_code_cache) \ |
549 V(TYPE_FEEDBACK_INFO, TypeFeedbackInfo, type_feedback_info) \ | 551 V(TYPE_FEEDBACK_INFO, TypeFeedbackInfo, type_feedback_info) \ |
550 V(ALIASED_ARGUMENTS_ENTRY, AliasedArgumentsEntry, aliased_arguments_entry) | 552 V(ALIASED_ARGUMENTS_ENTRY, AliasedArgumentsEntry, aliased_arguments_entry) |
551 | 553 |
552 #ifdef ENABLE_DEBUGGER_SUPPORT | 554 #ifdef ENABLE_DEBUGGER_SUPPORT |
553 #define STRUCT_LIST_DEBUGGER(V) \ | 555 #define STRUCT_LIST_DEBUGGER(V) \ |
554 V(DEBUG_INFO, DebugInfo, debug_info) \ | 556 V(DEBUG_INFO, DebugInfo, debug_info) \ |
555 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) | 557 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
695 DECLARED_ACCESSOR_INFO_TYPE, | 697 DECLARED_ACCESSOR_INFO_TYPE, |
696 EXECUTABLE_ACCESSOR_INFO_TYPE, | 698 EXECUTABLE_ACCESSOR_INFO_TYPE, |
697 ACCESSOR_PAIR_TYPE, | 699 ACCESSOR_PAIR_TYPE, |
698 ACCESS_CHECK_INFO_TYPE, | 700 ACCESS_CHECK_INFO_TYPE, |
699 INTERCEPTOR_INFO_TYPE, | 701 INTERCEPTOR_INFO_TYPE, |
700 CALL_HANDLER_INFO_TYPE, | 702 CALL_HANDLER_INFO_TYPE, |
701 FUNCTION_TEMPLATE_INFO_TYPE, | 703 FUNCTION_TEMPLATE_INFO_TYPE, |
702 OBJECT_TEMPLATE_INFO_TYPE, | 704 OBJECT_TEMPLATE_INFO_TYPE, |
703 SIGNATURE_INFO_TYPE, | 705 SIGNATURE_INFO_TYPE, |
704 TYPE_SWITCH_INFO_TYPE, | 706 TYPE_SWITCH_INFO_TYPE, |
707 ALLOCATION_SITE_TYPE, | |
705 ALLOCATION_SITE_INFO_TYPE, | 708 ALLOCATION_SITE_INFO_TYPE, |
706 SCRIPT_TYPE, | 709 SCRIPT_TYPE, |
707 CODE_CACHE_TYPE, | 710 CODE_CACHE_TYPE, |
708 POLYMORPHIC_CODE_CACHE_TYPE, | 711 POLYMORPHIC_CODE_CACHE_TYPE, |
709 TYPE_FEEDBACK_INFO_TYPE, | 712 TYPE_FEEDBACK_INFO_TYPE, |
710 ALIASED_ARGUMENTS_ENTRY_TYPE, | 713 ALIASED_ARGUMENTS_ENTRY_TYPE, |
711 // The following two instance types are only used when ENABLE_DEBUGGER_SUPPORT | 714 // The following two instance types are only used when ENABLE_DEBUGGER_SUPPORT |
712 // is defined. However as include/v8.h contain some of the instance type | 715 // is defined. However as include/v8.h contain some of the instance type |
713 // constants always having them avoids them getting different numbers | 716 // constants always having them avoids them getting different numbers |
714 // depending on whether ENABLE_DEBUGGER_SUPPORT is defined or not. | 717 // depending on whether ENABLE_DEBUGGER_SUPPORT is defined or not. |
(...skipping 1484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2199 inline MUST_USE_RESULT MaybeObject* GetElementsTransitionMap( | 2202 inline MUST_USE_RESULT MaybeObject* GetElementsTransitionMap( |
2200 Isolate* isolate, | 2203 Isolate* isolate, |
2201 ElementsKind elements_kind); | 2204 ElementsKind elements_kind); |
2202 MUST_USE_RESULT MaybeObject* GetElementsTransitionMapSlow( | 2205 MUST_USE_RESULT MaybeObject* GetElementsTransitionMapSlow( |
2203 ElementsKind elements_kind); | 2206 ElementsKind elements_kind); |
2204 | 2207 |
2205 static Handle<Object> TransitionElementsKind(Handle<JSObject> object, | 2208 static Handle<Object> TransitionElementsKind(Handle<JSObject> object, |
2206 ElementsKind to_kind); | 2209 ElementsKind to_kind); |
2207 | 2210 |
2208 MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind); | 2211 MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind); |
2209 MUST_USE_RESULT MaybeObject* UpdateAllocationSiteInfo( | 2212 MUST_USE_RESULT MaybeObject* UpdateAllocationSite(ElementsKind to_kind); |
2210 ElementsKind to_kind); | |
2211 | 2213 |
2212 // Replaces an existing transition with a transition to a map with a FIELD. | 2214 // Replaces an existing transition with a transition to a map with a FIELD. |
2213 MUST_USE_RESULT MaybeObject* ConvertTransitionToMapTransition( | 2215 MUST_USE_RESULT MaybeObject* ConvertTransitionToMapTransition( |
2214 int transition_index, | 2216 int transition_index, |
2215 Name* name, | 2217 Name* name, |
2216 Object* new_value, | 2218 Object* new_value, |
2217 PropertyAttributes attributes); | 2219 PropertyAttributes attributes); |
2218 | 2220 |
2219 // Converts a descriptor of any other type to a real field, backed by the | 2221 // Converts a descriptor of any other type to a real field, backed by the |
2220 // properties array. | 2222 // properties array. |
(...skipping 5227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7448 }; | 7450 }; |
7449 | 7451 |
7450 | 7452 |
7451 enum AllocationSiteMode { | 7453 enum AllocationSiteMode { |
7452 DONT_TRACK_ALLOCATION_SITE, | 7454 DONT_TRACK_ALLOCATION_SITE, |
7453 TRACK_ALLOCATION_SITE, | 7455 TRACK_ALLOCATION_SITE, |
7454 LAST_ALLOCATION_SITE_MODE = TRACK_ALLOCATION_SITE | 7456 LAST_ALLOCATION_SITE_MODE = TRACK_ALLOCATION_SITE |
7455 }; | 7457 }; |
7456 | 7458 |
7457 | 7459 |
7460 class AllocationSite: public Struct { | |
7461 public: | |
7462 DECL_ACCESSORS(payload, Object) | |
Hannes Payer (out of office)
2013/06/25 16:35:07
Can we rename payload to something more meaningful
mvstanton
2013/07/02 13:55:11
For this one I added a TODO because I'd have to to
| |
7463 | |
7464 static inline AllocationSite* cast(Object* obj); | |
7465 | |
7466 void Initialize() { | |
7467 set_payload(Smi::FromInt(GetInitialFastElementsKind())); | |
Hannes Payer (out of office)
2013/06/25 16:35:07
You can call SetElementsKindPayload there.
mvstanton
2013/07/02 13:55:11
Done.
| |
7468 } | |
Hannes Payer (out of office)
2013/06/25 16:35:07
declaration order: Typedefs and Enums, Constants (
mvstanton
2013/07/02 13:55:11
I think I've arranged it better now, have a look.
| |
7469 | |
7470 DECLARE_PRINTER(AllocationSite) | |
7471 DECLARE_VERIFIER(AllocationSite) | |
7472 | |
7473 static inline AllocationSiteMode GetMode( | |
7474 ElementsKind boilerplate_elements_kind); | |
7475 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); | |
7476 | |
7477 static const int kPayloadOffset = HeapObject::kHeaderSize; | |
7478 static const int kSize = kPayloadOffset + kPointerSize; | |
7479 static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024; | |
7480 | |
7481 ElementsKind GetElementsKindPayload() { | |
7482 ASSERT(!IsLiteralSite()); | |
7483 return static_cast<ElementsKind>(Smi::cast(payload())->value()); | |
7484 } | |
7485 | |
7486 void SetElementsKindPayload(ElementsKind kind) { | |
7487 set_payload(Smi::FromInt(static_cast<int>(kind))); | |
7488 } | |
7489 | |
7490 bool IsLiteralSite() { | |
7491 return !payload()->IsSmi(); // payload is a boilerplate | |
Hannes Payer (out of office)
2013/06/25 16:35:07
remove comment or make it clear.
mvstanton
2013/07/02 13:55:11
Clarified, and made the test stronger: return payl
| |
7492 } | |
7493 | |
7494 private: | |
7495 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSite); | |
7496 }; | |
7497 | |
7498 | |
7458 class AllocationSiteInfo: public Struct { | 7499 class AllocationSiteInfo: public Struct { |
Hannes Payer (out of office)
2013/06/25 16:35:07
declaration order... I just saw that it is not con
mvstanton
2013/07/02 13:55:11
Done.
| |
7459 public: | 7500 public: |
7460 DECL_ACCESSORS(payload, Object) | 7501 DECL_ACCESSORS(payload, Object) |
7461 | 7502 |
7462 static inline AllocationSiteInfo* cast(Object* obj); | 7503 static inline AllocationSiteInfo* cast(Object* obj); |
7463 | 7504 |
7464 DECLARE_PRINTER(AllocationSiteInfo) | 7505 DECLARE_PRINTER(AllocationSiteInfo) |
7465 DECLARE_VERIFIER(AllocationSiteInfo) | 7506 DECLARE_VERIFIER(AllocationSiteInfo) |
7466 | 7507 |
7467 // Returns NULL if no AllocationSiteInfo is available for object. | 7508 // Returns NULL if no AllocationSiteInfo is available for object. |
7468 static AllocationSiteInfo* FindForJSObject(JSObject* object); | 7509 static AllocationSiteInfo* FindForJSObject(JSObject* object); |
7469 static inline AllocationSiteMode GetMode( | |
7470 ElementsKind boilerplate_elements_kind); | |
7471 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to); | |
7472 | 7510 |
7473 static const int kPayloadOffset = HeapObject::kHeaderSize; | 7511 static const int kPayloadOffset = HeapObject::kHeaderSize; |
Hannes Payer (out of office)
2013/06/25 16:35:07
Do you think it makes sense to rename kPayloadOffs
mvstanton
2013/07/02 13:55:11
Done.
| |
7474 static const int kSize = kPayloadOffset + kPointerSize; | 7512 static const int kSize = kPayloadOffset + kPointerSize; |
7475 static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024; | |
7476 | 7513 |
7477 bool GetElementsKindPayload(ElementsKind* kind); | |
7478 private: | 7514 private: |
7479 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSiteInfo); | 7515 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSiteInfo); |
7480 }; | 7516 }; |
7481 | 7517 |
7482 | 7518 |
7483 // Representation of a slow alias as part of a non-strict arguments objects. | 7519 // Representation of a slow alias as part of a non-strict arguments objects. |
7484 // For fast aliases (if HasNonStrictArgumentsElements()): | 7520 // For fast aliases (if HasNonStrictArgumentsElements()): |
7485 // - the parameter map contains an index into the context | 7521 // - the parameter map contains an index into the context |
7486 // - all attributes of the element have default values | 7522 // - all attributes of the element have default values |
7487 // For slow aliases (if HasDictionaryArgumentsElements()): | 7523 // For slow aliases (if HasDictionaryArgumentsElements()): |
(...skipping 2169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9657 } else { | 9693 } else { |
9658 value &= ~(1 << bit_position); | 9694 value &= ~(1 << bit_position); |
9659 } | 9695 } |
9660 return value; | 9696 return value; |
9661 } | 9697 } |
9662 }; | 9698 }; |
9663 | 9699 |
9664 } } // namespace v8::internal | 9700 } } // namespace v8::internal |
9665 | 9701 |
9666 #endif // V8_OBJECTS_H_ | 9702 #endif // V8_OBJECTS_H_ |
OLD | NEW |