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

Side by Side Diff: src/objects.h

Issue 142813003: A64: Synchronize with r15358. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 11 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 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 // Inheritance hierarchy: 53 // Inheritance hierarchy:
54 // - MaybeObject (an object or a failure) 54 // - MaybeObject (an object or a failure)
55 // - Failure (immediate for marking failed operation) 55 // - Failure (immediate for marking failed operation)
56 // - Object 56 // - Object
57 // - Smi (immediate small integer) 57 // - Smi (immediate small integer)
58 // - HeapObject (superclass for everything allocated in the heap) 58 // - HeapObject (superclass for everything allocated in the heap)
59 // - JSReceiver (suitable for property access) 59 // - JSReceiver (suitable for property access)
60 // - JSObject 60 // - JSObject
61 // - JSArray 61 // - JSArray
62 // - JSArrayBuffer 62 // - JSArrayBuffer
63 // - JSTypedArray 63 // - JSArrayBufferView
64 // - JSTypedArray
65 // - JSDataView
64 // - JSSet 66 // - JSSet
65 // - JSMap 67 // - JSMap
66 // - JSWeakMap 68 // - JSWeakMap
67 // - JSRegExp 69 // - JSRegExp
68 // - JSFunction 70 // - JSFunction
69 // - JSGeneratorObject 71 // - JSGeneratorObject
70 // - JSModule 72 // - JSModule
71 // - GlobalObject 73 // - GlobalObject
72 // - JSGlobalObject 74 // - JSGlobalObject
73 // - JSBuiltinsObject 75 // - JSBuiltinsObject
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 V(JS_OBJECT_TYPE) \ 405 V(JS_OBJECT_TYPE) \
404 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ 406 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \
405 V(JS_GENERATOR_OBJECT_TYPE) \ 407 V(JS_GENERATOR_OBJECT_TYPE) \
406 V(JS_MODULE_TYPE) \ 408 V(JS_MODULE_TYPE) \
407 V(JS_GLOBAL_OBJECT_TYPE) \ 409 V(JS_GLOBAL_OBJECT_TYPE) \
408 V(JS_BUILTINS_OBJECT_TYPE) \ 410 V(JS_BUILTINS_OBJECT_TYPE) \
409 V(JS_GLOBAL_PROXY_TYPE) \ 411 V(JS_GLOBAL_PROXY_TYPE) \
410 V(JS_ARRAY_TYPE) \ 412 V(JS_ARRAY_TYPE) \
411 V(JS_ARRAY_BUFFER_TYPE) \ 413 V(JS_ARRAY_BUFFER_TYPE) \
412 V(JS_TYPED_ARRAY_TYPE) \ 414 V(JS_TYPED_ARRAY_TYPE) \
415 V(JS_DATA_VIEW_TYPE) \
413 V(JS_PROXY_TYPE) \ 416 V(JS_PROXY_TYPE) \
414 V(JS_WEAK_MAP_TYPE) \ 417 V(JS_WEAK_MAP_TYPE) \
415 V(JS_REGEXP_TYPE) \ 418 V(JS_REGEXP_TYPE) \
416 \ 419 \
417 V(JS_FUNCTION_TYPE) \ 420 V(JS_FUNCTION_TYPE) \
418 V(JS_FUNCTION_PROXY_TYPE) \ 421 V(JS_FUNCTION_PROXY_TYPE) \
419 422
420 #ifdef ENABLE_DEBUGGER_SUPPORT 423 #ifdef ENABLE_DEBUGGER_SUPPORT
421 #define INSTANCE_TYPE_LIST_DEBUGGER(V) \ 424 #define INSTANCE_TYPE_LIST_DEBUGGER(V) \
422 V(DEBUG_INFO_TYPE) \ 425 V(DEBUG_INFO_TYPE) \
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 STRUCT_LIST_DEBUGGER(V) 570 STRUCT_LIST_DEBUGGER(V)
568 571
569 // We use the full 8 bits of the instance_type field to encode heap object 572 // We use the full 8 bits of the instance_type field to encode heap object
570 // instance types. The high-order bit (bit 7) is set if the object is not a 573 // instance types. The high-order bit (bit 7) is set if the object is not a
571 // string, and cleared if it is a string. 574 // string, and cleared if it is a string.
572 const uint32_t kIsNotStringMask = 0x80; 575 const uint32_t kIsNotStringMask = 0x80;
573 const uint32_t kStringTag = 0x0; 576 const uint32_t kStringTag = 0x0;
574 const uint32_t kNotStringTag = 0x80; 577 const uint32_t kNotStringTag = 0x80;
575 578
576 // Bit 6 indicates that the object is an internalized string (if set) or not. 579 // Bit 6 indicates that the object is an internalized string (if set) or not.
577 // There are not enough types that the non-string types (with bit 7 set) can 580 // Bit 7 has to be clear as well.
578 // have bit 6 set too.
579 const uint32_t kIsInternalizedMask = 0x40; 581 const uint32_t kIsInternalizedMask = 0x40;
580 const uint32_t kNotInternalizedTag = 0x0; 582 const uint32_t kNotInternalizedTag = 0x0;
581 const uint32_t kInternalizedTag = 0x40; 583 const uint32_t kInternalizedTag = 0x40;
582 584
583 // If bit 7 is clear then bit 2 indicates whether the string consists of 585 // If bit 7 is clear then bit 2 indicates whether the string consists of
584 // two-byte characters or one-byte characters. 586 // two-byte characters or one-byte characters.
585 const uint32_t kStringEncodingMask = 0x4; 587 const uint32_t kStringEncodingMask = 0x4;
586 const uint32_t kTwoByteStringTag = 0x0; 588 const uint32_t kTwoByteStringTag = 0x0;
587 const uint32_t kOneByteStringTag = 0x4; 589 const uint32_t kOneByteStringTag = 0x4;
588 590
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 JS_OBJECT_TYPE, 741 JS_OBJECT_TYPE,
740 JS_CONTEXT_EXTENSION_OBJECT_TYPE, 742 JS_CONTEXT_EXTENSION_OBJECT_TYPE,
741 JS_GENERATOR_OBJECT_TYPE, 743 JS_GENERATOR_OBJECT_TYPE,
742 JS_MODULE_TYPE, 744 JS_MODULE_TYPE,
743 JS_GLOBAL_OBJECT_TYPE, 745 JS_GLOBAL_OBJECT_TYPE,
744 JS_BUILTINS_OBJECT_TYPE, 746 JS_BUILTINS_OBJECT_TYPE,
745 JS_GLOBAL_PROXY_TYPE, 747 JS_GLOBAL_PROXY_TYPE,
746 JS_ARRAY_TYPE, 748 JS_ARRAY_TYPE,
747 JS_ARRAY_BUFFER_TYPE, 749 JS_ARRAY_BUFFER_TYPE,
748 JS_TYPED_ARRAY_TYPE, 750 JS_TYPED_ARRAY_TYPE,
751 JS_DATA_VIEW_TYPE,
749 JS_SET_TYPE, 752 JS_SET_TYPE,
750 JS_MAP_TYPE, 753 JS_MAP_TYPE,
751 JS_WEAK_MAP_TYPE, 754 JS_WEAK_MAP_TYPE,
752 755
753 JS_REGEXP_TYPE, 756 JS_REGEXP_TYPE,
754 757
755 JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE 758 JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE
756 759
757 // Pseudo-types 760 // Pseudo-types
758 FIRST_TYPE = 0x0, 761 FIRST_TYPE = 0x0,
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 V(Oddball) \ 991 V(Oddball) \
989 V(SharedFunctionInfo) \ 992 V(SharedFunctionInfo) \
990 V(JSValue) \ 993 V(JSValue) \
991 V(JSDate) \ 994 V(JSDate) \
992 V(JSMessageObject) \ 995 V(JSMessageObject) \
993 V(StringWrapper) \ 996 V(StringWrapper) \
994 V(Foreign) \ 997 V(Foreign) \
995 V(Boolean) \ 998 V(Boolean) \
996 V(JSArray) \ 999 V(JSArray) \
997 V(JSArrayBuffer) \ 1000 V(JSArrayBuffer) \
1001 V(JSArrayBufferView) \
998 V(JSTypedArray) \ 1002 V(JSTypedArray) \
1003 V(JSDataView) \
999 V(JSProxy) \ 1004 V(JSProxy) \
1000 V(JSFunctionProxy) \ 1005 V(JSFunctionProxy) \
1001 V(JSSet) \ 1006 V(JSSet) \
1002 V(JSMap) \ 1007 V(JSMap) \
1003 V(JSWeakMap) \ 1008 V(JSWeakMap) \
1004 V(JSRegExp) \ 1009 V(JSRegExp) \
1005 V(HashTable) \ 1010 V(HashTable) \
1006 V(Dictionary) \ 1011 V(Dictionary) \
1007 V(StringTable) \ 1012 V(StringTable) \
1008 V(JSFunctionResultCache) \ 1013 V(JSFunctionResultCache) \
(...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after
1985 // of its prototype, and if it's a detached proxy, then you can't have 1990 // of its prototype, and if it's a detached proxy, then you can't have
1986 // hidden properties. 1991 // hidden properties.
1987 1992
1988 // Sets a hidden property on this object. Returns this object if successful, 1993 // Sets a hidden property on this object. Returns this object if successful,
1989 // undefined if called on a detached proxy. 1994 // undefined if called on a detached proxy.
1990 static Handle<Object> SetHiddenProperty(Handle<JSObject> obj, 1995 static Handle<Object> SetHiddenProperty(Handle<JSObject> obj,
1991 Handle<Name> key, 1996 Handle<Name> key,
1992 Handle<Object> value); 1997 Handle<Object> value);
1993 // Returns a failure if a GC is required. 1998 // Returns a failure if a GC is required.
1994 MUST_USE_RESULT MaybeObject* SetHiddenProperty(Name* key, Object* value); 1999 MUST_USE_RESULT MaybeObject* SetHiddenProperty(Name* key, Object* value);
1995 // Gets the value of a hidden property with the given key. Returns undefined 2000 // Gets the value of a hidden property with the given key. Returns the hole
1996 // if the property doesn't exist (or if called on a detached proxy), 2001 // if the property doesn't exist (or if called on a detached proxy),
1997 // otherwise returns the value set for the key. 2002 // otherwise returns the value set for the key.
1998 Object* GetHiddenProperty(Name* key); 2003 Object* GetHiddenProperty(Name* key);
1999 // Deletes a hidden property. Deleting a non-existing property is 2004 // Deletes a hidden property. Deleting a non-existing property is
2000 // considered successful. 2005 // considered successful.
2001 void DeleteHiddenProperty(Name* key); 2006 void DeleteHiddenProperty(Name* key);
2002 // Returns true if the object has a property with the hidden string as name. 2007 // Returns true if the object has a property with the hidden string as name.
2003 bool HasHiddenProperties(); 2008 bool HasHiddenProperties();
2004 2009
2005 static int GetIdentityHash(Handle<JSObject> obj); 2010 static int GetIdentityHash(Handle<JSObject> obj);
(...skipping 2422 matching lines...) Expand 10 before | Expand all | Expand 10 after
4428 class SafepointEntry; 4433 class SafepointEntry;
4429 class TypeFeedbackInfo; 4434 class TypeFeedbackInfo;
4430 4435
4431 // Code describes objects with on-the-fly generated machine code. 4436 // Code describes objects with on-the-fly generated machine code.
4432 class Code: public HeapObject { 4437 class Code: public HeapObject {
4433 public: 4438 public:
4434 // Opaque data type for encapsulating code flags like kind, inline 4439 // Opaque data type for encapsulating code flags like kind, inline
4435 // cache state, and arguments count. 4440 // cache state, and arguments count.
4436 typedef uint32_t Flags; 4441 typedef uint32_t Flags;
4437 4442
4443 #define NON_IC_KIND_LIST(V) \
4444 V(FUNCTION) \
4445 V(OPTIMIZED_FUNCTION) \
4446 V(STUB) \
4447 V(BUILTIN) \
4448 V(REGEXP)
4449
4450 #define IC_KIND_LIST(V) \
4451 V(LOAD_IC) \
4452 V(KEYED_LOAD_IC) \
4453 V(CALL_IC) \
4454 V(KEYED_CALL_IC) \
4455 V(STORE_IC) \
4456 V(KEYED_STORE_IC) \
4457 V(UNARY_OP_IC) \
4458 V(BINARY_OP_IC) \
4459 V(COMPARE_IC) \
4460 V(COMPARE_NIL_IC) \
4461 V(TO_BOOLEAN_IC)
4462
4438 #define CODE_KIND_LIST(V) \ 4463 #define CODE_KIND_LIST(V) \
4439 V(FUNCTION) \ 4464 NON_IC_KIND_LIST(V) \
4440 V(OPTIMIZED_FUNCTION) \ 4465 IC_KIND_LIST(V)
4441 V(STUB) \
4442 V(BUILTIN) \
4443 V(LOAD_IC) \
4444 V(KEYED_LOAD_IC) \
4445 V(CALL_IC) \
4446 V(KEYED_CALL_IC) \
4447 V(STORE_IC) \
4448 V(KEYED_STORE_IC) \
4449 V(UNARY_OP_IC) \
4450 V(BINARY_OP_IC) \
4451 V(COMPARE_IC) \
4452 V(COMPARE_NIL_IC) \
4453 V(TO_BOOLEAN_IC)
4454 4466
4455 enum Kind { 4467 enum Kind {
4456 #define DEFINE_CODE_KIND_ENUM(name) name, 4468 #define DEFINE_CODE_KIND_ENUM(name) name,
4457 CODE_KIND_LIST(DEFINE_CODE_KIND_ENUM) 4469 CODE_KIND_LIST(DEFINE_CODE_KIND_ENUM)
4458 #undef DEFINE_CODE_KIND_ENUM 4470 #undef DEFINE_CODE_KIND_ENUM
4459 4471 NUMBER_OF_KINDS
4460 // Pseudo-kinds.
4461 LAST_CODE_KIND = TO_BOOLEAN_IC,
4462 REGEXP = BUILTIN,
4463 FIRST_IC_KIND = LOAD_IC,
4464 LAST_IC_KIND = TO_BOOLEAN_IC
4465 }; 4472 };
4466 4473
4467 // No more than 16 kinds. The value is currently encoded in four bits in 4474 // No more than 16 kinds. The value is currently encoded in four bits in
4468 // Flags. 4475 // Flags.
4469 STATIC_ASSERT(LAST_CODE_KIND < 16); 4476 STATIC_ASSERT(NUMBER_OF_KINDS <= 16);
4470 4477
4471 static const char* Kind2String(Kind kind); 4478 static const char* Kind2String(Kind kind);
4472 4479
4473 // Types of stubs. 4480 // Types of stubs.
4474 enum StubType { 4481 enum StubType {
4475 NORMAL, 4482 NORMAL,
4476 FIELD, 4483 FIELD,
4477 CONSTANT_FUNCTION, 4484 CONSTANT_FUNCTION,
4478 CALLBACKS, 4485 CALLBACKS,
4479 INTERCEPTOR, 4486 INTERCEPTOR,
4480 MAP_TRANSITION, 4487 MAP_TRANSITION,
4481 NONEXISTENT 4488 NONEXISTENT
4482 }; 4489 };
4483 4490
4484 enum StubHolder { 4491 enum StubHolder {
4485 OWN_STUB, 4492 OWN_STUB,
4486 PROTOTYPE_STUB 4493 PROTOTYPE_STUB
4487 }; 4494 };
4488 4495
4489 enum {
4490 NUMBER_OF_KINDS = LAST_IC_KIND + 1
4491 };
4492
4493 typedef int ExtraICState; 4496 typedef int ExtraICState;
4494 4497
4495 static const ExtraICState kNoExtraICState = 0; 4498 static const ExtraICState kNoExtraICState = 0;
4496 4499
4497 #ifdef ENABLE_DISASSEMBLER 4500 #ifdef ENABLE_DISASSEMBLER
4498 // Printing 4501 // Printing
4499 static const char* ICState2String(InlineCacheState state); 4502 static const char* ICState2String(InlineCacheState state);
4500 static const char* StubType2String(StubType type); 4503 static const char* StubType2String(StubType type);
4501 static void PrintExtraICState(FILE* out, Kind kind, ExtraICState extra); 4504 static void PrintExtraICState(FILE* out, Kind kind, ExtraICState extra);
4502 inline void Disassemble(const char* name) { 4505 inline void Disassemble(const char* name) {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
4658 4661
4659 // [type-recording unary op type]: For kind UNARY_OP_IC. 4662 // [type-recording unary op type]: For kind UNARY_OP_IC.
4660 inline byte unary_op_type(); 4663 inline byte unary_op_type();
4661 inline void set_unary_op_type(byte value); 4664 inline void set_unary_op_type(byte value);
4662 4665
4663 // [to_boolean_foo]: For kind TO_BOOLEAN_IC tells what state the stub is in. 4666 // [to_boolean_foo]: For kind TO_BOOLEAN_IC tells what state the stub is in.
4664 inline byte to_boolean_state(); 4667 inline byte to_boolean_state();
4665 4668
4666 // [compare_nil]: For kind COMPARE_NIL_IC tells what state the stub is in. 4669 // [compare_nil]: For kind COMPARE_NIL_IC tells what state the stub is in.
4667 byte compare_nil_state(); 4670 byte compare_nil_state();
4671 byte compare_nil_value();
4668 4672
4669 // [has_function_cache]: For kind STUB tells whether there is a function 4673 // [has_function_cache]: For kind STUB tells whether there is a function
4670 // cache is passed to the stub. 4674 // cache is passed to the stub.
4671 inline bool has_function_cache(); 4675 inline bool has_function_cache();
4672 inline void set_has_function_cache(bool flag); 4676 inline void set_has_function_cache(bool flag);
4673 4677
4674 4678
4675 // [marked_for_deoptimization]: For kind OPTIMIZED_FUNCTION tells whether 4679 // [marked_for_deoptimization]: For kind OPTIMIZED_FUNCTION tells whether
4676 // the code is going to be deoptimized because of dead embedded maps. 4680 // the code is going to be deoptimized because of dead embedded maps.
4677 inline bool marked_for_deoptimization(); 4681 inline bool marked_for_deoptimization();
4678 inline void set_marked_for_deoptimization(bool flag); 4682 inline void set_marked_for_deoptimization(bool flag);
4679 4683
4680 bool allowed_in_shared_map_code_cache(); 4684 bool allowed_in_shared_map_code_cache();
4681 4685
4682 // Get the safepoint entry for the given pc. 4686 // Get the safepoint entry for the given pc.
4683 SafepointEntry GetSafepointEntry(Address pc); 4687 SafepointEntry GetSafepointEntry(Address pc);
4684 4688
4689 // Find an object in a stub with a specified map
4690 Object* FindNthObject(int n, Map* match_map);
4691 void ReplaceNthObject(int n, Map* match_map, Object* replace_with);
4692
4685 // Find the first map in an IC stub. 4693 // Find the first map in an IC stub.
4686 Map* FindFirstMap(); 4694 Map* FindFirstMap();
4687 void FindAllMaps(MapHandleList* maps); 4695 void FindAllMaps(MapHandleList* maps);
4688 void ReplaceFirstMap(Map* replace); 4696 void ReplaceFirstMap(Map* replace);
4689 4697
4690 // Find the first code in an IC stub. 4698 // Find the first code in an IC stub.
4691 Code* FindFirstCode(); 4699 Code* FindFirstCode();
4692 void FindAllCode(CodeHandleList* code_list, int length); 4700 void FindAllCode(CodeHandleList* code_list, int length);
4693 4701
4694 // Find the first name in an IC stub. 4702 // Find the first name in an IC stub.
4695 Name* FindFirstName(); 4703 Name* FindFirstName();
4696 4704
4705 void ReplaceNthCell(int n, Cell* replace_with);
4706
4697 class ExtraICStateStrictMode: public BitField<StrictModeFlag, 0, 1> {}; 4707 class ExtraICStateStrictMode: public BitField<StrictModeFlag, 0, 1> {};
4698 class ExtraICStateKeyedAccessStoreMode: 4708 class ExtraICStateKeyedAccessStoreMode:
4699 public BitField<KeyedAccessStoreMode, 1, 4> {}; // NOLINT 4709 public BitField<KeyedAccessStoreMode, 1, 4> {}; // NOLINT
4700 4710
4701 class ExtraICStateStubHolder: public BitField<StubHolder, 0, 1> {}; 4711 class ExtraICStateStubHolder: public BitField<StubHolder, 0, 1> {};
4702 4712
4703 static inline StrictModeFlag GetStrictMode(ExtraICState extra_ic_state) { 4713 static inline StrictModeFlag GetStrictMode(ExtraICState extra_ic_state) {
4704 return ExtraICStateStrictMode::decode(extra_ic_state); 4714 return ExtraICStateStrictMode::decode(extra_ic_state);
4705 } 4715 }
4706 4716
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
4815 #define DECLARE_CODE_AGE_ENUM(X) k##X##CodeAge, 4825 #define DECLARE_CODE_AGE_ENUM(X) k##X##CodeAge,
4816 enum Age { 4826 enum Age {
4817 kNoAge = 0, 4827 kNoAge = 0,
4818 CODE_AGE_LIST(DECLARE_CODE_AGE_ENUM) 4828 CODE_AGE_LIST(DECLARE_CODE_AGE_ENUM)
4819 kAfterLastCodeAge, 4829 kAfterLastCodeAge,
4820 kLastCodeAge = kAfterLastCodeAge - 1, 4830 kLastCodeAge = kAfterLastCodeAge - 1,
4821 kCodeAgeCount = kAfterLastCodeAge - 1 4831 kCodeAgeCount = kAfterLastCodeAge - 1
4822 }; 4832 };
4823 #undef DECLARE_CODE_AGE_ENUM 4833 #undef DECLARE_CODE_AGE_ENUM
4824 4834
4825 // Code aging 4835 // Code aging. Indicates how many full GCs this code has survived without
4836 // being entered through the prologue. Used to determine when it is
4837 // relatively safe to flush this code object and replace it with the lazy
4838 // compilation stub.
4826 static void MakeCodeAgeSequenceYoung(byte* sequence); 4839 static void MakeCodeAgeSequenceYoung(byte* sequence);
4827 void MakeOlder(MarkingParity); 4840 void MakeOlder(MarkingParity);
4828 static bool IsYoungSequence(byte* sequence); 4841 static bool IsYoungSequence(byte* sequence);
4829 bool IsOld(); 4842 bool IsOld();
4830 int GetAge(); 4843 int GetAge();
4831 4844
4832 void PrintDeoptLocation(int bailout_id); 4845 void PrintDeoptLocation(int bailout_id);
4833 4846
4834 #ifdef VERIFY_HEAP 4847 #ifdef VERIFY_HEAP
4835 void VerifyEmbeddedMapsDependency(); 4848 void VerifyEmbeddedMapsDependency();
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
5014 // deoptimized when the transition is replaced by a new version. 5027 // deoptimized when the transition is replaced by a new version.
5015 kTransitionGroup, 5028 kTransitionGroup,
5016 // Group of code that omit run-time prototype checks for prototypes 5029 // Group of code that omit run-time prototype checks for prototypes
5017 // described by this map. The group is deoptimized whenever an object 5030 // described by this map. The group is deoptimized whenever an object
5018 // described by this map changes shape (and transitions to a new map), 5031 // described by this map changes shape (and transitions to a new map),
5019 // possibly invalidating the assumptions embedded in the code. 5032 // possibly invalidating the assumptions embedded in the code.
5020 kPrototypeCheckGroup, 5033 kPrototypeCheckGroup,
5021 // Group of code that depends on elements not being added to objects with 5034 // Group of code that depends on elements not being added to objects with
5022 // this map. 5035 // this map.
5023 kElementsCantBeAddedGroup, 5036 kElementsCantBeAddedGroup,
5024 kGroupCount = kElementsCantBeAddedGroup + 1 5037 // Group of code that depends on global property values in property cells
5038 // not being changed.
5039 kPropertyCellChangedGroup,
5040 kGroupCount = kPropertyCellChangedGroup + 1
5025 }; 5041 };
5026 5042
5027 // Array for holding the index of the first code object of each group. 5043 // Array for holding the index of the first code object of each group.
5028 // The last element stores the total number of code objects. 5044 // The last element stores the total number of code objects.
5029 class GroupStartIndexes { 5045 class GroupStartIndexes {
5030 public: 5046 public:
5031 explicit GroupStartIndexes(DependentCode* entries); 5047 explicit GroupStartIndexes(DependentCode* entries);
5032 void Recompute(DependentCode* entries); 5048 void Recompute(DependentCode* entries);
5033 int at(int i) { return start_indexes_[i]; } 5049 int at(int i) { return start_indexes_[i]; }
5034 int number_of_entries() { return start_indexes_[kGroupCount]; } 5050 int number_of_entries() { return start_indexes_[kGroupCount]; }
(...skipping 21 matching lines...) Expand all
5056 inline bool is_code_at(int i); 5072 inline bool is_code_at(int i);
5057 inline Code* code_at(int i); 5073 inline Code* code_at(int i);
5058 inline CompilationInfo* compilation_info_at(int i); 5074 inline CompilationInfo* compilation_info_at(int i);
5059 inline void set_object_at(int i, Object* object); 5075 inline void set_object_at(int i, Object* object);
5060 inline Object** slot_at(int i); 5076 inline Object** slot_at(int i);
5061 inline Object* object_at(int i); 5077 inline Object* object_at(int i);
5062 inline void clear_at(int i); 5078 inline void clear_at(int i);
5063 inline void copy(int from, int to); 5079 inline void copy(int from, int to);
5064 static inline DependentCode* cast(Object* object); 5080 static inline DependentCode* cast(Object* object);
5065 5081
5082 static DependentCode* ForObject(Handle<HeapObject> object,
5083 DependencyGroup group);
5084
5066 private: 5085 private:
5067 // Make a room at the end of the given group by moving out the first 5086 // Make a room at the end of the given group by moving out the first
5068 // code objects of the subsequent groups. 5087 // code objects of the subsequent groups.
5069 inline void ExtendGroup(DependencyGroup group); 5088 inline void ExtendGroup(DependencyGroup group);
5070 static const int kCodesStartIndex = kGroupCount; 5089 static const int kCodesStartIndex = kGroupCount;
5071 }; 5090 };
5072 5091
5073 5092
5074 // All heap objects have a Map that describes their structure. 5093 // All heap objects have a Map that describes their structure.
5075 // A Map contains information about: 5094 // A Map contains information about:
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
5468 MUST_USE_RESULT MaybeObject* Copy(); 5487 MUST_USE_RESULT MaybeObject* Copy();
5469 5488
5470 // Returns the next free property index (only valid for FAST MODE). 5489 // Returns the next free property index (only valid for FAST MODE).
5471 int NextFreePropertyIndex(); 5490 int NextFreePropertyIndex();
5472 5491
5473 // Returns the number of properties described in instance_descriptors 5492 // Returns the number of properties described in instance_descriptors
5474 // filtering out properties with the specified attributes. 5493 // filtering out properties with the specified attributes.
5475 int NumberOfDescribedProperties(DescriptorFlag which = OWN_DESCRIPTORS, 5494 int NumberOfDescribedProperties(DescriptorFlag which = OWN_DESCRIPTORS,
5476 PropertyAttributes filter = NONE); 5495 PropertyAttributes filter = NONE);
5477 5496
5478 // Returns the number of slots allocated for the initial properties
5479 // backing storage for instances of this map.
5480 int InitialPropertiesLength() {
5481 return pre_allocated_property_fields() + unused_property_fields() -
5482 inobject_properties();
5483 }
5484
5485 // Casting. 5497 // Casting.
5486 static inline Map* cast(Object* obj); 5498 static inline Map* cast(Object* obj);
5487 5499
5488 // Locate an accessor in the instance descriptor. 5500 // Locate an accessor in the instance descriptor.
5489 AccessorDescriptor* FindAccessor(Name* name); 5501 AccessorDescriptor* FindAccessor(Name* name);
5490 5502
5491 // Code cache operations. 5503 // Code cache operations.
5492 5504
5493 // Clears the code cache. 5505 // Clears the code cache.
5494 inline void ClearCodeCache(Heap* heap); 5506 inline void ClearCodeCache(Heap* heap);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
5560 } 5572 }
5561 5573
5562 // Fires when the layout of an object with a leaf map changes. 5574 // Fires when the layout of an object with a leaf map changes.
5563 // This includes adding transitions to the leaf map or changing 5575 // This includes adding transitions to the leaf map or changing
5564 // the descriptor array. 5576 // the descriptor array.
5565 inline void NotifyLeafMapLayoutChange(); 5577 inline void NotifyLeafMapLayoutChange();
5566 5578
5567 inline bool CanOmitPrototypeChecks(); 5579 inline bool CanOmitPrototypeChecks();
5568 5580
5569 void AddDependentCompilationInfo(DependentCode::DependencyGroup group, 5581 void AddDependentCompilationInfo(DependentCode::DependencyGroup group,
5570 CompilationInfo* info); 5582 CompilationInfo* info);
5571 5583
5572 void AddDependentCode(DependentCode::DependencyGroup group, 5584 void AddDependentCode(DependentCode::DependencyGroup group,
5573 Handle<Code> code); 5585 Handle<Code> code);
5574 5586
5575 bool IsMapInArrayPrototypeChain(); 5587 bool IsMapInArrayPrototypeChain();
5576 5588
5577 // Dispatched behavior. 5589 // Dispatched behavior.
5578 DECLARE_PRINTER(Map) 5590 DECLARE_PRINTER(Map)
5579 DECLARE_VERIFIER(Map) 5591 DECLARE_VERIFIER(Map)
5580 5592
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
5746 COMPILATION_STATE_COMPILED = 1 5758 COMPILATION_STATE_COMPILED = 1
5747 }; 5759 };
5748 5760
5749 // [source]: the script source. 5761 // [source]: the script source.
5750 DECL_ACCESSORS(source, Object) 5762 DECL_ACCESSORS(source, Object)
5751 5763
5752 // [name]: the script name. 5764 // [name]: the script name.
5753 DECL_ACCESSORS(name, Object) 5765 DECL_ACCESSORS(name, Object)
5754 5766
5755 // [id]: the script id. 5767 // [id]: the script id.
5756 DECL_ACCESSORS(id, Object) 5768 DECL_ACCESSORS(id, Smi)
5757 5769
5758 // [line_offset]: script line offset in resource from where it was extracted. 5770 // [line_offset]: script line offset in resource from where it was extracted.
5759 DECL_ACCESSORS(line_offset, Smi) 5771 DECL_ACCESSORS(line_offset, Smi)
5760 5772
5761 // [column_offset]: script column offset in resource from where it was 5773 // [column_offset]: script column offset in resource from where it was
5762 // extracted. 5774 // extracted.
5763 DECL_ACCESSORS(column_offset, Smi) 5775 DECL_ACCESSORS(column_offset, Smi)
5764 5776
5765 // [data]: additional data associated with this script. 5777 // [data]: additional data associated with this script.
5766 DECL_ACCESSORS(data, Object) 5778 DECL_ACCESSORS(data, Object)
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
6134 // This is used to determine if we can safely flush code from a function 6146 // This is used to determine if we can safely flush code from a function
6135 // when doing GC if we expect that the function will no longer be used. 6147 // when doing GC if we expect that the function will no longer be used.
6136 DECL_BOOLEAN_ACCESSORS(allows_lazy_compilation) 6148 DECL_BOOLEAN_ACCESSORS(allows_lazy_compilation)
6137 6149
6138 // Indicates if this function can be lazy compiled without a context. 6150 // Indicates if this function can be lazy compiled without a context.
6139 // This is used to determine if we can force compilation without reaching 6151 // This is used to determine if we can force compilation without reaching
6140 // the function through program execution but through other means (e.g. heap 6152 // the function through program execution but through other means (e.g. heap
6141 // iteration by the debugger). 6153 // iteration by the debugger).
6142 DECL_BOOLEAN_ACCESSORS(allows_lazy_compilation_without_context) 6154 DECL_BOOLEAN_ACCESSORS(allows_lazy_compilation_without_context)
6143 6155
6144 // Indicates how many full GCs this function has survived with assigned
6145 // code object. Used to determine when it is relatively safe to flush
6146 // this code object and replace it with lazy compilation stub.
6147 // Age is reset when GC notices that the code object is referenced
6148 // from the stack or compilation cache.
6149 inline int code_age();
6150 inline void set_code_age(int age);
6151
6152 // Indicates whether optimizations have been disabled for this 6156 // Indicates whether optimizations have been disabled for this
6153 // shared function info. If a function is repeatedly optimized or if 6157 // shared function info. If a function is repeatedly optimized or if
6154 // we cannot optimize the function we disable optimization to avoid 6158 // we cannot optimize the function we disable optimization to avoid
6155 // spending time attempting to optimize it again. 6159 // spending time attempting to optimize it again.
6156 DECL_BOOLEAN_ACCESSORS(optimization_disabled) 6160 DECL_BOOLEAN_ACCESSORS(optimization_disabled)
6157 6161
6158 // Indicates the language mode of the function's code as defined by the 6162 // Indicates the language mode of the function's code as defined by the
6159 // current harmony drafts for the next ES language standard. Possible 6163 // current harmony drafts for the next ES language standard. Possible
6160 // values are: 6164 // values are:
6161 // 1. CLASSIC_MODE - Unrestricted syntax and semantics, same as in ES5. 6165 // 1. CLASSIC_MODE - Unrestricted syntax and semantics, same as in ES5.
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
6385 6389
6386 // Bit positions in start_position_and_type. 6390 // Bit positions in start_position_and_type.
6387 // The source code start position is in the 30 most significant bits of 6391 // The source code start position is in the 30 most significant bits of
6388 // the start_position_and_type field. 6392 // the start_position_and_type field.
6389 static const int kIsExpressionBit = 0; 6393 static const int kIsExpressionBit = 0;
6390 static const int kIsTopLevelBit = 1; 6394 static const int kIsTopLevelBit = 1;
6391 static const int kStartPositionShift = 2; 6395 static const int kStartPositionShift = 2;
6392 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); 6396 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1);
6393 6397
6394 // Bit positions in compiler_hints. 6398 // Bit positions in compiler_hints.
6395 static const int kCodeAgeSize = 3;
6396 static const int kCodeAgeMask = (1 << kCodeAgeSize) - 1;
6397
6398 enum CompilerHints { 6399 enum CompilerHints {
6399 kAllowLazyCompilation, 6400 kAllowLazyCompilation,
6400 kAllowLazyCompilationWithoutContext, 6401 kAllowLazyCompilationWithoutContext,
6401 kLiveObjectsMayExist, 6402 kLiveObjectsMayExist,
6402 kCodeAgeShift, 6403 kOptimizationDisabled,
6403 kOptimizationDisabled = kCodeAgeShift + kCodeAgeSize,
6404 kStrictModeFunction, 6404 kStrictModeFunction,
6405 kExtendedModeFunction, 6405 kExtendedModeFunction,
6406 kUsesArguments, 6406 kUsesArguments,
6407 kHasDuplicateParameters, 6407 kHasDuplicateParameters,
6408 kNative, 6408 kNative,
6409 kBoundFunction, 6409 kBoundFunction,
6410 kIsAnonymous, 6410 kIsAnonymous,
6411 kNameShouldPrintAsAnonymous, 6411 kNameShouldPrintAsAnonymous,
6412 kIsFunction, 6412 kIsFunction,
6413 kDontOptimize, 6413 kDontOptimize,
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
6573 public: 6573 public:
6574 // [prototype_or_initial_map]: 6574 // [prototype_or_initial_map]:
6575 DECL_ACCESSORS(prototype_or_initial_map, Object) 6575 DECL_ACCESSORS(prototype_or_initial_map, Object)
6576 6576
6577 // [shared]: The information about the function that 6577 // [shared]: The information about the function that
6578 // can be shared by instances. 6578 // can be shared by instances.
6579 DECL_ACCESSORS(shared, SharedFunctionInfo) 6579 DECL_ACCESSORS(shared, SharedFunctionInfo)
6580 6580
6581 // [context]: The context for this function. 6581 // [context]: The context for this function.
6582 inline Context* context(); 6582 inline Context* context();
6583 inline Object* unchecked_context();
6584 inline void set_context(Object* context); 6583 inline void set_context(Object* context);
6585 6584
6586 // [code]: The generated code object for this function. Executed 6585 // [code]: The generated code object for this function. Executed
6587 // when the function is invoked, e.g. foo() or new foo(). See 6586 // when the function is invoked, e.g. foo() or new foo(). See
6588 // [[Call]] and [[Construct]] description in ECMA-262, section 6587 // [[Call]] and [[Construct]] description in ECMA-262, section
6589 // 8.6.2, page 27. 6588 // 8.6.2, page 27.
6590 inline Code* code(); 6589 inline Code* code();
6591 inline void set_code(Code* code); 6590 inline void set_code(Code* code);
6592 inline void set_code_no_write_barrier(Code* code); 6591 inline void set_code_no_write_barrier(Code* code);
6593 inline void ReplaceCode(Code* code); 6592 inline void ReplaceCode(Code* code);
6594 6593
6595 inline Code* unchecked_code();
6596
6597 // Tells whether this function is builtin. 6594 // Tells whether this function is builtin.
6598 inline bool IsBuiltin(); 6595 inline bool IsBuiltin();
6599 6596
6600 // Tells whether or not the function needs arguments adaption. 6597 // Tells whether or not the function needs arguments adaption.
6601 inline bool NeedsArgumentsAdaption(); 6598 inline bool NeedsArgumentsAdaption();
6602 6599
6603 // Tells whether or not this function has been optimized. 6600 // Tells whether or not this function has been optimized.
6604 inline bool IsOptimized(); 6601 inline bool IsOptimized();
6605 6602
6606 // Tells whether or not this function can be optimized. 6603 // Tells whether or not this function can be optimized.
(...skipping 1968 matching lines...) Expand 10 before | Expand all | Expand 10 after
8575 kValueOffset + kPointerSize, 8572 kValueOffset + kPointerSize,
8576 kSize> BodyDescriptor; 8573 kSize> BodyDescriptor;
8577 8574
8578 private: 8575 private:
8579 DISALLOW_IMPLICIT_CONSTRUCTORS(Cell); 8576 DISALLOW_IMPLICIT_CONSTRUCTORS(Cell);
8580 }; 8577 };
8581 8578
8582 8579
8583 class PropertyCell: public Cell { 8580 class PropertyCell: public Cell {
8584 public: 8581 public:
8582 // [type]: type of the global property.
8585 Type* type(); 8583 Type* type();
8586 void set_type(Type* value, WriteBarrierMode mode = UPDATE_WRITE_BARRIER); 8584 void set_type(Type* value, WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
8587 8585
8586 // [dependent_code]: dependent code that depends on the type of the global
8587 // property.
8588 DECL_ACCESSORS(dependent_code, DependentCode)
8589
8588 // Casting. 8590 // Casting.
8589 static inline PropertyCell* cast(Object* obj); 8591 static inline PropertyCell* cast(Object* obj);
8590 8592
8591 inline Address TypeAddress() { 8593 inline Address TypeAddress() {
8592 return address() + kTypeOffset; 8594 return address() + kTypeOffset;
8593 } 8595 }
8594 8596
8595 // Dispatched behavior. 8597 // Dispatched behavior.
8596 DECLARE_PRINTER(PropertyCell) 8598 DECLARE_PRINTER(PropertyCell)
8597 DECLARE_VERIFIER(PropertyCell) 8599 DECLARE_VERIFIER(PropertyCell)
8598 8600
8599 // Layout description. 8601 // Layout description.
8600 static const int kTypeOffset = kValueOffset + kPointerSize; 8602 static const int kTypeOffset = kValueOffset + kPointerSize;
8601 static const int kSize = kTypeOffset + kPointerSize; 8603 static const int kDependentCodeOffset = kTypeOffset + kPointerSize;
8604 static const int kSize = kDependentCodeOffset + kPointerSize;
8602 8605
8603 typedef FixedBodyDescriptor< 8606 static const int kPointerFieldsBeginOffset = kValueOffset;
8604 kValueOffset, 8607 static const int kPointerFieldsEndOffset = kDependentCodeOffset;
8605 kTypeOffset + kPointerSize, 8608
8606 PropertyCell::kSize> BodyDescriptor; 8609 typedef FixedBodyDescriptor<kValueOffset,
8610 kSize,
8611 kSize> BodyDescriptor;
8612
8613 void AddDependentCompilationInfo(CompilationInfo* info);
8614
8615 void AddDependentCode(Handle<Code> code);
8607 8616
8608 private: 8617 private:
8609 DECL_ACCESSORS(type_raw, Object) 8618 DECL_ACCESSORS(type_raw, Object)
8610 DISALLOW_IMPLICIT_CONSTRUCTORS(PropertyCell); 8619 DISALLOW_IMPLICIT_CONSTRUCTORS(PropertyCell);
8611 }; 8620 };
8612 8621
8613 8622
8614 // The JSProxy describes EcmaScript Harmony proxies 8623 // The JSProxy describes EcmaScript Harmony proxies
8615 class JSProxy: public JSReceiver { 8624 class JSProxy: public JSReceiver {
8616 public: 8625 public:
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
8821 8830
8822 // [flags] 8831 // [flags]
8823 DECL_ACCESSORS(flag, Smi) 8832 DECL_ACCESSORS(flag, Smi)
8824 8833
8825 inline bool is_external(); 8834 inline bool is_external();
8826 inline void set_is_external(bool value); 8835 inline void set_is_external(bool value);
8827 8836
8828 // [weak_next]: linked list of array buffers. 8837 // [weak_next]: linked list of array buffers.
8829 DECL_ACCESSORS(weak_next, Object) 8838 DECL_ACCESSORS(weak_next, Object)
8830 8839
8831 // [weak_first_array]: weak linked list of typed arrays. 8840 // [weak_first_array]: weak linked list of views.
8832 DECL_ACCESSORS(weak_first_array, Object) 8841 DECL_ACCESSORS(weak_first_view, Object)
8833 8842
8834 // Casting. 8843 // Casting.
8835 static inline JSArrayBuffer* cast(Object* obj); 8844 static inline JSArrayBuffer* cast(Object* obj);
8836 8845
8837 // Neutering. Only neuters the buffer, not associated typed arrays. 8846 // Neutering. Only neuters the buffer, not associated typed arrays.
8838 void Neuter(); 8847 void Neuter();
8839 8848
8840 // Dispatched behavior. 8849 // Dispatched behavior.
8841 DECLARE_PRINTER(JSArrayBuffer) 8850 DECLARE_PRINTER(JSArrayBuffer)
8842 DECLARE_VERIFIER(JSArrayBuffer) 8851 DECLARE_VERIFIER(JSArrayBuffer)
8843 8852
8844 static const int kBackingStoreOffset = JSObject::kHeaderSize; 8853 static const int kBackingStoreOffset = JSObject::kHeaderSize;
8845 static const int kByteLengthOffset = kBackingStoreOffset + kPointerSize; 8854 static const int kByteLengthOffset = kBackingStoreOffset + kPointerSize;
8846 static const int kFlagOffset = kByteLengthOffset + kPointerSize; 8855 static const int kFlagOffset = kByteLengthOffset + kPointerSize;
8847 static const int kWeakNextOffset = kFlagOffset + kPointerSize; 8856 static const int kWeakNextOffset = kFlagOffset + kPointerSize;
8848 static const int kWeakFirstArrayOffset = kWeakNextOffset + kPointerSize; 8857 static const int kWeakFirstViewOffset = kWeakNextOffset + kPointerSize;
8849 static const int kSize = kWeakFirstArrayOffset + kPointerSize; 8858 static const int kSize = kWeakFirstViewOffset + kPointerSize;
8850 8859
8851 static const int kSizeWithInternalFields = 8860 static const int kSizeWithInternalFields =
8852 kSize + v8::ArrayBuffer::kInternalFieldCount * kPointerSize; 8861 kSize + v8::ArrayBuffer::kInternalFieldCount * kPointerSize;
8853 8862
8854 private: 8863 private:
8855 // Bit position in a flag 8864 // Bit position in a flag
8856 static const int kIsExternalBit = 0; 8865 static const int kIsExternalBit = 0;
8857 8866
8858 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBuffer); 8867 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBuffer);
8859 }; 8868 };
8860 8869
8861 8870
8862 class JSTypedArray: public JSObject { 8871 class JSArrayBufferView: public JSObject {
8863 public: 8872 public:
8864 // [buffer]: ArrayBuffer that this typed array views. 8873 // [buffer]: ArrayBuffer that this typed array views.
8865 DECL_ACCESSORS(buffer, Object) 8874 DECL_ACCESSORS(buffer, Object)
8866 8875
8867 // [byte_length]: offset of typed array in bytes. 8876 // [byte_length]: offset of typed array in bytes.
8868 DECL_ACCESSORS(byte_offset, Object) 8877 DECL_ACCESSORS(byte_offset, Object)
8869 8878
8870 // [byte_length]: length of typed array in bytes. 8879 // [byte_length]: length of typed array in bytes.
8871 DECL_ACCESSORS(byte_length, Object) 8880 DECL_ACCESSORS(byte_length, Object)
8872 8881
8873 // [length]: length of typed array in elements.
8874 DECL_ACCESSORS(length, Object)
8875
8876 // [weak_next]: linked list of typed arrays over the same array buffer. 8882 // [weak_next]: linked list of typed arrays over the same array buffer.
8877 DECL_ACCESSORS(weak_next, Object) 8883 DECL_ACCESSORS(weak_next, Object)
8878 8884
8885 // Casting.
8886 static inline JSArrayBufferView* cast(Object* obj);
8887
8888 DECLARE_VERIFIER(JSArrayBufferView)
8889
8890 static const int kBufferOffset = JSObject::kHeaderSize;
8891 static const int kByteOffsetOffset = kBufferOffset + kPointerSize;
8892 static const int kByteLengthOffset = kByteOffsetOffset + kPointerSize;
8893 static const int kWeakNextOffset = kByteLengthOffset + kPointerSize;
8894 static const int kViewSize = kWeakNextOffset + kPointerSize;
8895
8896 protected:
8897 void NeuterView();
8898
8899 private:
8900 DISALLOW_IMPLICIT_CONSTRUCTORS(JSArrayBufferView);
8901 };
8902
8903
8904 class JSTypedArray: public JSArrayBufferView {
8905 public:
8906 // [length]: length of typed array in elements.
8907 DECL_ACCESSORS(length, Object)
8908
8879 // Neutering. Only neuters this typed array. 8909 // Neutering. Only neuters this typed array.
8880 void Neuter(); 8910 void Neuter();
8881 8911
8882 // Casting. 8912 // Casting.
8883 static inline JSTypedArray* cast(Object* obj); 8913 static inline JSTypedArray* cast(Object* obj);
8884 8914
8885 ExternalArrayType type(); 8915 ExternalArrayType type();
8886 size_t element_size(); 8916 size_t element_size();
8887 8917
8888 // Dispatched behavior. 8918 // Dispatched behavior.
8889 DECLARE_PRINTER(JSTypedArray) 8919 DECLARE_PRINTER(JSTypedArray)
8890 DECLARE_VERIFIER(JSTypedArray) 8920 DECLARE_VERIFIER(JSTypedArray)
8891 8921
8892 static const int kBufferOffset = JSObject::kHeaderSize; 8922 static const int kLengthOffset = kViewSize + kPointerSize;
8893 static const int kByteOffsetOffset = kBufferOffset + kPointerSize; 8923 static const int kSize = kLengthOffset + kPointerSize;
8894 static const int kByteLengthOffset = kByteOffsetOffset + kPointerSize;
8895 static const int kLengthOffset = kByteLengthOffset + kPointerSize;
8896 static const int kWeakNextOffset = kLengthOffset + kPointerSize;
8897 static const int kSize = kWeakNextOffset + kPointerSize;
8898 8924
8899 private: 8925 private:
8900 DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray); 8926 DISALLOW_IMPLICIT_CONSTRUCTORS(JSTypedArray);
8901 }; 8927 };
8902 8928
8903 8929
8930 class JSDataView: public JSArrayBufferView {
8931 public:
8932 // Only neuters this DataView
8933 void Neuter();
8934
8935 // Casting.
8936 static inline JSDataView* cast(Object* obj);
8937
8938 // Dispatched behavior.
8939 DECLARE_PRINTER(JSDataView)
8940 DECLARE_VERIFIER(JSDataView)
8941
8942 static const int kSize = kViewSize;
8943
8944 private:
8945 DISALLOW_IMPLICIT_CONSTRUCTORS(JSDataView);
8946 };
8947
8948
8904 // Foreign describes objects pointing from JavaScript to C structures. 8949 // Foreign describes objects pointing from JavaScript to C structures.
8905 // Since they cannot contain references to JS HeapObjects they can be 8950 // Since they cannot contain references to JS HeapObjects they can be
8906 // placed in old_data_space. 8951 // placed in old_data_space.
8907 class Foreign: public HeapObject { 8952 class Foreign: public HeapObject {
8908 public: 8953 public:
8909 // [address]: field containing the address. 8954 // [address]: field containing the address.
8910 inline Address foreign_address(); 8955 inline Address foreign_address();
8911 inline void set_foreign_address(Address value); 8956 inline void set_foreign_address(Address value);
8912 8957
8913 // Casting. 8958 // Casting.
(...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
9702 } else { 9747 } else {
9703 value &= ~(1 << bit_position); 9748 value &= ~(1 << bit_position);
9704 } 9749 }
9705 return value; 9750 return value;
9706 } 9751 }
9707 }; 9752 };
9708 9753
9709 } } // namespace v8::internal 9754 } } // namespace v8::internal
9710 9755
9711 #endif // V8_OBJECTS_H_ 9756 #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