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

Side by Side Diff: src/objects.h

Issue 363323003: More OStreamsUse OStreams more often. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased and polished. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/jsregexp.cc ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_OBJECTS_H_ 5 #ifndef V8_OBJECTS_H_
6 #define V8_OBJECTS_H_ 6 #define V8_OBJECTS_H_
7 7
8 #include "src/allocation.h" 8 #include "src/allocation.h"
9 #include "src/assert-scope.h" 9 #include "src/assert-scope.h"
10 #include "src/builtins.h" 10 #include "src/builtins.h"
11 #include "src/checks.h" 11 #include "src/checks.h"
12 #include "src/elements-kind.h" 12 #include "src/elements-kind.h"
13 #include "src/field-index.h" 13 #include "src/field-index.h"
14 #include "src/flags.h" 14 #include "src/flags.h"
15 #include "src/list.h" 15 #include "src/list.h"
16 #include "src/ostreams.h"
16 #include "src/property-details.h" 17 #include "src/property-details.h"
17 #include "src/smart-pointers.h" 18 #include "src/smart-pointers.h"
18 #include "src/unicode-inl.h" 19 #include "src/unicode-inl.h"
19 #include "src/zone.h" 20 #include "src/zone.h"
20 21
21 #if V8_TARGET_ARCH_ARM 22 #if V8_TARGET_ARCH_ARM
22 #include "src/arm/constants-arm.h" // NOLINT 23 #include "src/arm/constants-arm.h" // NOLINT
23 #elif V8_TARGET_ARCH_ARM64 24 #elif V8_TARGET_ARCH_ARM64
24 #include "src/arm64/constants-arm64.h" // NOLINT 25 #include "src/arm64/constants-arm64.h" // NOLINT
25 #elif V8_TARGET_ARCH_MIPS 26 #elif V8_TARGET_ARCH_MIPS
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 // A template-ized version of the IsXXX functions. 889 // A template-ized version of the IsXXX functions.
889 template <class C> inline bool Is(Object* obj); 890 template <class C> inline bool Is(Object* obj);
890 891
891 #ifdef VERIFY_HEAP 892 #ifdef VERIFY_HEAP
892 #define DECLARE_VERIFIER(Name) void Name##Verify(); 893 #define DECLARE_VERIFIER(Name) void Name##Verify();
893 #else 894 #else
894 #define DECLARE_VERIFIER(Name) 895 #define DECLARE_VERIFIER(Name)
895 #endif 896 #endif
896 897
897 #ifdef OBJECT_PRINT 898 #ifdef OBJECT_PRINT
898 #define DECLARE_PRINTER(Name) void Name##Print(FILE* out = stdout); 899 #define DECLARE_PRINTER(Name) void Name##Print(OStream& os); // NOLINT
899 #else 900 #else
900 #define DECLARE_PRINTER(Name) 901 #define DECLARE_PRINTER(Name)
901 #endif 902 #endif
902 903
903 904
904 #define OBJECT_TYPE_LIST(V) \ 905 #define OBJECT_TYPE_LIST(V) \
905 V(Smi) \ 906 V(Smi) \
906 V(HeapObject) \ 907 V(HeapObject) \
907 V(Number) \ 908 V(Number) \
908 909
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
1558 #endif 1559 #endif
1559 1560
1560 inline void VerifyApiCallResultType(); 1561 inline void VerifyApiCallResultType();
1561 1562
1562 // Prints this object without details. 1563 // Prints this object without details.
1563 void ShortPrint(FILE* out = stdout); 1564 void ShortPrint(FILE* out = stdout);
1564 1565
1565 // Prints this object without details to a message accumulator. 1566 // Prints this object without details to a message accumulator.
1566 void ShortPrint(StringStream* accumulator); 1567 void ShortPrint(StringStream* accumulator);
1567 1568
1569 // For our gdb macros, we should perhaps change these in the future.
1570 void Print();
1571
1568 DECLARE_CAST(Object) 1572 DECLARE_CAST(Object)
1569 1573
1570 // Layout description. 1574 // Layout description.
1571 static const int kHeaderSize = 0; // Object does not take up any space. 1575 static const int kHeaderSize = 0; // Object does not take up any space.
1572 1576
1573 #ifdef OBJECT_PRINT 1577 #ifdef OBJECT_PRINT
1574 // Prints this object with details. 1578 // Prints this object with details.
1575 void Print(); 1579 void Print(OStream& os); // NOLINT
1576 void Print(FILE* out);
1577 void PrintLn();
1578 void PrintLn(FILE* out);
1579 #endif 1580 #endif
1580 1581
1581 private: 1582 private:
1582 DISALLOW_IMPLICIT_CONSTRUCTORS(Object); 1583 DISALLOW_IMPLICIT_CONSTRUCTORS(Object);
1583 }; 1584 };
1584 1585
1585 1586
1587 struct Brief {
1588 explicit Brief(const Object* const v) : value(v) {}
1589 const Object* value;
1590 };
1591
1592
1593 OStream& operator<<(OStream& os, const Brief& v);
1594
1595
1586 // Smi represents integer Numbers that can be stored in 31 bits. 1596 // Smi represents integer Numbers that can be stored in 31 bits.
1587 // Smis are immediate which means they are NOT allocated in the heap. 1597 // Smis are immediate which means they are NOT allocated in the heap.
1588 // The this pointer has the following format: [31 bit signed int] 0 1598 // The this pointer has the following format: [31 bit signed int] 0
1589 // For long smis it has the following format: 1599 // For long smis it has the following format:
1590 // [32 bit signed int] [31 bits zero padding] 0 1600 // [32 bit signed int] [31 bits zero padding] 0
1591 // Smi stands for small integer. 1601 // Smi stands for small integer.
1592 class Smi: public Object { 1602 class Smi: public Object {
1593 public: 1603 public:
1594 // Returns the integer value. 1604 // Returns the integer value.
1595 inline int value() const; 1605 inline int value() const;
1596 1606
1597 // Convert a value to a Smi object. 1607 // Convert a value to a Smi object.
1598 static inline Smi* FromInt(int value); 1608 static inline Smi* FromInt(int value);
1599 1609
1600 static inline Smi* FromIntptr(intptr_t value); 1610 static inline Smi* FromIntptr(intptr_t value);
1601 1611
1602 // Returns whether value can be represented in a Smi. 1612 // Returns whether value can be represented in a Smi.
1603 static inline bool IsValid(intptr_t value); 1613 static inline bool IsValid(intptr_t value);
1604 1614
1605 DECLARE_CAST(Smi) 1615 DECLARE_CAST(Smi)
1606 1616
1607 // Dispatched behavior. 1617 // Dispatched behavior.
1608 void SmiPrint(FILE* out = stdout); 1618 void SmiPrint(OStream& os) const; // NOLINT
1609 void SmiPrint(StringStream* accumulator);
1610
1611 DECLARE_VERIFIER(Smi) 1619 DECLARE_VERIFIER(Smi)
1612 1620
1613 static const int kMinValue = 1621 static const int kMinValue =
1614 (static_cast<unsigned int>(-1)) << (kSmiValueSize - 1); 1622 (static_cast<unsigned int>(-1)) << (kSmiValueSize - 1);
1615 static const int kMaxValue = -(kMinValue + 1); 1623 static const int kMaxValue = -(kMinValue + 1);
1616 1624
1617 private: 1625 private:
1618 DISALLOW_IMPLICIT_CONSTRUCTORS(Smi); 1626 DISALLOW_IMPLICIT_CONSTRUCTORS(Smi);
1619 }; 1627 };
1620 1628
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1739 1747
1740 // Return the write barrier mode for this. Callers of this function 1748 // Return the write barrier mode for this. Callers of this function
1741 // must be able to present a reference to an DisallowHeapAllocation 1749 // must be able to present a reference to an DisallowHeapAllocation
1742 // object as a sign that they are not going to use this function 1750 // object as a sign that they are not going to use this function
1743 // from code that allocates and thus invalidates the returned write 1751 // from code that allocates and thus invalidates the returned write
1744 // barrier mode. 1752 // barrier mode.
1745 inline WriteBarrierMode GetWriteBarrierMode( 1753 inline WriteBarrierMode GetWriteBarrierMode(
1746 const DisallowHeapAllocation& promise); 1754 const DisallowHeapAllocation& promise);
1747 1755
1748 // Dispatched behavior. 1756 // Dispatched behavior.
1749 void HeapObjectShortPrint(StringStream* accumulator); 1757 void HeapObjectShortPrint(OStream& os); // NOLINT
1750 #ifdef OBJECT_PRINT 1758 #ifdef OBJECT_PRINT
1751 void PrintHeader(FILE* out, const char* id); 1759 void PrintHeader(OStream& os, const char* id); // NOLINT
1752 #endif 1760 #endif
1753 DECLARE_PRINTER(HeapObject) 1761 DECLARE_PRINTER(HeapObject)
1754 DECLARE_VERIFIER(HeapObject) 1762 DECLARE_VERIFIER(HeapObject)
1755 #ifdef VERIFY_HEAP 1763 #ifdef VERIFY_HEAP
1756 inline void VerifyObjectField(int offset); 1764 inline void VerifyObjectField(int offset);
1757 inline void VerifySmiField(int offset); 1765 inline void VerifySmiField(int offset);
1758 1766
1759 // Verify a pointer is a valid HeapObject pointer that points to object 1767 // Verify a pointer is a valid HeapObject pointer that points to object
1760 // areas in the heap. 1768 // areas in the heap.
1761 static void VerifyHeapPointer(Object* p); 1769 static void VerifyHeapPointer(Object* p);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1828 public: 1836 public:
1829 // [value]: number value. 1837 // [value]: number value.
1830 inline double value() const; 1838 inline double value() const;
1831 inline void set_value(double value); 1839 inline void set_value(double value);
1832 1840
1833 DECLARE_CAST(HeapNumber) 1841 DECLARE_CAST(HeapNumber)
1834 1842
1835 // Dispatched behavior. 1843 // Dispatched behavior.
1836 bool HeapNumberBooleanValue(); 1844 bool HeapNumberBooleanValue();
1837 1845
1838 void HeapNumberPrint(FILE* out = stdout); 1846 void HeapNumberPrint(OStream& os); // NOLINT
1839 void HeapNumberPrint(StringStream* accumulator);
1840 DECLARE_VERIFIER(HeapNumber) 1847 DECLARE_VERIFIER(HeapNumber)
1841 1848
1842 inline int get_exponent(); 1849 inline int get_exponent();
1843 inline int get_sign(); 1850 inline int get_sign();
1844 1851
1845 // Layout description. 1852 // Layout description.
1846 static const int kValueOffset = HeapObject::kHeaderSize; 1853 static const int kValueOffset = HeapObject::kHeaderSize;
1847 // IEEE doubles are two 32 bit words. The first is just mantissa, the second 1854 // IEEE doubles are two 32 bit words. The first is just mantissa, the second
1848 // is a mixture of sign, exponent and mantissa. The offsets of two 32 bit 1855 // is a mixture of sign, exponent and mantissa. The offsets of two 32 bit
1849 // words within double numbers are endian dependent and they are set 1856 // words within double numbers are endian dependent and they are set
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
2527 static Handle<Object> GetDataProperty(Handle<JSObject> object, 2534 static Handle<Object> GetDataProperty(Handle<JSObject> object,
2528 Handle<Name> key); 2535 Handle<Name> key);
2529 2536
2530 DECLARE_CAST(JSObject) 2537 DECLARE_CAST(JSObject)
2531 2538
2532 // Dispatched behavior. 2539 // Dispatched behavior.
2533 void JSObjectShortPrint(StringStream* accumulator); 2540 void JSObjectShortPrint(StringStream* accumulator);
2534 DECLARE_PRINTER(JSObject) 2541 DECLARE_PRINTER(JSObject)
2535 DECLARE_VERIFIER(JSObject) 2542 DECLARE_VERIFIER(JSObject)
2536 #ifdef OBJECT_PRINT 2543 #ifdef OBJECT_PRINT
2537 void PrintProperties(FILE* out = stdout); 2544 void PrintProperties(OStream& os); // NOLINT
2538 void PrintElements(FILE* out = stdout); 2545 void PrintElements(OStream& os); // NOLINT
2539 void PrintTransitions(FILE* out = stdout); 2546 void PrintTransitions(OStream& os); // NOLINT
2540 #endif 2547 #endif
2541 2548
2542 static void PrintElementsTransition( 2549 static void PrintElementsTransition(
2543 FILE* file, Handle<JSObject> object, 2550 FILE* file, Handle<JSObject> object,
2544 ElementsKind from_kind, Handle<FixedArrayBase> from_elements, 2551 ElementsKind from_kind, Handle<FixedArrayBase> from_elements,
2545 ElementsKind to_kind, Handle<FixedArrayBase> to_elements); 2552 ElementsKind to_kind, Handle<FixedArrayBase> to_elements);
2546 2553
2547 void PrintInstanceMigration(FILE* file, Map* original_map, Map* new_map); 2554 void PrintInstanceMigration(FILE* file, Map* original_map, Map* new_map);
2548 2555
2549 #ifdef DEBUG 2556 #ifdef DEBUG
(...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after
3532 static const int kEnumCacheBridgeCacheOffset = FixedArray::kHeaderSize; 3539 static const int kEnumCacheBridgeCacheOffset = FixedArray::kHeaderSize;
3533 3540
3534 // Layout of descriptor. 3541 // Layout of descriptor.
3535 static const int kDescriptorKey = 0; 3542 static const int kDescriptorKey = 0;
3536 static const int kDescriptorDetails = 1; 3543 static const int kDescriptorDetails = 1;
3537 static const int kDescriptorValue = 2; 3544 static const int kDescriptorValue = 2;
3538 static const int kDescriptorSize = 3; 3545 static const int kDescriptorSize = 3;
3539 3546
3540 #ifdef OBJECT_PRINT 3547 #ifdef OBJECT_PRINT
3541 // Print all the descriptors. 3548 // Print all the descriptors.
3542 void PrintDescriptors(FILE* out = stdout); 3549 void PrintDescriptors(OStream& os); // NOLINT
3543 #endif 3550 #endif
3544 3551
3545 #ifdef DEBUG 3552 #ifdef DEBUG
3546 // Is the descriptor array sorted and without duplicates? 3553 // Is the descriptor array sorted and without duplicates?
3547 bool IsSortedNoDuplicates(int valid_descriptors = -1); 3554 bool IsSortedNoDuplicates(int valid_descriptors = -1);
3548 3555
3549 // Is the descriptor array consistent with the back pointers in targets? 3556 // Is the descriptor array consistent with the back pointers in targets?
3550 bool IsConsistentWithBackPointers(Map* current_map); 3557 bool IsConsistentWithBackPointers(Map* current_map);
3551 3558
3552 // Are two DescriptorArrays equal? 3559 // Are two DescriptorArrays equal?
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
4057 // Creates a new dictionary. 4064 // Creates a new dictionary.
4058 MUST_USE_RESULT static Handle<Derived> New( 4065 MUST_USE_RESULT static Handle<Derived> New(
4059 Isolate* isolate, 4066 Isolate* isolate,
4060 int at_least_space_for, 4067 int at_least_space_for,
4061 PretenureFlag pretenure = NOT_TENURED); 4068 PretenureFlag pretenure = NOT_TENURED);
4062 4069
4063 // Ensure enough space for n additional elements. 4070 // Ensure enough space for n additional elements.
4064 static Handle<Derived> EnsureCapacity(Handle<Derived> obj, int n, Key key); 4071 static Handle<Derived> EnsureCapacity(Handle<Derived> obj, int n, Key key);
4065 4072
4066 #ifdef OBJECT_PRINT 4073 #ifdef OBJECT_PRINT
4067 void Print(FILE* out = stdout); 4074 void Print(OStream& os); // NOLINT
4068 #endif 4075 #endif
4069 // Returns the key (slow). 4076 // Returns the key (slow).
4070 Object* SlowReverseLookup(Object* value); 4077 Object* SlowReverseLookup(Object* value);
4071 4078
4072 // Sets the entry to (key, value) pair. 4079 // Sets the entry to (key, value) pair.
4073 inline void SetEntry(int entry, 4080 inline void SetEntry(int entry,
4074 Handle<Object> key, 4081 Handle<Object> key,
4075 Handle<Object> value); 4082 Handle<Object> value);
4076 inline void SetEntry(int entry, 4083 inline void SetEntry(int entry,
4077 Handle<Object> key, 4084 Handle<Object> key,
(...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after
5344 } 5351 }
5345 5352
5346 // Allocates a DeoptimizationInputData. 5353 // Allocates a DeoptimizationInputData.
5347 static Handle<DeoptimizationInputData> New(Isolate* isolate, 5354 static Handle<DeoptimizationInputData> New(Isolate* isolate,
5348 int deopt_entry_count, 5355 int deopt_entry_count,
5349 PretenureFlag pretenure); 5356 PretenureFlag pretenure);
5350 5357
5351 DECLARE_CAST(DeoptimizationInputData) 5358 DECLARE_CAST(DeoptimizationInputData)
5352 5359
5353 #ifdef ENABLE_DISASSEMBLER 5360 #ifdef ENABLE_DISASSEMBLER
5354 void DeoptimizationInputDataPrint(FILE* out); 5361 void DeoptimizationInputDataPrint(OStream& os); // NOLINT
5355 #endif 5362 #endif
5356 5363
5357 private: 5364 private:
5358 static int IndexForEntry(int i) { 5365 static int IndexForEntry(int i) {
5359 return kFirstDeoptEntryIndex + (i * kDeoptEntrySize); 5366 return kFirstDeoptEntryIndex + (i * kDeoptEntrySize);
5360 } 5367 }
5361 5368
5362 static int LengthFor(int entry_count) { 5369 static int LengthFor(int entry_count) {
5363 return IndexForEntry(entry_count); 5370 return IndexForEntry(entry_count);
5364 } 5371 }
(...skipping 25 matching lines...) Expand all
5390 } 5397 }
5391 5398
5392 // Allocates a DeoptimizationOutputData. 5399 // Allocates a DeoptimizationOutputData.
5393 static Handle<DeoptimizationOutputData> New(Isolate* isolate, 5400 static Handle<DeoptimizationOutputData> New(Isolate* isolate,
5394 int number_of_deopt_points, 5401 int number_of_deopt_points,
5395 PretenureFlag pretenure); 5402 PretenureFlag pretenure);
5396 5403
5397 DECLARE_CAST(DeoptimizationOutputData) 5404 DECLARE_CAST(DeoptimizationOutputData)
5398 5405
5399 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER) 5406 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER)
5400 void DeoptimizationOutputDataPrint(FILE* out); 5407 void DeoptimizationOutputDataPrint(OStream& os); // NOLINT
5401 #endif 5408 #endif
5402 }; 5409 };
5403 5410
5404 5411
5405 // Forward declaration. 5412 // Forward declaration.
5406 class Cell; 5413 class Cell;
5407 class PropertyCell; 5414 class PropertyCell;
5408 class SafepointEntry; 5415 class SafepointEntry;
5409 class TypeFeedbackInfo; 5416 class TypeFeedbackInfo;
5410 5417
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
5456 NORMAL, 5463 NORMAL,
5457 FAST 5464 FAST
5458 }; 5465 };
5459 5466
5460 static const int kPrologueOffsetNotSet = -1; 5467 static const int kPrologueOffsetNotSet = -1;
5461 5468
5462 #ifdef ENABLE_DISASSEMBLER 5469 #ifdef ENABLE_DISASSEMBLER
5463 // Printing 5470 // Printing
5464 static const char* ICState2String(InlineCacheState state); 5471 static const char* ICState2String(InlineCacheState state);
5465 static const char* StubType2String(StubType type); 5472 static const char* StubType2String(StubType type);
5466 static void PrintExtraICState(FILE* out, Kind kind, ExtraICState extra); 5473 static void PrintExtraICState(OStream& os, // NOLINT
5467 void Disassemble(const char* name, FILE* out = stdout); 5474 Kind kind, ExtraICState extra);
5475 void Disassemble(const char* name, OStream& os); // NOLINT
5468 #endif // ENABLE_DISASSEMBLER 5476 #endif // ENABLE_DISASSEMBLER
5469 5477
5470 // [instruction_size]: Size of the native instructions 5478 // [instruction_size]: Size of the native instructions
5471 inline int instruction_size() const; 5479 inline int instruction_size() const;
5472 inline void set_instruction_size(int value); 5480 inline void set_instruction_size(int value);
5473 5481
5474 // [relocation_info]: Code relocation information 5482 // [relocation_info]: Code relocation information
5475 DECL_ACCESSORS(relocation_info, ByteArray) 5483 DECL_ACCESSORS(relocation_info, ByteArray)
5476 void InvalidateRelocation(); 5484 void InvalidateRelocation();
5477 void InvalidateEmbeddedObjects(); 5485 void InvalidateEmbeddedObjects();
(...skipping 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after
7171 DECL_ACCESSORS(inferred_name, String) 7179 DECL_ACCESSORS(inferred_name, String)
7172 7180
7173 // The function's name if it is non-empty, otherwise the inferred name. 7181 // The function's name if it is non-empty, otherwise the inferred name.
7174 String* DebugName(); 7182 String* DebugName();
7175 7183
7176 // Position of the 'function' token in the script source. 7184 // Position of the 'function' token in the script source.
7177 inline int function_token_position() const; 7185 inline int function_token_position() const;
7178 inline void set_function_token_position(int function_token_position); 7186 inline void set_function_token_position(int function_token_position);
7179 7187
7180 // Position of this function in the script source. 7188 // Position of this function in the script source.
7181 inline int start_position(); 7189 inline int start_position() const;
7182 inline void set_start_position(int start_position); 7190 inline void set_start_position(int start_position);
7183 7191
7184 // End position of this function in the script source. 7192 // End position of this function in the script source.
7185 inline int end_position() const; 7193 inline int end_position() const;
7186 inline void set_end_position(int end_position); 7194 inline void set_end_position(int end_position);
7187 7195
7188 // Is this function a function expression in the source code. 7196 // Is this function a function expression in the source code.
7189 DECL_BOOLEAN_ACCESSORS(is_expression) 7197 DECL_BOOLEAN_ACCESSORS(is_expression)
7190 7198
7191 // Is this function a top-level function (scripts, evals). 7199 // Is this function a top-level function (scripts, evals).
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
7281 void DisableOptimization(BailoutReason reason); 7289 void DisableOptimization(BailoutReason reason);
7282 7290
7283 inline BailoutReason DisableOptimizationReason(); 7291 inline BailoutReason DisableOptimizationReason();
7284 7292
7285 // Lookup the bailout ID and ASSERT that it exists in the non-optimized 7293 // Lookup the bailout ID and ASSERT that it exists in the non-optimized
7286 // code, returns whether it asserted (i.e., always true if assertions are 7294 // code, returns whether it asserted (i.e., always true if assertions are
7287 // disabled). 7295 // disabled).
7288 bool VerifyBailoutId(BailoutId id); 7296 bool VerifyBailoutId(BailoutId id);
7289 7297
7290 // [source code]: Source code for the function. 7298 // [source code]: Source code for the function.
7291 bool HasSourceCode(); 7299 bool HasSourceCode() const;
7292 Handle<Object> GetSourceCode(); 7300 Handle<Object> GetSourceCode();
7293 7301
7294 // Number of times the function was optimized. 7302 // Number of times the function was optimized.
7295 inline int opt_count(); 7303 inline int opt_count();
7296 inline void set_opt_count(int opt_count); 7304 inline void set_opt_count(int opt_count);
7297 7305
7298 // Number of times the function was deoptimized. 7306 // Number of times the function was deoptimized.
7299 inline void set_deopt_count(int value); 7307 inline void set_deopt_count(int value);
7300 inline int deopt_count(); 7308 inline int deopt_count();
7301 inline void increment_deopt_count(); 7309 inline void increment_deopt_count();
(...skipping 25 matching lines...) Expand all
7327 // Source size of this function. 7335 // Source size of this function.
7328 int SourceSize(); 7336 int SourceSize();
7329 7337
7330 // Calculate the instance size. 7338 // Calculate the instance size.
7331 int CalculateInstanceSize(); 7339 int CalculateInstanceSize();
7332 7340
7333 // Calculate the number of in-object properties. 7341 // Calculate the number of in-object properties.
7334 int CalculateInObjectProperties(); 7342 int CalculateInObjectProperties();
7335 7343
7336 // Dispatched behavior. 7344 // Dispatched behavior.
7337 // Set max_length to -1 for unlimited length.
7338 void SourceCodePrint(StringStream* accumulator, int max_length);
7339 DECLARE_PRINTER(SharedFunctionInfo) 7345 DECLARE_PRINTER(SharedFunctionInfo)
7340 DECLARE_VERIFIER(SharedFunctionInfo) 7346 DECLARE_VERIFIER(SharedFunctionInfo)
7341 7347
7342 void ResetForNewContext(int new_ic_age); 7348 void ResetForNewContext(int new_ic_age);
7343 7349
7344 DECLARE_CAST(SharedFunctionInfo) 7350 DECLARE_CAST(SharedFunctionInfo)
7345 7351
7346 // Constants. 7352 // Constants.
7347 static const int kDontAdaptArgumentsSentinel = -1; 7353 static const int kDontAdaptArgumentsSentinel = -1;
7348 7354
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
7514 ((kNative + kCompilerHintsSmiTagSize) / kBitsPerByte); 7520 ((kNative + kCompilerHintsSmiTagSize) / kBitsPerByte);
7515 #else 7521 #else
7516 #error Unknown byte ordering 7522 #error Unknown byte ordering
7517 #endif 7523 #endif
7518 7524
7519 private: 7525 private:
7520 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo); 7526 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo);
7521 }; 7527 };
7522 7528
7523 7529
7530 // Printing support.
7531 struct SourceCodeOf {
7532 SourceCodeOf(SharedFunctionInfo* v, int max = -1)
7533 : value(v), max_length(max) {}
7534 const SharedFunctionInfo* value;
7535 int max_length;
7536 };
7537
7538
7539 OStream& operator<<(OStream& os, const SourceCodeOf& v);
7540
7541
7524 class JSGeneratorObject: public JSObject { 7542 class JSGeneratorObject: public JSObject {
7525 public: 7543 public:
7526 // [function]: The function corresponding to this generator object. 7544 // [function]: The function corresponding to this generator object.
7527 DECL_ACCESSORS(function, JSFunction) 7545 DECL_ACCESSORS(function, JSFunction)
7528 7546
7529 // [context]: The context of the suspended computation. 7547 // [context]: The context of the suspended computation.
7530 DECL_ACCESSORS(context, Context) 7548 DECL_ACCESSORS(context, Context)
7531 7549
7532 // [receiver]: The receiver of the suspended computation. 7550 // [receiver]: The receiver of the suspended computation.
7533 DECL_ACCESSORS(receiver, Object) 7551 DECL_ACCESSORS(receiver, Object)
(...skipping 1669 matching lines...) Expand 10 before | Expand all | Expand 10 after
9203 9221
9204 DECLARE_CAST(String) 9222 DECLARE_CAST(String)
9205 9223
9206 void PrintOn(FILE* out); 9224 void PrintOn(FILE* out);
9207 9225
9208 // For use during stack traces. Performs rudimentary sanity check. 9226 // For use during stack traces. Performs rudimentary sanity check.
9209 bool LooksValid(); 9227 bool LooksValid();
9210 9228
9211 // Dispatched behavior. 9229 // Dispatched behavior.
9212 void StringShortPrint(StringStream* accumulator); 9230 void StringShortPrint(StringStream* accumulator);
9231 void PrintUC16(OStream& os, int start = 0, int end = -1); // NOLINT
9213 #ifdef OBJECT_PRINT 9232 #ifdef OBJECT_PRINT
9214 char* ToAsciiArray(); 9233 char* ToAsciiArray();
9215 #endif 9234 #endif
9216 DECLARE_PRINTER(String) 9235 DECLARE_PRINTER(String)
9217 DECLARE_VERIFIER(String) 9236 DECLARE_VERIFIER(String)
9218 9237
9219 inline bool IsFlat(); 9238 inline bool IsFlat();
9220 9239
9221 // Layout description. 9240 // Layout description.
9222 static const int kLengthOffset = Name::kSize; 9241 static const int kLengthOffset = Name::kSize;
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after
10115 // [table]: the backing hash table mapping keys to values. 10134 // [table]: the backing hash table mapping keys to values.
10116 DECL_ACCESSORS(table, Object) 10135 DECL_ACCESSORS(table, Object)
10117 10136
10118 // [index]: The index into the data table. 10137 // [index]: The index into the data table.
10119 DECL_ACCESSORS(index, Smi) 10138 DECL_ACCESSORS(index, Smi)
10120 10139
10121 // [kind]: The kind of iteration this is. One of the [Kind] enum values. 10140 // [kind]: The kind of iteration this is. One of the [Kind] enum values.
10122 DECL_ACCESSORS(kind, Smi) 10141 DECL_ACCESSORS(kind, Smi)
10123 10142
10124 #ifdef OBJECT_PRINT 10143 #ifdef OBJECT_PRINT
10125 void OrderedHashTableIteratorPrint(FILE* out); 10144 void OrderedHashTableIteratorPrint(OStream& os); // NOLINT
10126 #endif 10145 #endif
10127 10146
10128 static const int kTableOffset = JSObject::kHeaderSize; 10147 static const int kTableOffset = JSObject::kHeaderSize;
10129 static const int kIndexOffset = kTableOffset + kPointerSize; 10148 static const int kIndexOffset = kTableOffset + kPointerSize;
10130 static const int kKindOffset = kIndexOffset + kPointerSize; 10149 static const int kKindOffset = kIndexOffset + kPointerSize;
10131 static const int kSize = kKindOffset + kPointerSize; 10150 static const int kSize = kKindOffset + kPointerSize;
10132 10151
10133 enum Kind { 10152 enum Kind {
10134 kKindKeys = 1, 10153 kKindKeys = 1,
10135 kKindValues = 2, 10154 kKindValues = 2,
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after
11208 } else { 11227 } else {
11209 value &= ~(1 << bit_position); 11228 value &= ~(1 << bit_position);
11210 } 11229 }
11211 return value; 11230 return value;
11212 } 11231 }
11213 }; 11232 };
11214 11233
11215 } } // namespace v8::internal 11234 } } // namespace v8::internal
11216 11235
11217 #endif // V8_OBJECTS_H_ 11236 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/jsregexp.cc ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698