OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 | 1059 |
1060 // Extract the number. | 1060 // Extract the number. |
1061 inline double Number(); | 1061 inline double Number(); |
1062 inline bool IsNaN(); | 1062 inline bool IsNaN(); |
1063 | 1063 |
1064 inline Representation OptimalRepresentation() { | 1064 inline Representation OptimalRepresentation() { |
1065 if (FLAG_track_fields && IsSmi()) { | 1065 if (FLAG_track_fields && IsSmi()) { |
1066 return Representation::Smi(); | 1066 return Representation::Smi(); |
1067 } else if (FLAG_track_double_fields && IsHeapNumber()) { | 1067 } else if (FLAG_track_double_fields && IsHeapNumber()) { |
1068 return Representation::Double(); | 1068 return Representation::Double(); |
| 1069 } else if (FLAG_track_heap_object_fields && !IsUndefined()) { |
| 1070 // Don't track undefined as heapobject because it's also used as temporary |
| 1071 // value for computed fields that may turn out to be Smi. That combination |
| 1072 // will go tagged, so go tagged immediately. |
| 1073 // TODO(verwaest): Change once we track computed boilerplate fields. |
| 1074 ASSERT(IsHeapObject()); |
| 1075 return Representation::HeapObject(); |
1069 } else { | 1076 } else { |
1070 return Representation::Tagged(); | 1077 return Representation::Tagged(); |
1071 } | 1078 } |
1072 } | 1079 } |
1073 | 1080 |
1074 inline bool FitsRepresentation(Representation representation) { | 1081 inline bool FitsRepresentation(Representation representation) { |
1075 if (FLAG_track_fields && representation.IsSmi()) { | 1082 if (FLAG_track_fields && representation.IsSmi()) { |
1076 return IsSmi(); | 1083 return IsSmi(); |
1077 } else if (FLAG_track_double_fields && representation.IsDouble()) { | 1084 } else if (FLAG_track_double_fields && representation.IsDouble()) { |
1078 return IsNumber(); | 1085 return IsNumber(); |
| 1086 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { |
| 1087 return IsHeapObject(); |
1079 } | 1088 } |
1080 return true; | 1089 return true; |
1081 } | 1090 } |
1082 | 1091 |
1083 inline MaybeObject* AllocateNewStorageFor(Heap* heap, | 1092 inline MaybeObject* AllocateNewStorageFor(Heap* heap, |
1084 Representation representation, | 1093 Representation representation, |
1085 PretenureFlag tenure = NOT_TENURED); | 1094 PretenureFlag tenure = NOT_TENURED); |
1086 | 1095 |
1087 // Returns true if the object is of the correct type to be used as a | 1096 // Returns true if the object is of the correct type to be used as a |
1088 // implementation of a JSObject's elements. | 1097 // implementation of a JSObject's elements. |
(...skipping 8479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9568 } else { | 9577 } else { |
9569 value &= ~(1 << bit_position); | 9578 value &= ~(1 << bit_position); |
9570 } | 9579 } |
9571 return value; | 9580 return value; |
9572 } | 9581 } |
9573 }; | 9582 }; |
9574 | 9583 |
9575 } } // namespace v8::internal | 9584 } } // namespace v8::internal |
9576 | 9585 |
9577 #endif // V8_OBJECTS_H_ | 9586 #endif // V8_OBJECTS_H_ |
OLD | NEW |