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

Side by Side Diff: src/objects.h

Issue 6529032: Merge 6168:6800 from bleeding_edge to experimental/gc branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 9 years, 10 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/mirror-debugger.js ('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 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // - Smi (immediate small integer) 47 // - Smi (immediate small integer)
48 // - HeapObject (superclass for everything allocated in the heap) 48 // - HeapObject (superclass for everything allocated in the heap)
49 // - JSObject 49 // - JSObject
50 // - JSArray 50 // - JSArray
51 // - JSRegExp 51 // - JSRegExp
52 // - JSFunction 52 // - JSFunction
53 // - GlobalObject 53 // - GlobalObject
54 // - JSGlobalObject 54 // - JSGlobalObject
55 // - JSBuiltinsObject 55 // - JSBuiltinsObject
56 // - JSGlobalProxy 56 // - JSGlobalProxy
57 // - JSValue 57 // - JSValue
58 // - JSMessageObject
58 // - ByteArray 59 // - ByteArray
59 // - PixelArray 60 // - PixelArray
60 // - ExternalArray 61 // - ExternalArray
61 // - ExternalByteArray 62 // - ExternalByteArray
62 // - ExternalUnsignedByteArray 63 // - ExternalUnsignedByteArray
63 // - ExternalShortArray 64 // - ExternalShortArray
64 // - ExternalUnsignedShortArray 65 // - ExternalUnsignedShortArray
65 // - ExternalIntArray 66 // - ExternalIntArray
66 // - ExternalUnsignedIntArray 67 // - ExternalUnsignedIntArray
67 // - ExternalFloatArray 68 // - ExternalFloatArray
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 V(FUNCTION_TEMPLATE_INFO_TYPE) \ 282 V(FUNCTION_TEMPLATE_INFO_TYPE) \
282 V(OBJECT_TEMPLATE_INFO_TYPE) \ 283 V(OBJECT_TEMPLATE_INFO_TYPE) \
283 V(SIGNATURE_INFO_TYPE) \ 284 V(SIGNATURE_INFO_TYPE) \
284 V(TYPE_SWITCH_INFO_TYPE) \ 285 V(TYPE_SWITCH_INFO_TYPE) \
285 V(SCRIPT_TYPE) \ 286 V(SCRIPT_TYPE) \
286 V(CODE_CACHE_TYPE) \ 287 V(CODE_CACHE_TYPE) \
287 \ 288 \
288 V(FIXED_ARRAY_TYPE) \ 289 V(FIXED_ARRAY_TYPE) \
289 V(SHARED_FUNCTION_INFO_TYPE) \ 290 V(SHARED_FUNCTION_INFO_TYPE) \
290 \ 291 \
292 V(JS_MESSAGE_OBJECT_TYPE) \
293 \
291 V(JS_VALUE_TYPE) \ 294 V(JS_VALUE_TYPE) \
292 V(JS_OBJECT_TYPE) \ 295 V(JS_OBJECT_TYPE) \
293 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ 296 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \
294 V(JS_GLOBAL_OBJECT_TYPE) \ 297 V(JS_GLOBAL_OBJECT_TYPE) \
295 V(JS_BUILTINS_OBJECT_TYPE) \ 298 V(JS_BUILTINS_OBJECT_TYPE) \
296 V(JS_GLOBAL_PROXY_TYPE) \ 299 V(JS_GLOBAL_PROXY_TYPE) \
297 V(JS_ARRAY_TYPE) \ 300 V(JS_ARRAY_TYPE) \
298 V(JS_REGEXP_TYPE) \ 301 V(JS_REGEXP_TYPE) \
299 \ 302 \
300 V(JS_FUNCTION_TYPE) \ 303 V(JS_FUNCTION_TYPE) \
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 // heap.cc and mark-compact.cc. 451 // heap.cc and mark-compact.cc.
449 const uint32_t kShortcutTypeMask = 452 const uint32_t kShortcutTypeMask =
450 kIsNotStringMask | 453 kIsNotStringMask |
451 kIsSymbolMask | 454 kIsSymbolMask |
452 kStringRepresentationMask; 455 kStringRepresentationMask;
453 const uint32_t kShortcutTypeTag = kConsStringTag; 456 const uint32_t kShortcutTypeTag = kConsStringTag;
454 457
455 458
456 enum InstanceType { 459 enum InstanceType {
457 // String types. 460 // String types.
461 // FIRST_STRING_TYPE
458 SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | kSeqStringTag, 462 SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | kSeqStringTag,
459 ASCII_SYMBOL_TYPE = kAsciiStringTag | kSymbolTag | kSeqStringTag, 463 ASCII_SYMBOL_TYPE = kAsciiStringTag | kSymbolTag | kSeqStringTag,
460 CONS_SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | kConsStringTag, 464 CONS_SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | kConsStringTag,
461 CONS_ASCII_SYMBOL_TYPE = kAsciiStringTag | kSymbolTag | kConsStringTag, 465 CONS_ASCII_SYMBOL_TYPE = kAsciiStringTag | kSymbolTag | kConsStringTag,
462 EXTERNAL_SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | kExternalStringTag, 466 EXTERNAL_SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | kExternalStringTag,
463 EXTERNAL_SYMBOL_WITH_ASCII_DATA_TYPE = 467 EXTERNAL_SYMBOL_WITH_ASCII_DATA_TYPE =
464 kTwoByteStringTag | kSymbolTag | kExternalStringTag | kAsciiDataHintTag, 468 kTwoByteStringTag | kSymbolTag | kExternalStringTag | kAsciiDataHintTag,
465 EXTERNAL_ASCII_SYMBOL_TYPE = 469 EXTERNAL_ASCII_SYMBOL_TYPE =
466 kAsciiStringTag | kSymbolTag | kExternalStringTag, 470 kAsciiStringTag | kSymbolTag | kExternalStringTag,
467 STRING_TYPE = kTwoByteStringTag | kSeqStringTag, 471 STRING_TYPE = kTwoByteStringTag | kSeqStringTag,
468 ASCII_STRING_TYPE = kAsciiStringTag | kSeqStringTag, 472 ASCII_STRING_TYPE = kAsciiStringTag | kSeqStringTag,
469 CONS_STRING_TYPE = kTwoByteStringTag | kConsStringTag, 473 CONS_STRING_TYPE = kTwoByteStringTag | kConsStringTag,
470 CONS_ASCII_STRING_TYPE = kAsciiStringTag | kConsStringTag, 474 CONS_ASCII_STRING_TYPE = kAsciiStringTag | kConsStringTag,
471 EXTERNAL_STRING_TYPE = kTwoByteStringTag | kExternalStringTag, 475 EXTERNAL_STRING_TYPE = kTwoByteStringTag | kExternalStringTag,
472 EXTERNAL_STRING_WITH_ASCII_DATA_TYPE = 476 EXTERNAL_STRING_WITH_ASCII_DATA_TYPE =
473 kTwoByteStringTag | kExternalStringTag | kAsciiDataHintTag, 477 kTwoByteStringTag | kExternalStringTag | kAsciiDataHintTag,
478 // LAST_STRING_TYPE
474 EXTERNAL_ASCII_STRING_TYPE = kAsciiStringTag | kExternalStringTag, 479 EXTERNAL_ASCII_STRING_TYPE = kAsciiStringTag | kExternalStringTag,
475 PRIVATE_EXTERNAL_ASCII_STRING_TYPE = EXTERNAL_ASCII_STRING_TYPE, 480 PRIVATE_EXTERNAL_ASCII_STRING_TYPE = EXTERNAL_ASCII_STRING_TYPE,
476 481
477 // Objects allocated in their own spaces (never in new space). 482 // Objects allocated in their own spaces (never in new space).
478 MAP_TYPE = kNotStringTag, // FIRST_NONSTRING_TYPE 483 MAP_TYPE = kNotStringTag, // FIRST_NONSTRING_TYPE
479 CODE_TYPE, 484 CODE_TYPE,
480 ODDBALL_TYPE, 485 ODDBALL_TYPE,
481 JS_GLOBAL_PROPERTY_CELL_TYPE, 486 JS_GLOBAL_PROPERTY_CELL_TYPE,
482 487
483 // "Data", objects that cannot contain non-map-word pointers to heap 488 // "Data", objects that cannot contain non-map-word pointers to heap
(...skipping 25 matching lines...) Expand all
509 // The following two instance types are only used when ENABLE_DEBUGGER_SUPPORT 514 // The following two instance types are only used when ENABLE_DEBUGGER_SUPPORT
510 // is defined. However as include/v8.h contain some of the instance type 515 // is defined. However as include/v8.h contain some of the instance type
511 // constants always having them avoids them getting different numbers 516 // constants always having them avoids them getting different numbers
512 // depending on whether ENABLE_DEBUGGER_SUPPORT is defined or not. 517 // depending on whether ENABLE_DEBUGGER_SUPPORT is defined or not.
513 DEBUG_INFO_TYPE, 518 DEBUG_INFO_TYPE,
514 BREAK_POINT_INFO_TYPE, 519 BREAK_POINT_INFO_TYPE,
515 520
516 FIXED_ARRAY_TYPE, 521 FIXED_ARRAY_TYPE,
517 SHARED_FUNCTION_INFO_TYPE, 522 SHARED_FUNCTION_INFO_TYPE,
518 523
524 JS_MESSAGE_OBJECT_TYPE,
525
519 JS_VALUE_TYPE, // FIRST_JS_OBJECT_TYPE 526 JS_VALUE_TYPE, // FIRST_JS_OBJECT_TYPE
520 JS_OBJECT_TYPE, 527 JS_OBJECT_TYPE,
521 JS_CONTEXT_EXTENSION_OBJECT_TYPE, 528 JS_CONTEXT_EXTENSION_OBJECT_TYPE,
522 JS_GLOBAL_OBJECT_TYPE, 529 JS_GLOBAL_OBJECT_TYPE,
523 JS_BUILTINS_OBJECT_TYPE, 530 JS_BUILTINS_OBJECT_TYPE,
524 JS_GLOBAL_PROXY_TYPE, 531 JS_GLOBAL_PROXY_TYPE,
525 JS_ARRAY_TYPE, 532 JS_ARRAY_TYPE,
526 JS_REGEXP_TYPE, // LAST_JS_OBJECT_TYPE 533
534 JS_REGEXP_TYPE, // LAST_JS_OBJECT_TYPE, FIRST_FUNCTION_CLASS_TYPE
527 535
528 JS_FUNCTION_TYPE, 536 JS_FUNCTION_TYPE,
529 537
530 // Pseudo-types 538 // Pseudo-types
531 FIRST_TYPE = 0x0, 539 FIRST_TYPE = 0x0,
532 LAST_TYPE = JS_FUNCTION_TYPE, 540 LAST_TYPE = JS_FUNCTION_TYPE,
533 INVALID_TYPE = FIRST_TYPE - 1, 541 INVALID_TYPE = FIRST_TYPE - 1,
534 FIRST_NONSTRING_TYPE = MAP_TYPE, 542 FIRST_NONSTRING_TYPE = MAP_TYPE,
543 FIRST_STRING_TYPE = FIRST_TYPE,
544 LAST_STRING_TYPE = FIRST_NONSTRING_TYPE - 1,
535 // Boundaries for testing for an external array. 545 // Boundaries for testing for an external array.
536 FIRST_EXTERNAL_ARRAY_TYPE = EXTERNAL_BYTE_ARRAY_TYPE, 546 FIRST_EXTERNAL_ARRAY_TYPE = EXTERNAL_BYTE_ARRAY_TYPE,
537 LAST_EXTERNAL_ARRAY_TYPE = EXTERNAL_FLOAT_ARRAY_TYPE, 547 LAST_EXTERNAL_ARRAY_TYPE = EXTERNAL_FLOAT_ARRAY_TYPE,
538 // Boundary for promotion to old data space/old pointer space. 548 // Boundary for promotion to old data space/old pointer space.
539 LAST_DATA_TYPE = FILLER_TYPE, 549 LAST_DATA_TYPE = FILLER_TYPE,
540 // Boundaries for testing the type is a JavaScript "object". Note that 550 // Boundaries for testing the type is a JavaScript "object". Note that
541 // function objects are not counted as objects, even though they are 551 // function objects are not counted as objects, even though they are
542 // implemented as such; only values whose typeof is "object" are included. 552 // implemented as such; only values whose typeof is "object" are included.
543 FIRST_JS_OBJECT_TYPE = JS_VALUE_TYPE, 553 FIRST_JS_OBJECT_TYPE = JS_VALUE_TYPE,
544 LAST_JS_OBJECT_TYPE = JS_REGEXP_TYPE 554 LAST_JS_OBJECT_TYPE = JS_REGEXP_TYPE,
555 // RegExp objects have [[Class]] "function" because they are callable.
556 // All types from this type and above are objects with [[Class]] "function".
557 FIRST_FUNCTION_CLASS_TYPE = JS_REGEXP_TYPE
545 }; 558 };
546 559
547 560
548 STATIC_CHECK(JS_OBJECT_TYPE == Internals::kJSObjectType); 561 STATIC_CHECK(JS_OBJECT_TYPE == Internals::kJSObjectType);
549 STATIC_CHECK(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType); 562 STATIC_CHECK(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType);
550 STATIC_CHECK(PROXY_TYPE == Internals::kProxyType); 563 STATIC_CHECK(PROXY_TYPE == Internals::kProxyType);
551 564
552 565
553 enum CompareResult { 566 enum CompareResult {
554 LESS = -1, 567 LESS = -1,
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 } 630 }
618 void Print(FILE* out); 631 void Print(FILE* out);
619 void PrintLn(FILE* out); 632 void PrintLn(FILE* out);
620 #endif 633 #endif
621 #ifdef DEBUG 634 #ifdef DEBUG
622 // Verifies the object. 635 // Verifies the object.
623 void Verify(); 636 void Verify();
624 #endif 637 #endif
625 }; 638 };
626 639
640
641 #define OBJECT_TYPE_LIST(V) \
642 V(Smi) \
643 V(HeapObject) \
644 V(Number) \
645
646 #define HEAP_OBJECT_TYPE_LIST(V) \
647 V(HeapNumber) \
648 V(String) \
649 V(Symbol) \
650 V(SeqString) \
651 V(ExternalString) \
652 V(ConsString) \
653 V(ExternalTwoByteString) \
654 V(ExternalAsciiString) \
655 V(SeqTwoByteString) \
656 V(SeqAsciiString) \
657 \
658 V(PixelArray) \
659 V(ExternalArray) \
660 V(ExternalByteArray) \
661 V(ExternalUnsignedByteArray) \
662 V(ExternalShortArray) \
663 V(ExternalUnsignedShortArray) \
664 V(ExternalIntArray) \
665 V(ExternalUnsignedIntArray) \
666 V(ExternalFloatArray) \
667 V(ByteArray) \
668 V(JSObject) \
669 V(JSContextExtensionObject) \
670 V(Map) \
671 V(DescriptorArray) \
672 V(DeoptimizationInputData) \
673 V(DeoptimizationOutputData) \
674 V(FixedArray) \
675 V(Context) \
676 V(CatchContext) \
677 V(GlobalContext) \
678 V(JSFunction) \
679 V(Code) \
680 V(Oddball) \
681 V(SharedFunctionInfo) \
682 V(JSValue) \
683 V(JSMessageObject) \
684 V(StringWrapper) \
685 V(Proxy) \
686 V(Boolean) \
687 V(JSArray) \
688 V(JSRegExp) \
689 V(HashTable) \
690 V(Dictionary) \
691 V(SymbolTable) \
692 V(JSFunctionResultCache) \
693 V(NormalizedMapCache) \
694 V(CompilationCacheTable) \
695 V(CodeCacheHashTable) \
696 V(MapCache) \
697 V(Primitive) \
698 V(GlobalObject) \
699 V(JSGlobalObject) \
700 V(JSBuiltinsObject) \
701 V(JSGlobalProxy) \
702 V(UndetectableObject) \
703 V(AccessCheckNeeded) \
704 V(JSGlobalPropertyCell) \
705
627 // Object is the abstract superclass for all classes in the 706 // Object is the abstract superclass for all classes in the
628 // object hierarchy. 707 // object hierarchy.
629 // Object does not use any virtual functions to avoid the 708 // Object does not use any virtual functions to avoid the
630 // allocation of the C++ vtable. 709 // allocation of the C++ vtable.
631 // Since Smi and Failure are subclasses of Object no 710 // Since Smi and Failure are subclasses of Object no
632 // data members can be present in Object. 711 // data members can be present in Object.
633 class Object : public MaybeObject { 712 class Object : public MaybeObject {
634 public: 713 public:
635 // Type testing. 714 // Type testing.
636 inline bool IsSmi(); 715 #define IS_TYPE_FUNCTION_DECL(type_) inline bool Is##type_();
637 inline bool IsHeapObject(); 716 OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DECL)
638 inline bool IsHeapNumber(); 717 HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DECL)
639 inline bool IsString(); 718 #undef IS_TYPE_FUNCTION_DECL
640 inline bool IsSymbol();
641 // See objects-inl.h for more details
642 inline bool IsSeqString();
643 inline bool IsExternalString();
644 inline bool IsExternalTwoByteString();
645 inline bool IsExternalAsciiString();
646 inline bool IsSeqTwoByteString();
647 inline bool IsSeqAsciiString();
648 inline bool IsConsString();
649
650 inline bool IsNumber();
651 inline bool IsByteArray();
652 inline bool IsPixelArray();
653 inline bool IsExternalArray();
654 inline bool IsExternalByteArray();
655 inline bool IsExternalUnsignedByteArray();
656 inline bool IsExternalShortArray();
657 inline bool IsExternalUnsignedShortArray();
658 inline bool IsExternalIntArray();
659 inline bool IsExternalUnsignedIntArray();
660 inline bool IsExternalFloatArray();
661 inline bool IsJSObject();
662 inline bool IsJSContextExtensionObject();
663 inline bool IsMap();
664 inline bool IsFixedArray();
665 inline bool IsDescriptorArray();
666 inline bool IsDeoptimizationInputData();
667 inline bool IsDeoptimizationOutputData();
668 inline bool IsContext();
669 inline bool IsCatchContext();
670 inline bool IsGlobalContext();
671 inline bool IsJSFunction();
672 inline bool IsCode();
673 inline bool IsOddball();
674 inline bool IsSharedFunctionInfo();
675 inline bool IsJSValue();
676 inline bool IsStringWrapper();
677 inline bool IsProxy();
678 inline bool IsBoolean();
679 inline bool IsJSArray();
680 inline bool IsJSRegExp();
681 inline bool IsHashTable();
682 inline bool IsDictionary();
683 inline bool IsSymbolTable();
684 inline bool IsJSFunctionResultCache();
685 inline bool IsNormalizedMapCache();
686 inline bool IsCompilationCacheTable();
687 inline bool IsCodeCacheHashTable();
688 inline bool IsMapCache();
689 inline bool IsPrimitive();
690 inline bool IsGlobalObject();
691 inline bool IsJSGlobalObject();
692 inline bool IsJSBuiltinsObject();
693 inline bool IsJSGlobalProxy();
694 inline bool IsUndetectableObject();
695 inline bool IsAccessCheckNeeded();
696 inline bool IsJSGlobalPropertyCell();
697 719
698 // Returns true if this object is an instance of the specified 720 // Returns true if this object is an instance of the specified
699 // function template. 721 // function template.
700 inline bool IsInstanceOf(FunctionTemplateInfo* type); 722 inline bool IsInstanceOf(FunctionTemplateInfo* type);
701 723
702 inline bool IsStruct(); 724 inline bool IsStruct();
703 #define DECLARE_STRUCT_PREDICATE(NAME, Name, name) inline bool Is##Name(); 725 #define DECLARE_STRUCT_PREDICATE(NAME, Name, name) inline bool Is##Name();
704 STRUCT_LIST(DECLARE_STRUCT_PREDICATE) 726 STRUCT_LIST(DECLARE_STRUCT_PREDICATE)
705 #undef DECLARE_STRUCT_PREDICATE 727 #undef DECLARE_STRUCT_PREDICATE
706 728
707 // Oddball testing. 729 // Oddball testing.
708 INLINE(bool IsUndefined()); 730 INLINE(bool IsUndefined());
709 INLINE(bool IsNull()); 731 INLINE(bool IsNull());
710 INLINE(bool IsTrue()); 732 INLINE(bool IsTrue());
711 INLINE(bool IsFalse()); 733 INLINE(bool IsFalse());
734 inline bool IsArgumentsMarker();
712 735
713 // Extract the number. 736 // Extract the number.
714 inline double Number(); 737 inline double Number();
715 738
716 inline bool HasSpecificClassOf(String* name); 739 inline bool HasSpecificClassOf(String* name);
717 740
718 MUST_USE_RESULT MaybeObject* ToObject(); // ECMA-262 9.9. 741 MUST_USE_RESULT MaybeObject* ToObject(); // ECMA-262 9.9.
719 Object* ToBoolean(); // ECMA-262 9.2. 742 Object* ToBoolean(); // ECMA-262 9.2.
720 743
721 // Convert to a JSObject if needed. 744 // Convert to a JSObject if needed.
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
1157 DISALLOW_IMPLICIT_CONSTRUCTORS(HeapNumber); 1180 DISALLOW_IMPLICIT_CONSTRUCTORS(HeapNumber);
1158 }; 1181 };
1159 1182
1160 1183
1161 // The JSObject describes real heap allocated JavaScript objects with 1184 // The JSObject describes real heap allocated JavaScript objects with
1162 // properties. 1185 // properties.
1163 // Note that the map of JSObject changes during execution to enable inline 1186 // Note that the map of JSObject changes during execution to enable inline
1164 // caching. 1187 // caching.
1165 class JSObject: public HeapObject { 1188 class JSObject: public HeapObject {
1166 public: 1189 public:
1167 enum DeleteMode { NORMAL_DELETION, FORCE_DELETION }; 1190 enum DeleteMode {
1191 NORMAL_DELETION,
1192 STRICT_DELETION,
1193 FORCE_DELETION
1194 };
1195
1168 enum ElementsKind { 1196 enum ElementsKind {
1169 // The only "fast" kind. 1197 // The only "fast" kind.
1170 FAST_ELEMENTS, 1198 FAST_ELEMENTS,
1171 // All the kinds below are "slow". 1199 // All the kinds below are "slow".
1172 DICTIONARY_ELEMENTS, 1200 DICTIONARY_ELEMENTS,
1173 PIXEL_ELEMENTS, 1201 PIXEL_ELEMENTS,
1174 EXTERNAL_BYTE_ELEMENTS, 1202 EXTERNAL_BYTE_ELEMENTS,
1175 EXTERNAL_UNSIGNED_BYTE_ELEMENTS, 1203 EXTERNAL_UNSIGNED_BYTE_ELEMENTS,
1176 EXTERNAL_SHORT_ELEMENTS, 1204 EXTERNAL_SHORT_ELEMENTS,
1177 EXTERNAL_UNSIGNED_SHORT_ELEMENTS, 1205 EXTERNAL_UNSIGNED_SHORT_ELEMENTS,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 MUST_USE_RESULT MaybeObject* SetProperty(String* key, 1263 MUST_USE_RESULT MaybeObject* SetProperty(String* key,
1236 Object* value, 1264 Object* value,
1237 PropertyAttributes attributes); 1265 PropertyAttributes attributes);
1238 MUST_USE_RESULT MaybeObject* SetProperty(LookupResult* result, 1266 MUST_USE_RESULT MaybeObject* SetProperty(LookupResult* result,
1239 String* key, 1267 String* key,
1240 Object* value, 1268 Object* value,
1241 PropertyAttributes attributes); 1269 PropertyAttributes attributes);
1242 MUST_USE_RESULT MaybeObject* SetPropertyWithFailedAccessCheck( 1270 MUST_USE_RESULT MaybeObject* SetPropertyWithFailedAccessCheck(
1243 LookupResult* result, 1271 LookupResult* result,
1244 String* name, 1272 String* name,
1245 Object* value); 1273 Object* value,
1274 bool check_prototype);
1246 MUST_USE_RESULT MaybeObject* SetPropertyWithCallback(Object* structure, 1275 MUST_USE_RESULT MaybeObject* SetPropertyWithCallback(Object* structure,
1247 String* name, 1276 String* name,
1248 Object* value, 1277 Object* value,
1249 JSObject* holder); 1278 JSObject* holder);
1250 MUST_USE_RESULT MaybeObject* SetPropertyWithDefinedSetter(JSFunction* setter, 1279 MUST_USE_RESULT MaybeObject* SetPropertyWithDefinedSetter(JSFunction* setter,
1251 Object* value); 1280 Object* value);
1252 MUST_USE_RESULT MaybeObject* SetPropertyWithInterceptor( 1281 MUST_USE_RESULT MaybeObject* SetPropertyWithInterceptor(
1253 String* name, 1282 String* name,
1254 Object* value, 1283 Object* value,
1255 PropertyAttributes attributes); 1284 PropertyAttributes attributes);
1256 MUST_USE_RESULT MaybeObject* SetPropertyPostInterceptor( 1285 MUST_USE_RESULT MaybeObject* SetPropertyPostInterceptor(
1257 String* name, 1286 String* name,
1258 Object* value, 1287 Object* value,
1259 PropertyAttributes attributes); 1288 PropertyAttributes attributes);
1260 MUST_USE_RESULT MaybeObject* IgnoreAttributesAndSetLocalProperty( 1289 MUST_USE_RESULT MaybeObject* SetLocalPropertyIgnoreAttributes(
1261 String* key, 1290 String* key,
1262 Object* value, 1291 Object* value,
1263 PropertyAttributes attributes); 1292 PropertyAttributes attributes);
1264 1293
1265 // Retrieve a value in a normalized object given a lookup result. 1294 // Retrieve a value in a normalized object given a lookup result.
1266 // Handles the special representation of JS global objects. 1295 // Handles the special representation of JS global objects.
1267 Object* GetNormalizedProperty(LookupResult* result); 1296 Object* GetNormalizedProperty(LookupResult* result);
1268 1297
1269 // Sets the property value in a normalized object given a lookup result. 1298 // Sets the property value in a normalized object given a lookup result.
1270 // Handles the special representation of JS global objects. 1299 // Handles the special representation of JS global objects.
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1449 // Lookup a property. If found, the result is valid and has 1478 // Lookup a property. If found, the result is valid and has
1450 // detailed information. 1479 // detailed information.
1451 void LocalLookup(String* name, LookupResult* result); 1480 void LocalLookup(String* name, LookupResult* result);
1452 void Lookup(String* name, LookupResult* result); 1481 void Lookup(String* name, LookupResult* result);
1453 1482
1454 // The following lookup functions skip interceptors. 1483 // The following lookup functions skip interceptors.
1455 void LocalLookupRealNamedProperty(String* name, LookupResult* result); 1484 void LocalLookupRealNamedProperty(String* name, LookupResult* result);
1456 void LookupRealNamedProperty(String* name, LookupResult* result); 1485 void LookupRealNamedProperty(String* name, LookupResult* result);
1457 void LookupRealNamedPropertyInPrototypes(String* name, LookupResult* result); 1486 void LookupRealNamedPropertyInPrototypes(String* name, LookupResult* result);
1458 void LookupCallbackSetterInPrototypes(String* name, LookupResult* result); 1487 void LookupCallbackSetterInPrototypes(String* name, LookupResult* result);
1459 bool SetElementWithCallbackSetterInPrototypes(uint32_t index, Object* value); 1488 MUST_USE_RESULT MaybeObject* SetElementWithCallbackSetterInPrototypes(
1489 uint32_t index, Object* value, bool* found);
1460 void LookupCallback(String* name, LookupResult* result); 1490 void LookupCallback(String* name, LookupResult* result);
1461 1491
1462 // Returns the number of properties on this object filtering out properties 1492 // Returns the number of properties on this object filtering out properties
1463 // with the specified attributes (ignoring interceptors). 1493 // with the specified attributes (ignoring interceptors).
1464 int NumberOfLocalProperties(PropertyAttributes filter); 1494 int NumberOfLocalProperties(PropertyAttributes filter);
1465 // Returns the number of enumerable properties (ignoring interceptors). 1495 // Returns the number of enumerable properties (ignoring interceptors).
1466 int NumberOfEnumProperties(); 1496 int NumberOfEnumProperties();
1467 // Fill in details for properties into storage starting at the specified 1497 // Fill in details for properties into storage starting at the specified
1468 // index. 1498 // index.
1469 void GetLocalPropertyNames(FixedArray* storage, int index); 1499 void GetLocalPropertyNames(FixedArray* storage, int index);
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after
2505 2535
2506 static const int kEntrySize = 2; // key + value 2536 static const int kEntrySize = 2; // key + value
2507 2537
2508 static const int kFactoryOffset = kHeaderSize; 2538 static const int kFactoryOffset = kHeaderSize;
2509 static const int kFingerOffset = kFactoryOffset + kPointerSize; 2539 static const int kFingerOffset = kFactoryOffset + kPointerSize;
2510 static const int kCacheSizeOffset = kFingerOffset + kPointerSize; 2540 static const int kCacheSizeOffset = kFingerOffset + kPointerSize;
2511 2541
2512 inline void MakeZeroSize(); 2542 inline void MakeZeroSize();
2513 inline void Clear(); 2543 inline void Clear();
2514 2544
2545 inline int size();
2546 inline void set_size(int size);
2547 inline int finger_index();
2548 inline void set_finger_index(int finger_index);
2549
2515 // Casting 2550 // Casting
2516 static inline JSFunctionResultCache* cast(Object* obj); 2551 static inline JSFunctionResultCache* cast(Object* obj);
2517 2552
2518 #ifdef DEBUG 2553 #ifdef DEBUG
2519 void JSFunctionResultCacheVerify(); 2554 void JSFunctionResultCacheVerify();
2520 #endif 2555 #endif
2521 }; 2556 };
2522 2557
2523 2558
2524 // The cache for maps used by normalized (dictionary mode) objects. 2559 // The cache for maps used by normalized (dictionary mode) objects.
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
3013 3048
3014 // Casting. 3049 // Casting.
3015 static inline DeoptimizationOutputData* cast(Object* obj); 3050 static inline DeoptimizationOutputData* cast(Object* obj);
3016 3051
3017 #ifdef OBJECT_PRINT 3052 #ifdef OBJECT_PRINT
3018 void DeoptimizationOutputDataPrint(FILE* out); 3053 void DeoptimizationOutputDataPrint(FILE* out);
3019 #endif 3054 #endif
3020 }; 3055 };
3021 3056
3022 3057
3058 class SafepointEntry;
3059
3060
3023 // Code describes objects with on-the-fly generated machine code. 3061 // Code describes objects with on-the-fly generated machine code.
3024 class Code: public HeapObject { 3062 class Code: public HeapObject {
3025 public: 3063 public:
3026 // Opaque data type for encapsulating code flags like kind, inline 3064 // Opaque data type for encapsulating code flags like kind, inline
3027 // cache state, and arguments count. 3065 // cache state, and arguments count.
3028 // FLAGS_MIN_VALUE and FLAGS_MAX_VALUE are specified to ensure that 3066 // FLAGS_MIN_VALUE and FLAGS_MAX_VALUE are specified to ensure that
3029 // enumeration type has correct value range (see Issue 830 for more details). 3067 // enumeration type has correct value range (see Issue 830 for more details).
3030 enum Flags { 3068 enum Flags {
3031 FLAGS_MIN_VALUE = kMinInt, 3069 FLAGS_MIN_VALUE = kMinInt,
3032 FLAGS_MAX_VALUE = kMaxInt 3070 FLAGS_MAX_VALUE = kMaxInt
(...skipping 19 matching lines...) Expand all
3052 // Pseudo-kinds. 3090 // Pseudo-kinds.
3053 REGEXP = BUILTIN, 3091 REGEXP = BUILTIN,
3054 FIRST_IC_KIND = LOAD_IC, 3092 FIRST_IC_KIND = LOAD_IC,
3055 LAST_IC_KIND = COMPARE_IC 3093 LAST_IC_KIND = COMPARE_IC
3056 }; 3094 };
3057 3095
3058 enum { 3096 enum {
3059 NUMBER_OF_KINDS = LAST_IC_KIND + 1 3097 NUMBER_OF_KINDS = LAST_IC_KIND + 1
3060 }; 3098 };
3061 3099
3100 typedef int ExtraICState;
3101
3102 static const ExtraICState kNoExtraICState = 0;
3103
3062 #ifdef ENABLE_DISASSEMBLER 3104 #ifdef ENABLE_DISASSEMBLER
3063 // Printing 3105 // Printing
3064 static const char* Kind2String(Kind kind); 3106 static const char* Kind2String(Kind kind);
3065 static const char* ICState2String(InlineCacheState state); 3107 static const char* ICState2String(InlineCacheState state);
3066 static const char* PropertyType2String(PropertyType type); 3108 static const char* PropertyType2String(PropertyType type);
3109 static void PrintExtraICState(FILE* out, Kind kind, ExtraICState extra);
3067 inline void Disassemble(const char* name) { 3110 inline void Disassemble(const char* name) {
3068 Disassemble(name, stdout); 3111 Disassemble(name, stdout);
3069 } 3112 }
3070 void Disassemble(const char* name, FILE* out); 3113 void Disassemble(const char* name, FILE* out);
3071 #endif // ENABLE_DISASSEMBLER 3114 #endif // ENABLE_DISASSEMBLER
3072 3115
3073 // [instruction_size]: Size of the native instructions 3116 // [instruction_size]: Size of the native instructions
3074 inline int instruction_size(); 3117 inline int instruction_size();
3075 inline void set_instruction_size(int value); 3118 inline void set_instruction_size(int value);
3076 3119
(...skipping 10 matching lines...) Expand all
3087 3130
3088 inline int relocation_size(); 3131 inline int relocation_size();
3089 3132
3090 // [flags]: Various code flags. 3133 // [flags]: Various code flags.
3091 inline Flags flags(); 3134 inline Flags flags();
3092 inline void set_flags(Flags flags); 3135 inline void set_flags(Flags flags);
3093 3136
3094 // [flags]: Access to specific code flags. 3137 // [flags]: Access to specific code flags.
3095 inline Kind kind(); 3138 inline Kind kind();
3096 inline InlineCacheState ic_state(); // Only valid for IC stubs. 3139 inline InlineCacheState ic_state(); // Only valid for IC stubs.
3140 inline ExtraICState extra_ic_state(); // Only valid for IC stubs.
3097 inline InLoopFlag ic_in_loop(); // Only valid for IC stubs. 3141 inline InLoopFlag ic_in_loop(); // Only valid for IC stubs.
3098 inline PropertyType type(); // Only valid for monomorphic IC stubs. 3142 inline PropertyType type(); // Only valid for monomorphic IC stubs.
3099 inline int arguments_count(); // Only valid for call IC stubs. 3143 inline int arguments_count(); // Only valid for call IC stubs.
3100 3144
3101 // Testers for IC stub kinds. 3145 // Testers for IC stub kinds.
3102 inline bool is_inline_cache_stub(); 3146 inline bool is_inline_cache_stub();
3103 inline bool is_load_stub() { return kind() == LOAD_IC; } 3147 inline bool is_load_stub() { return kind() == LOAD_IC; }
3104 inline bool is_keyed_load_stub() { return kind() == KEYED_LOAD_IC; } 3148 inline bool is_keyed_load_stub() { return kind() == KEYED_LOAD_IC; }
3105 inline bool is_store_stub() { return kind() == STORE_IC; } 3149 inline bool is_store_stub() { return kind() == STORE_IC; }
3106 inline bool is_keyed_store_stub() { return kind() == KEYED_STORE_IC; } 3150 inline bool is_keyed_store_stub() { return kind() == KEYED_STORE_IC; }
(...skipping 25 matching lines...) Expand all
3132 inline void set_allow_osr_at_loop_nesting_level(int level); 3176 inline void set_allow_osr_at_loop_nesting_level(int level);
3133 inline int allow_osr_at_loop_nesting_level(); 3177 inline int allow_osr_at_loop_nesting_level();
3134 3178
3135 // [stack_slots]: For kind OPTIMIZED_FUNCTION, the number of stack slots 3179 // [stack_slots]: For kind OPTIMIZED_FUNCTION, the number of stack slots
3136 // reserved in the code prologue. 3180 // reserved in the code prologue.
3137 inline unsigned stack_slots(); 3181 inline unsigned stack_slots();
3138 inline void set_stack_slots(unsigned slots); 3182 inline void set_stack_slots(unsigned slots);
3139 3183
3140 // [safepoint_table_start]: For kind OPTIMIZED_CODE, the offset in 3184 // [safepoint_table_start]: For kind OPTIMIZED_CODE, the offset in
3141 // the instruction stream where the safepoint table starts. 3185 // the instruction stream where the safepoint table starts.
3142 inline unsigned safepoint_table_start(); 3186 inline unsigned safepoint_table_offset();
3143 inline void set_safepoint_table_start(unsigned offset); 3187 inline void set_safepoint_table_offset(unsigned offset);
3144 3188
3145 // [stack_check_table_start]: For kind FUNCTION, the offset in the 3189 // [stack_check_table_start]: For kind FUNCTION, the offset in the
3146 // instruction stream where the stack check table starts. 3190 // instruction stream where the stack check table starts.
3147 inline unsigned stack_check_table_start(); 3191 inline unsigned stack_check_table_offset();
3148 inline void set_stack_check_table_start(unsigned offset); 3192 inline void set_stack_check_table_offset(unsigned offset);
3149 3193
3150 // [check type]: For kind CALL_IC, tells how to check if the 3194 // [check type]: For kind CALL_IC, tells how to check if the
3151 // receiver is valid for the given call. 3195 // receiver is valid for the given call.
3152 inline CheckType check_type(); 3196 inline CheckType check_type();
3153 inline void set_check_type(CheckType value); 3197 inline void set_check_type(CheckType value);
3154 3198
3155 // [binary op type]: For all BINARY_OP_IC. 3199 // [binary op type]: For all BINARY_OP_IC.
3156 inline byte binary_op_type(); 3200 inline byte binary_op_type();
3157 inline void set_binary_op_type(byte value); 3201 inline void set_binary_op_type(byte value);
3158 3202
3159 // [type-recording binary op type]: For all TYPE_RECORDING_BINARY_OP_IC. 3203 // [type-recording binary op type]: For all TYPE_RECORDING_BINARY_OP_IC.
3160 inline byte type_recording_binary_op_type(); 3204 inline byte type_recording_binary_op_type();
3161 inline void set_type_recording_binary_op_type(byte value); 3205 inline void set_type_recording_binary_op_type(byte value);
3162 inline byte type_recording_binary_op_result_type(); 3206 inline byte type_recording_binary_op_result_type();
3163 inline void set_type_recording_binary_op_result_type(byte value); 3207 inline void set_type_recording_binary_op_result_type(byte value);
3164 3208
3165 // [compare state]: For kind compare IC stubs, tells what state the 3209 // [compare state]: For kind compare IC stubs, tells what state the
3166 // stub is in. 3210 // stub is in.
3167 inline byte compare_state(); 3211 inline byte compare_state();
3168 inline void set_compare_state(byte value); 3212 inline void set_compare_state(byte value);
3169 3213
3170 // Get the safepoint entry for the given pc. Returns NULL for 3214 // Get the safepoint entry for the given pc.
3171 // non-safepoint pcs. 3215 SafepointEntry GetSafepointEntry(Address pc);
3172 uint8_t* GetSafepointEntry(Address pc);
3173 3216
3174 // Mark this code object as not having a stack check table. Assumes kind 3217 // Mark this code object as not having a stack check table. Assumes kind
3175 // is FUNCTION. 3218 // is FUNCTION.
3176 void SetNoStackCheckTable(); 3219 void SetNoStackCheckTable();
3177 3220
3178 // Find the first map in an IC stub. 3221 // Find the first map in an IC stub.
3179 Map* FindFirstMap(); 3222 Map* FindFirstMap();
3180 3223
3181 // Flags operations. 3224 // Flags operations.
3182 static inline Flags ComputeFlags(Kind kind, 3225 static inline Flags ComputeFlags(
3183 InLoopFlag in_loop = NOT_IN_LOOP, 3226 Kind kind,
3184 InlineCacheState ic_state = UNINITIALIZED, 3227 InLoopFlag in_loop = NOT_IN_LOOP,
3185 PropertyType type = NORMAL, 3228 InlineCacheState ic_state = UNINITIALIZED,
3186 int argc = -1, 3229 ExtraICState extra_ic_state = kNoExtraICState,
3187 InlineCacheHolderFlag holder = OWN_MAP); 3230 PropertyType type = NORMAL,
3231 int argc = -1,
3232 InlineCacheHolderFlag holder = OWN_MAP);
3188 3233
3189 static inline Flags ComputeMonomorphicFlags( 3234 static inline Flags ComputeMonomorphicFlags(
3190 Kind kind, 3235 Kind kind,
3191 PropertyType type, 3236 PropertyType type,
3237 ExtraICState extra_ic_state = kNoExtraICState,
3192 InlineCacheHolderFlag holder = OWN_MAP, 3238 InlineCacheHolderFlag holder = OWN_MAP,
3193 InLoopFlag in_loop = NOT_IN_LOOP, 3239 InLoopFlag in_loop = NOT_IN_LOOP,
3194 int argc = -1); 3240 int argc = -1);
3195 3241
3196 static inline Kind ExtractKindFromFlags(Flags flags); 3242 static inline Kind ExtractKindFromFlags(Flags flags);
3197 static inline InlineCacheState ExtractICStateFromFlags(Flags flags); 3243 static inline InlineCacheState ExtractICStateFromFlags(Flags flags);
3244 static inline ExtraICState ExtractExtraICStateFromFlags(Flags flags);
3198 static inline InLoopFlag ExtractICInLoopFromFlags(Flags flags); 3245 static inline InLoopFlag ExtractICInLoopFromFlags(Flags flags);
3199 static inline PropertyType ExtractTypeFromFlags(Flags flags); 3246 static inline PropertyType ExtractTypeFromFlags(Flags flags);
3200 static inline int ExtractArgumentsCountFromFlags(Flags flags); 3247 static inline int ExtractArgumentsCountFromFlags(Flags flags);
3201 static inline InlineCacheHolderFlag ExtractCacheHolderFromFlags(Flags flags); 3248 static inline InlineCacheHolderFlag ExtractCacheHolderFromFlags(Flags flags);
3202 static inline Flags RemoveTypeFromFlags(Flags flags); 3249 static inline Flags RemoveTypeFromFlags(Flags flags);
3203 3250
3204 // Convert a target address into a code object. 3251 // Convert a target address into a code object.
3205 static inline Code* GetCodeFromTargetAddress(Address address); 3252 static inline Code* GetCodeFromTargetAddress(Address address);
3206 3253
3207 // Convert an entry address into an object. 3254 // Convert an entry address into an object.
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
3299 static const int kCheckTypeOffset = kKindSpecificFlagsOffset; 3346 static const int kCheckTypeOffset = kKindSpecificFlagsOffset;
3300 3347
3301 static const int kCompareStateOffset = kStubMajorKeyOffset + 1; 3348 static const int kCompareStateOffset = kStubMajorKeyOffset + 1;
3302 static const int kBinaryOpTypeOffset = kStubMajorKeyOffset + 1; 3349 static const int kBinaryOpTypeOffset = kStubMajorKeyOffset + 1;
3303 static const int kHasDeoptimizationSupportOffset = kOptimizableOffset + 1; 3350 static const int kHasDeoptimizationSupportOffset = kOptimizableOffset + 1;
3304 3351
3305 static const int kBinaryOpReturnTypeOffset = kBinaryOpTypeOffset + 1; 3352 static const int kBinaryOpReturnTypeOffset = kBinaryOpTypeOffset + 1;
3306 static const int kAllowOSRAtLoopNestingLevelOffset = 3353 static const int kAllowOSRAtLoopNestingLevelOffset =
3307 kHasDeoptimizationSupportOffset + 1; 3354 kHasDeoptimizationSupportOffset + 1;
3308 3355
3309 static const int kSafepointTableStartOffset = kStackSlotsOffset + kIntSize; 3356 static const int kSafepointTableOffsetOffset = kStackSlotsOffset + kIntSize;
3310 static const int kStackCheckTableStartOffset = kStackSlotsOffset + kIntSize; 3357 static const int kStackCheckTableOffsetOffset = kStackSlotsOffset + kIntSize;
3311 3358
3312 // Flags layout. 3359 // Flags layout.
3313 static const int kFlagsICStateShift = 0; 3360 static const int kFlagsICStateShift = 0;
3314 static const int kFlagsICInLoopShift = 3; 3361 static const int kFlagsICInLoopShift = 3;
3315 static const int kFlagsTypeShift = 4; 3362 static const int kFlagsTypeShift = 4;
3316 static const int kFlagsKindShift = 7; 3363 static const int kFlagsKindShift = 7;
3317 static const int kFlagsICHolderShift = 11; 3364 static const int kFlagsICHolderShift = 11;
3318 static const int kFlagsArgumentsCountShift = 12; 3365 static const int kFlagsExtraICStateShift = 12;
3366 static const int kFlagsArgumentsCountShift = 14;
3319 3367
3320 static const int kFlagsICStateMask = 0x00000007; // 00000000111 3368 static const int kFlagsICStateMask = 0x00000007; // 00000000111
3321 static const int kFlagsICInLoopMask = 0x00000008; // 00000001000 3369 static const int kFlagsICInLoopMask = 0x00000008; // 00000001000
3322 static const int kFlagsTypeMask = 0x00000070; // 00001110000 3370 static const int kFlagsTypeMask = 0x00000070; // 00001110000
3323 static const int kFlagsKindMask = 0x00000780; // 11110000000 3371 static const int kFlagsKindMask = 0x00000780; // 11110000000
3324 static const int kFlagsCacheInPrototypeMapMask = 0x00000800; 3372 static const int kFlagsCacheInPrototypeMapMask = 0x00000800;
3325 static const int kFlagsArgumentsCountMask = 0xFFFFF000; 3373 static const int kFlagsExtraICStateMask = 0x00003000;
3374 static const int kFlagsArgumentsCountMask = 0xFFFFC000;
3326 3375
3327 static const int kFlagsNotUsedInLookup = 3376 static const int kFlagsNotUsedInLookup =
3328 (kFlagsICInLoopMask | kFlagsTypeMask | kFlagsCacheInPrototypeMapMask); 3377 (kFlagsICInLoopMask | kFlagsTypeMask | kFlagsCacheInPrototypeMapMask);
3329 3378
3330 private: 3379 private:
3331 DISALLOW_IMPLICIT_CONSTRUCTORS(Code); 3380 DISALLOW_IMPLICIT_CONSTRUCTORS(Code);
3332 }; 3381 };
3333 3382
3334 3383
3335 // All heap objects have a Map that describes their structure. 3384 // All heap objects have a Map that describes their structure.
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
3444 set_bit_field2(bit_field2() | (1 << kHasFastElements)); 3493 set_bit_field2(bit_field2() | (1 << kHasFastElements));
3445 } else { 3494 } else {
3446 set_bit_field2(bit_field2() & ~(1 << kHasFastElements)); 3495 set_bit_field2(bit_field2() & ~(1 << kHasFastElements));
3447 } 3496 }
3448 } 3497 }
3449 3498
3450 inline bool has_fast_elements() { 3499 inline bool has_fast_elements() {
3451 return ((1 << kHasFastElements) & bit_field2()) != 0; 3500 return ((1 << kHasFastElements) & bit_field2()) != 0;
3452 } 3501 }
3453 3502
3503 // Tells whether an instance has pixel array elements.
3504 inline void set_has_pixel_array_elements(bool value) {
3505 if (value) {
3506 set_bit_field2(bit_field2() | (1 << kHasPixelArrayElements));
3507 } else {
3508 set_bit_field2(bit_field2() & ~(1 << kHasPixelArrayElements));
3509 }
3510 }
3511
3512 inline bool has_pixel_array_elements() {
3513 return ((1 << kHasPixelArrayElements) & bit_field2()) != 0;
3514 }
3515
3454 // Tells whether the map is attached to SharedFunctionInfo 3516 // Tells whether the map is attached to SharedFunctionInfo
3455 // (for inobject slack tracking). 3517 // (for inobject slack tracking).
3456 inline void set_attached_to_shared_function_info(bool value); 3518 inline void set_attached_to_shared_function_info(bool value);
3457 3519
3458 inline bool attached_to_shared_function_info(); 3520 inline bool attached_to_shared_function_info();
3459 3521
3460 // Tells whether the map is shared between objects that may have different 3522 // Tells whether the map is shared between objects that may have different
3461 // behavior. If true, the map should never be modified, instead a clone 3523 // behavior. If true, the map should never be modified, instead a clone
3462 // should be created and modified. 3524 // should be created and modified.
3463 inline void set_is_shared(bool value); 3525 inline void set_is_shared(bool value);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
3502 // Returns this map if it has the fast elements bit set, otherwise 3564 // Returns this map if it has the fast elements bit set, otherwise
3503 // returns a copy of the map, with all transitions dropped from the 3565 // returns a copy of the map, with all transitions dropped from the
3504 // descriptors and the fast elements bit set. 3566 // descriptors and the fast elements bit set.
3505 MUST_USE_RESULT inline MaybeObject* GetFastElementsMap(); 3567 MUST_USE_RESULT inline MaybeObject* GetFastElementsMap();
3506 3568
3507 // Returns this map if it has the fast elements bit cleared, 3569 // Returns this map if it has the fast elements bit cleared,
3508 // otherwise returns a copy of the map, with all transitions dropped 3570 // otherwise returns a copy of the map, with all transitions dropped
3509 // from the descriptors and the fast elements bit cleared. 3571 // from the descriptors and the fast elements bit cleared.
3510 MUST_USE_RESULT inline MaybeObject* GetSlowElementsMap(); 3572 MUST_USE_RESULT inline MaybeObject* GetSlowElementsMap();
3511 3573
3574 // Returns this map if it has the pixel array elements bit is set, otherwise
3575 // returns a copy of the map, with all transitions dropped from the
3576 // descriptors and the pixel array elements bit set.
3577 MUST_USE_RESULT inline MaybeObject* GetPixelArrayElementsMap();
3578
3512 // Returns the property index for name (only valid for FAST MODE). 3579 // Returns the property index for name (only valid for FAST MODE).
3513 int PropertyIndexFor(String* name); 3580 int PropertyIndexFor(String* name);
3514 3581
3515 // Returns the next free property index (only valid for FAST MODE). 3582 // Returns the next free property index (only valid for FAST MODE).
3516 int NextFreePropertyIndex(); 3583 int NextFreePropertyIndex();
3517 3584
3518 // Returns the number of properties described in instance_descriptors. 3585 // Returns the number of properties described in instance_descriptors.
3519 int NumberOfDescribedProperties(); 3586 int NumberOfDescribedProperties();
3520 3587
3521 // Casting. 3588 // Casting.
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
3620 static const int kHasInstanceCallHandler = 6; 3687 static const int kHasInstanceCallHandler = 6;
3621 static const int kIsAccessCheckNeeded = 7; 3688 static const int kIsAccessCheckNeeded = 7;
3622 3689
3623 // Bit positions for bit field 2 3690 // Bit positions for bit field 2
3624 static const int kIsExtensible = 0; 3691 static const int kIsExtensible = 0;
3625 static const int kFunctionWithPrototype = 1; 3692 static const int kFunctionWithPrototype = 1;
3626 static const int kHasFastElements = 2; 3693 static const int kHasFastElements = 2;
3627 static const int kStringWrapperSafeForDefaultValueOf = 3; 3694 static const int kStringWrapperSafeForDefaultValueOf = 3;
3628 static const int kAttachedToSharedFunctionInfo = 4; 3695 static const int kAttachedToSharedFunctionInfo = 4;
3629 static const int kIsShared = 5; 3696 static const int kIsShared = 5;
3697 static const int kHasPixelArrayElements = 6;
3630 3698
3631 // Layout of the default cache. It holds alternating name and code objects. 3699 // Layout of the default cache. It holds alternating name and code objects.
3632 static const int kCodeCacheEntrySize = 2; 3700 static const int kCodeCacheEntrySize = 2;
3633 static const int kCodeCacheEntryNameOffset = 0; 3701 static const int kCodeCacheEntryNameOffset = 0;
3634 static const int kCodeCacheEntryCodeOffset = 1; 3702 static const int kCodeCacheEntryCodeOffset = 1;
3635 3703
3636 typedef FixedBodyDescriptor<kPointerFieldsBeginOffset, 3704 typedef FixedBodyDescriptor<kPointerFieldsBeginOffset,
3637 kPointerFieldsEndOffset, 3705 kPointerFieldsEndOffset,
3638 kSize> BodyDescriptor; 3706 kSize> BodyDescriptor;
3639 3707
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
3932 // Currently it either has FunctionTemplateInfo to make benefit the API 4000 // Currently it either has FunctionTemplateInfo to make benefit the API
3933 // or Smi identifying a builtin function. 4001 // or Smi identifying a builtin function.
3934 // In the long run we don't want all functions to have this field but 4002 // In the long run we don't want all functions to have this field but
3935 // we can fix that when we have a better model for storing hidden data 4003 // we can fix that when we have a better model for storing hidden data
3936 // on objects. 4004 // on objects.
3937 DECL_ACCESSORS(function_data, Object) 4005 DECL_ACCESSORS(function_data, Object)
3938 4006
3939 inline bool IsApiFunction(); 4007 inline bool IsApiFunction();
3940 inline FunctionTemplateInfo* get_api_func_data(); 4008 inline FunctionTemplateInfo* get_api_func_data();
3941 inline bool HasBuiltinFunctionId(); 4009 inline bool HasBuiltinFunctionId();
3942 inline bool IsBuiltinMathFunction();
3943 inline BuiltinFunctionId builtin_function_id(); 4010 inline BuiltinFunctionId builtin_function_id();
3944 4011
3945 // [script info]: Script from which the function originates. 4012 // [script info]: Script from which the function originates.
3946 DECL_ACCESSORS(script, Object) 4013 DECL_ACCESSORS(script, Object)
3947 4014
3948 // [num_literals]: Number of literals used by this function. 4015 // [num_literals]: Number of literals used by this function.
3949 inline int num_literals(); 4016 inline int num_literals();
3950 inline void set_num_literals(int value); 4017 inline void set_num_literals(int value);
3951 4018
3952 // [start_position_and_type]: Field used to store both the source code 4019 // [start_position_and_type]: Field used to store both the source code
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
4029 inline int code_age(); 4096 inline int code_age();
4030 inline void set_code_age(int age); 4097 inline void set_code_age(int age);
4031 4098
4032 // Indicates whether optimizations have been disabled for this 4099 // Indicates whether optimizations have been disabled for this
4033 // shared function info. If a function is repeatedly optimized or if 4100 // shared function info. If a function is repeatedly optimized or if
4034 // we cannot optimize the function we disable optimization to avoid 4101 // we cannot optimize the function we disable optimization to avoid
4035 // spending time attempting to optimize it again. 4102 // spending time attempting to optimize it again.
4036 inline bool optimization_disabled(); 4103 inline bool optimization_disabled();
4037 inline void set_optimization_disabled(bool value); 4104 inline void set_optimization_disabled(bool value);
4038 4105
4106 // Indicates whether the function is a strict mode function.
4107 inline bool strict_mode();
4108 inline void set_strict_mode(bool value);
4109
4039 // Indicates whether or not the code in the shared function support 4110 // Indicates whether or not the code in the shared function support
4040 // deoptimization. 4111 // deoptimization.
4041 inline bool has_deoptimization_support(); 4112 inline bool has_deoptimization_support();
4042 4113
4043 // Enable deoptimization support through recompiled code. 4114 // Enable deoptimization support through recompiled code.
4044 void EnableDeoptimizationSupport(Code* recompiled); 4115 void EnableDeoptimizationSupport(Code* recompiled);
4045 4116
4046 // Lookup the bailout ID and ASSERT that it exists in the non-optimized 4117 // Lookup the bailout ID and ASSERT that it exists in the non-optimized
4047 // code, returns whether it asserted (i.e., always true if assertions are 4118 // code, returns whether it asserted (i.e., always true if assertions are
4048 // disabled). 4119 // disabled).
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
4193 #else 4264 #else
4194 #error Unknown byte ordering 4265 #error Unknown byte ordering
4195 #endif 4266 #endif
4196 4267
4197 static const int kAlignedSize = POINTER_SIZE_ALIGN(kSize); 4268 static const int kAlignedSize = POINTER_SIZE_ALIGN(kSize);
4198 4269
4199 typedef FixedBodyDescriptor<kNameOffset, 4270 typedef FixedBodyDescriptor<kNameOffset,
4200 kThisPropertyAssignmentsOffset + kPointerSize, 4271 kThisPropertyAssignmentsOffset + kPointerSize,
4201 kSize> BodyDescriptor; 4272 kSize> BodyDescriptor;
4202 4273
4203 private:
4204 // Bit positions in start_position_and_type. 4274 // Bit positions in start_position_and_type.
4205 // The source code start position is in the 30 most significant bits of 4275 // The source code start position is in the 30 most significant bits of
4206 // the start_position_and_type field. 4276 // the start_position_and_type field.
4207 static const int kIsExpressionBit = 0; 4277 static const int kIsExpressionBit = 0;
4208 static const int kIsTopLevelBit = 1; 4278 static const int kIsTopLevelBit = 1;
4209 static const int kStartPositionShift = 2; 4279 static const int kStartPositionShift = 2;
4210 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); 4280 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1);
4211 4281
4212 // Bit positions in compiler_hints. 4282 // Bit positions in compiler_hints.
4213 static const int kHasOnlySimpleThisPropertyAssignments = 0; 4283 static const int kHasOnlySimpleThisPropertyAssignments = 0;
4214 static const int kTryFullCodegen = 1; 4284 static const int kTryFullCodegen = 1;
4215 static const int kAllowLazyCompilation = 2; 4285 static const int kAllowLazyCompilation = 2;
4216 static const int kLiveObjectsMayExist = 3; 4286 static const int kLiveObjectsMayExist = 3;
4217 static const int kCodeAgeShift = 4; 4287 static const int kCodeAgeShift = 4;
4218 static const int kCodeAgeMask = 0x7; 4288 static const int kCodeAgeMask = 0x7;
4219 static const int kOptimizationDisabled = 7; 4289 static const int kOptimizationDisabled = 7;
4290 static const int kStrictModeFunction = 8;
4220 4291
4292 private:
4293 #if V8_HOST_ARCH_32_BIT
4294 // On 32 bit platforms, compiler hints is a smi.
4295 static const int kCompilerHintsSmiTagSize = kSmiTagSize;
4296 static const int kCompilerHintsSize = kPointerSize;
4297 #else
4298 // On 64 bit platforms, compiler hints is not a smi, see comment above.
4299 static const int kCompilerHintsSmiTagSize = 0;
4300 static const int kCompilerHintsSize = kIntSize;
4301 #endif
4302
4303 public:
4304 // Constants for optimizing codegen for strict mode function tests.
4305 // Allows to use byte-widgh instructions.
4306 static const int kStrictModeBitWithinByte =
4307 (kStrictModeFunction + kCompilerHintsSmiTagSize) % kBitsPerByte;
4308
4309 #if __BYTE_ORDER == __LITTLE_ENDIAN
4310 static const int kStrictModeByteOffset = kCompilerHintsOffset +
4311 (kStrictModeFunction + kCompilerHintsSmiTagSize) / kBitsPerByte;
4312 #elif __BYTE_ORDER == __BIG_ENDIAN
4313 static const int kStrictModeByteOffset = kCompilerHintsOffset +
4314 (kCompilerHintsSize - 1) -
4315 ((kStrictModeFunction + kCompilerHintsSmiTagSize) / kBitsPerByte);
4316 #else
4317 #error Unknown byte ordering
4318 #endif
4319
4320 private:
4221 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo); 4321 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo);
4222 }; 4322 };
4223 4323
4224 4324
4225 // JSFunction describes JavaScript functions. 4325 // JSFunction describes JavaScript functions.
4226 class JSFunction: public JSObject { 4326 class JSFunction: public JSObject {
4227 public: 4327 public:
4228 // [prototype_or_initial_map]: 4328 // [prototype_or_initial_map]:
4229 DECL_ACCESSORS(prototype_or_initial_map, Object) 4329 DECL_ACCESSORS(prototype_or_initial_map, Object)
4230 4330
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
4555 #endif 4655 #endif
4556 4656
4557 // Layout description. 4657 // Layout description.
4558 static const int kValueOffset = JSObject::kHeaderSize; 4658 static const int kValueOffset = JSObject::kHeaderSize;
4559 static const int kSize = kValueOffset + kPointerSize; 4659 static const int kSize = kValueOffset + kPointerSize;
4560 4660
4561 private: 4661 private:
4562 DISALLOW_IMPLICIT_CONSTRUCTORS(JSValue); 4662 DISALLOW_IMPLICIT_CONSTRUCTORS(JSValue);
4563 }; 4663 };
4564 4664
4665
4666 // Representation of message objects used for error reporting through
4667 // the API. The messages are formatted in JavaScript so this object is
4668 // a real JavaScript object. The information used for formatting the
4669 // error messages are not directly accessible from JavaScript to
4670 // prevent leaking information to user code called during error
4671 // formatting.
4672 class JSMessageObject: public JSObject {
4673 public:
4674 // [type]: the type of error message.
4675 DECL_ACCESSORS(type, String)
4676
4677 // [arguments]: the arguments for formatting the error message.
4678 DECL_ACCESSORS(arguments, JSArray)
4679
4680 // [script]: the script from which the error message originated.
4681 DECL_ACCESSORS(script, Object)
4682
4683 // [stack_trace]: the stack trace for this error message.
4684 DECL_ACCESSORS(stack_trace, Object)
4685
4686 // [stack_frames]: an array of stack frames for this error object.
4687 DECL_ACCESSORS(stack_frames, Object)
4688
4689 // [start_position]: the start position in the script for the error message.
4690 inline int start_position();
4691 inline void set_start_position(int value);
4692
4693 // [end_position]: the end position in the script for the error message.
4694 inline int end_position();
4695 inline void set_end_position(int value);
4696
4697 // Casting.
4698 static inline JSMessageObject* cast(Object* obj);
4699
4700 // Dispatched behavior.
4701 #ifdef OBJECT_PRINT
4702 inline void JSMessageObjectPrint() {
4703 JSMessageObjectPrint(stdout);
4704 }
4705 void JSMessageObjectPrint(FILE* out);
4706 #endif
4707 #ifdef DEBUG
4708 void JSMessageObjectVerify();
4709 #endif
4710
4711 // Layout description.
4712 static const int kTypeOffset = JSObject::kHeaderSize;
4713 static const int kArgumentsOffset = kTypeOffset + kPointerSize;
4714 static const int kScriptOffset = kArgumentsOffset + kPointerSize;
4715 static const int kStackTraceOffset = kScriptOffset + kPointerSize;
4716 static const int kStackFramesOffset = kStackTraceOffset + kPointerSize;
4717 static const int kStartPositionOffset = kStackFramesOffset + kPointerSize;
4718 static const int kEndPositionOffset = kStartPositionOffset + kPointerSize;
4719 static const int kSize = kEndPositionOffset + kPointerSize;
4720
4721 typedef FixedBodyDescriptor<HeapObject::kMapOffset,
4722 kStackFramesOffset + kPointerSize,
4723 kSize> BodyDescriptor;
4724 };
4725
4726
4565 // Regular expressions 4727 // Regular expressions
4566 // The regular expression holds a single reference to a FixedArray in 4728 // The regular expression holds a single reference to a FixedArray in
4567 // the kDataOffset field. 4729 // the kDataOffset field.
4568 // The FixedArray contains the following data: 4730 // The FixedArray contains the following data:
4569 // - tag : type of regexp implementation (not compiled yet, atom or irregexp) 4731 // - tag : type of regexp implementation (not compiled yet, atom or irregexp)
4570 // - reference to the original source string 4732 // - reference to the original source string
4571 // - reference to the original flag string 4733 // - reference to the original flag string
4572 // If it is an atom regexp 4734 // If it is an atom regexp
4573 // - a reference to a literal string to search for 4735 // - a reference to a literal string to search for
4574 // If it is an irregexp regexp: 4736 // If it is an irregexp regexp:
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
4693 static const int kPrefixSize = 0; 4855 static const int kPrefixSize = 0;
4694 static const int kEntrySize = 2; 4856 static const int kEntrySize = 2;
4695 }; 4857 };
4696 4858
4697 4859
4698 class CompilationCacheTable: public HashTable<CompilationCacheShape, 4860 class CompilationCacheTable: public HashTable<CompilationCacheShape,
4699 HashTableKey*> { 4861 HashTableKey*> {
4700 public: 4862 public:
4701 // Find cached value for a string key, otherwise return null. 4863 // Find cached value for a string key, otherwise return null.
4702 Object* Lookup(String* src); 4864 Object* Lookup(String* src);
4703 Object* LookupEval(String* src, Context* context); 4865 Object* LookupEval(String* src, Context* context, StrictModeFlag strict_mode);
4704 Object* LookupRegExp(String* source, JSRegExp::Flags flags); 4866 Object* LookupRegExp(String* source, JSRegExp::Flags flags);
4705 MaybeObject* Put(String* src, Object* value); 4867 MaybeObject* Put(String* src, Object* value);
4706 MaybeObject* PutEval(String* src, Context* context, Object* value); 4868 MaybeObject* PutEval(String* src,
4869 Context* context,
4870 SharedFunctionInfo* value);
4707 MaybeObject* PutRegExp(String* src, JSRegExp::Flags flags, FixedArray* value); 4871 MaybeObject* PutRegExp(String* src, JSRegExp::Flags flags, FixedArray* value);
4708 4872
4709 // Remove given value from cache. 4873 // Remove given value from cache.
4710 void Remove(Object* value); 4874 void Remove(Object* value);
4711 4875
4712 static inline CompilationCacheTable* cast(Object* obj); 4876 static inline CompilationCacheTable* cast(Object* obj);
4713 4877
4714 private: 4878 private:
4715 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheTable); 4879 DISALLOW_IMPLICIT_CONSTRUCTORS(CompilationCacheTable);
4716 }; 4880 };
(...skipping 1573 matching lines...) Expand 10 before | Expand all | Expand 10 after
6290 } else { 6454 } else {
6291 value &= ~(1 << bit_position); 6455 value &= ~(1 << bit_position);
6292 } 6456 }
6293 return value; 6457 return value;
6294 } 6458 }
6295 }; 6459 };
6296 6460
6297 } } // namespace v8::internal 6461 } } // namespace v8::internal
6298 6462
6299 #endif // V8_OBJECTS_H_ 6463 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/mirror-debugger.js ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698