Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1061)

Side by Side Diff: src/objects.h

Issue 15094018: Create AllocationSite objects, pointed to by AllocationSiteInfo. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comment response Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 V(EXECUTABLE_ACCESSOR_INFO_TYPE) \ 380 V(EXECUTABLE_ACCESSOR_INFO_TYPE) \
381 V(ACCESSOR_PAIR_TYPE) \ 381 V(ACCESSOR_PAIR_TYPE) \
382 V(ACCESS_CHECK_INFO_TYPE) \ 382 V(ACCESS_CHECK_INFO_TYPE) \
383 V(INTERCEPTOR_INFO_TYPE) \ 383 V(INTERCEPTOR_INFO_TYPE) \
384 V(CALL_HANDLER_INFO_TYPE) \ 384 V(CALL_HANDLER_INFO_TYPE) \
385 V(FUNCTION_TEMPLATE_INFO_TYPE) \ 385 V(FUNCTION_TEMPLATE_INFO_TYPE) \
386 V(OBJECT_TEMPLATE_INFO_TYPE) \ 386 V(OBJECT_TEMPLATE_INFO_TYPE) \
387 V(SIGNATURE_INFO_TYPE) \ 387 V(SIGNATURE_INFO_TYPE) \
388 V(TYPE_SWITCH_INFO_TYPE) \ 388 V(TYPE_SWITCH_INFO_TYPE) \
389 V(ALLOCATION_SITE_INFO_TYPE) \ 389 V(ALLOCATION_SITE_INFO_TYPE) \
390 V(ALLOCATION_SITE_TYPE) \
390 V(SCRIPT_TYPE) \ 391 V(SCRIPT_TYPE) \
391 V(CODE_CACHE_TYPE) \ 392 V(CODE_CACHE_TYPE) \
392 V(POLYMORPHIC_CODE_CACHE_TYPE) \ 393 V(POLYMORPHIC_CODE_CACHE_TYPE) \
393 V(TYPE_FEEDBACK_INFO_TYPE) \ 394 V(TYPE_FEEDBACK_INFO_TYPE) \
394 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ 395 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \
395 \ 396 \
396 V(FIXED_ARRAY_TYPE) \ 397 V(FIXED_ARRAY_TYPE) \
397 V(FIXED_DOUBLE_ARRAY_TYPE) \ 398 V(FIXED_DOUBLE_ARRAY_TYPE) \
398 V(SHARED_FUNCTION_INFO_TYPE) \ 399 V(SHARED_FUNCTION_INFO_TYPE) \
399 \ 400 \
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 V(EXECUTABLE_ACCESSOR_INFO, ExecutableAccessorInfo, executable_accessor_info)\ 544 V(EXECUTABLE_ACCESSOR_INFO, ExecutableAccessorInfo, executable_accessor_info)\
544 V(ACCESSOR_PAIR, AccessorPair, accessor_pair) \ 545 V(ACCESSOR_PAIR, AccessorPair, accessor_pair) \
545 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \ 546 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \
546 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \ 547 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \
547 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \ 548 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \
548 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ 549 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \
549 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ 550 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \
550 V(SIGNATURE_INFO, SignatureInfo, signature_info) \ 551 V(SIGNATURE_INFO, SignatureInfo, signature_info) \
551 V(TYPE_SWITCH_INFO, TypeSwitchInfo, type_switch_info) \ 552 V(TYPE_SWITCH_INFO, TypeSwitchInfo, type_switch_info) \
552 V(SCRIPT, Script, script) \ 553 V(SCRIPT, Script, script) \
554 V(ALLOCATION_SITE, AllocationSite, allocation_site) \
553 V(ALLOCATION_SITE_INFO, AllocationSiteInfo, allocation_site_info) \ 555 V(ALLOCATION_SITE_INFO, AllocationSiteInfo, allocation_site_info) \
554 V(CODE_CACHE, CodeCache, code_cache) \ 556 V(CODE_CACHE, CodeCache, code_cache) \
555 V(POLYMORPHIC_CODE_CACHE, PolymorphicCodeCache, polymorphic_code_cache) \ 557 V(POLYMORPHIC_CODE_CACHE, PolymorphicCodeCache, polymorphic_code_cache) \
556 V(TYPE_FEEDBACK_INFO, TypeFeedbackInfo, type_feedback_info) \ 558 V(TYPE_FEEDBACK_INFO, TypeFeedbackInfo, type_feedback_info) \
557 V(ALIASED_ARGUMENTS_ENTRY, AliasedArgumentsEntry, aliased_arguments_entry) 559 V(ALIASED_ARGUMENTS_ENTRY, AliasedArgumentsEntry, aliased_arguments_entry)
558 560
559 #ifdef ENABLE_DEBUGGER_SUPPORT 561 #ifdef ENABLE_DEBUGGER_SUPPORT
560 #define STRUCT_LIST_DEBUGGER(V) \ 562 #define STRUCT_LIST_DEBUGGER(V) \
561 V(DEBUG_INFO, DebugInfo, debug_info) \ 563 V(DEBUG_INFO, DebugInfo, debug_info) \
562 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) 564 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info)
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 DECLARED_ACCESSOR_INFO_TYPE, 704 DECLARED_ACCESSOR_INFO_TYPE,
703 EXECUTABLE_ACCESSOR_INFO_TYPE, 705 EXECUTABLE_ACCESSOR_INFO_TYPE,
704 ACCESSOR_PAIR_TYPE, 706 ACCESSOR_PAIR_TYPE,
705 ACCESS_CHECK_INFO_TYPE, 707 ACCESS_CHECK_INFO_TYPE,
706 INTERCEPTOR_INFO_TYPE, 708 INTERCEPTOR_INFO_TYPE,
707 CALL_HANDLER_INFO_TYPE, 709 CALL_HANDLER_INFO_TYPE,
708 FUNCTION_TEMPLATE_INFO_TYPE, 710 FUNCTION_TEMPLATE_INFO_TYPE,
709 OBJECT_TEMPLATE_INFO_TYPE, 711 OBJECT_TEMPLATE_INFO_TYPE,
710 SIGNATURE_INFO_TYPE, 712 SIGNATURE_INFO_TYPE,
711 TYPE_SWITCH_INFO_TYPE, 713 TYPE_SWITCH_INFO_TYPE,
714 ALLOCATION_SITE_TYPE,
712 ALLOCATION_SITE_INFO_TYPE, 715 ALLOCATION_SITE_INFO_TYPE,
713 SCRIPT_TYPE, 716 SCRIPT_TYPE,
714 CODE_CACHE_TYPE, 717 CODE_CACHE_TYPE,
715 POLYMORPHIC_CODE_CACHE_TYPE, 718 POLYMORPHIC_CODE_CACHE_TYPE,
716 TYPE_FEEDBACK_INFO_TYPE, 719 TYPE_FEEDBACK_INFO_TYPE,
717 ALIASED_ARGUMENTS_ENTRY_TYPE, 720 ALIASED_ARGUMENTS_ENTRY_TYPE,
718 // The following two instance types are only used when ENABLE_DEBUGGER_SUPPORT 721 // The following two instance types are only used when ENABLE_DEBUGGER_SUPPORT
719 // is defined. However as include/v8.h contain some of the instance type 722 // is defined. However as include/v8.h contain some of the instance type
720 // constants always having them avoids them getting different numbers 723 // constants always having them avoids them getting different numbers
721 // depending on whether ENABLE_DEBUGGER_SUPPORT is defined or not. 724 // depending on whether ENABLE_DEBUGGER_SUPPORT is defined or not.
(...skipping 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after
2203 inline MUST_USE_RESULT MaybeObject* GetElementsTransitionMap( 2206 inline MUST_USE_RESULT MaybeObject* GetElementsTransitionMap(
2204 Isolate* isolate, 2207 Isolate* isolate,
2205 ElementsKind elements_kind); 2208 ElementsKind elements_kind);
2206 MUST_USE_RESULT MaybeObject* GetElementsTransitionMapSlow( 2209 MUST_USE_RESULT MaybeObject* GetElementsTransitionMapSlow(
2207 ElementsKind elements_kind); 2210 ElementsKind elements_kind);
2208 2211
2209 static Handle<Object> TransitionElementsKind(Handle<JSObject> object, 2212 static Handle<Object> TransitionElementsKind(Handle<JSObject> object,
2210 ElementsKind to_kind); 2213 ElementsKind to_kind);
2211 2214
2212 MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind); 2215 MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind);
2213 MUST_USE_RESULT MaybeObject* UpdateAllocationSiteInfo( 2216 MUST_USE_RESULT MaybeObject* UpdateAllocationSite(ElementsKind to_kind);
2214 ElementsKind to_kind);
2215 2217
2216 // Replaces an existing transition with a transition to a map with a FIELD. 2218 // Replaces an existing transition with a transition to a map with a FIELD.
2217 MUST_USE_RESULT MaybeObject* ConvertTransitionToMapTransition( 2219 MUST_USE_RESULT MaybeObject* ConvertTransitionToMapTransition(
2218 int transition_index, 2220 int transition_index,
2219 Name* name, 2221 Name* name,
2220 Object* new_value, 2222 Object* new_value,
2221 PropertyAttributes attributes); 2223 PropertyAttributes attributes);
2222 2224
2223 // Converts a descriptor of any other type to a real field, backed by the 2225 // Converts a descriptor of any other type to a real field, backed by the
2224 // properties array. 2226 // properties array.
(...skipping 5229 matching lines...) Expand 10 before | Expand all | Expand 10 after
7454 }; 7456 };
7455 7457
7456 7458
7457 enum AllocationSiteMode { 7459 enum AllocationSiteMode {
7458 DONT_TRACK_ALLOCATION_SITE, 7460 DONT_TRACK_ALLOCATION_SITE,
7459 TRACK_ALLOCATION_SITE, 7461 TRACK_ALLOCATION_SITE,
7460 LAST_ALLOCATION_SITE_MODE = TRACK_ALLOCATION_SITE 7462 LAST_ALLOCATION_SITE_MODE = TRACK_ALLOCATION_SITE
7461 }; 7463 };
7462 7464
7463 7465
7466 class AllocationSite: public Struct {
7467 public:
7468 static const int kPayloadOffset = HeapObject::kHeaderSize;
7469 static const int kSize = kPayloadOffset + kPointerSize;
7470 static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024;
7471
7472 // TODO(mvstanton): rename payload to transition_info.
7473 DECL_ACCESSORS(payload, Object)
7474
7475 void Initialize() {
7476 SetElementsKindPayload(GetInitialFastElementsKind());
7477 }
7478
7479 ElementsKind GetElementsKindPayload() {
7480 ASSERT(!IsLiteralSite());
7481 return static_cast<ElementsKind>(Smi::cast(payload())->value());
7482 }
7483
7484 void SetElementsKindPayload(ElementsKind kind) {
7485 set_payload(Smi::FromInt(static_cast<int>(kind)));
7486 }
7487
7488 bool IsLiteralSite() {
7489 // If the payload is a smi, then it represents an ElementsKind
7490 // for a constructed array. Otherwise, it must be a boilerplate
7491 // for an array literal
7492 return payload()->IsJSArray();
7493 }
7494
7495 DECLARE_PRINTER(AllocationSite)
7496 DECLARE_VERIFIER(AllocationSite)
7497
7498 static inline AllocationSite* cast(Object* obj);
7499 static inline AllocationSiteMode GetMode(
7500 ElementsKind boilerplate_elements_kind);
7501 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to);
7502
7503 private:
7504 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSite);
7505 };
7506
7507
7464 class AllocationSiteInfo: public Struct { 7508 class AllocationSiteInfo: public Struct {
7465 public: 7509 public:
7466 DECL_ACCESSORS(payload, Object) 7510 static const int kAllocationSiteOffset = HeapObject::kHeaderSize;
7511 static const int kSize = kAllocationSiteOffset + kPointerSize;
7467 7512
7468 static inline AllocationSiteInfo* cast(Object* obj); 7513 DECL_ACCESSORS(allocation_site, Object)
7514
7515 bool IsValid() { return allocation_site()->IsAllocationSite(); }
7516 AllocationSite* GetAllocationSite() {
7517 ASSERT(IsValid());
7518 return AllocationSite::cast(allocation_site());
7519 }
7469 7520
7470 DECLARE_PRINTER(AllocationSiteInfo) 7521 DECLARE_PRINTER(AllocationSiteInfo)
7471 DECLARE_VERIFIER(AllocationSiteInfo) 7522 DECLARE_VERIFIER(AllocationSiteInfo)
7472 7523
7473 // Returns NULL if no AllocationSiteInfo is available for object. 7524 // Returns NULL if no AllocationSiteInfo is available for object.
7474 static AllocationSiteInfo* FindForJSObject(JSObject* object); 7525 static AllocationSiteInfo* FindForJSObject(JSObject* object);
7475 static inline AllocationSiteMode GetMode( 7526 static inline AllocationSiteInfo* cast(Object* obj);
7476 ElementsKind boilerplate_elements_kind);
7477 static inline AllocationSiteMode GetMode(ElementsKind from, ElementsKind to);
7478 7527
7479 static const int kPayloadOffset = HeapObject::kHeaderSize;
7480 static const int kSize = kPayloadOffset + kPointerSize;
7481 static const uint32_t kMaximumArrayBytesToPretransition = 8 * 1024;
7482
7483 bool GetElementsKindPayload(ElementsKind* kind);
7484 private: 7528 private:
7485 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSiteInfo); 7529 DISALLOW_IMPLICIT_CONSTRUCTORS(AllocationSiteInfo);
7486 }; 7530 };
7487 7531
7488 7532
7489 // Representation of a slow alias as part of a non-strict arguments objects. 7533 // Representation of a slow alias as part of a non-strict arguments objects.
7490 // For fast aliases (if HasNonStrictArgumentsElements()): 7534 // For fast aliases (if HasNonStrictArgumentsElements()):
7491 // - the parameter map contains an index into the context 7535 // - the parameter map contains an index into the context
7492 // - all attributes of the element have default values 7536 // - all attributes of the element have default values
7493 // For slow aliases (if HasDictionaryArgumentsElements()): 7537 // For slow aliases (if HasDictionaryArgumentsElements()):
(...skipping 2273 matching lines...) Expand 10 before | Expand all | Expand 10 after
9767 } else { 9811 } else {
9768 value &= ~(1 << bit_position); 9812 value &= ~(1 << bit_position);
9769 } 9813 }
9770 return value; 9814 return value;
9771 } 9815 }
9772 }; 9816 };
9773 9817
9774 } } // namespace v8::internal 9818 } } // namespace v8::internal
9775 9819
9776 #endif // V8_OBJECTS_H_ 9820 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698