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

Side by Side Diff: src/objects-inl.h

Issue 360023003: Revert "Replace HeapNumber as doublebox with an explicit MutableHeapNumber." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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/objects-debug.cc ('k') | src/objects-printer.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 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 return HAS_SMI_TAG(this); 158 return HAS_SMI_TAG(this);
159 } 159 }
160 160
161 161
162 bool Object::IsHeapObject() const { 162 bool Object::IsHeapObject() const {
163 return Internals::HasHeapObjectTag(this); 163 return Internals::HasHeapObjectTag(this);
164 } 164 }
165 165
166 166
167 TYPE_CHECKER(HeapNumber, HEAP_NUMBER_TYPE) 167 TYPE_CHECKER(HeapNumber, HEAP_NUMBER_TYPE)
168 TYPE_CHECKER(MutableHeapNumber, MUTABLE_HEAP_NUMBER_TYPE)
169 TYPE_CHECKER(Symbol, SYMBOL_TYPE) 168 TYPE_CHECKER(Symbol, SYMBOL_TYPE)
170 169
171 170
172 bool Object::IsString() const { 171 bool Object::IsString() const {
173 return Object::IsHeapObject() 172 return Object::IsHeapObject()
174 && HeapObject::cast(this)->map()->instance_type() < FIRST_NONSTRING_TYPE; 173 && HeapObject::cast(this)->map()->instance_type() < FIRST_NONSTRING_TYPE;
175 } 174 }
176 175
177 176
178 bool Object::IsName() const { 177 bool Object::IsName() const {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 } 270 }
272 271
273 272
274 Handle<Object> Object::NewStorageFor(Isolate* isolate, 273 Handle<Object> Object::NewStorageFor(Isolate* isolate,
275 Handle<Object> object, 274 Handle<Object> object,
276 Representation representation) { 275 Representation representation) {
277 if (representation.IsSmi() && object->IsUninitialized()) { 276 if (representation.IsSmi() && object->IsUninitialized()) {
278 return handle(Smi::FromInt(0), isolate); 277 return handle(Smi::FromInt(0), isolate);
279 } 278 }
280 if (!representation.IsDouble()) return object; 279 if (!representation.IsDouble()) return object;
281 double value;
282 if (object->IsUninitialized()) { 280 if (object->IsUninitialized()) {
283 value = 0; 281 return isolate->factory()->NewHeapNumber(0);
284 } else if (object->IsMutableHeapNumber()) {
285 value = HeapNumber::cast(*object)->value();
286 } else {
287 value = object->Number();
288 } 282 }
289 return isolate->factory()->NewHeapNumber(value, MUTABLE); 283 return isolate->factory()->NewHeapNumber(object->Number());
290 } 284 }
291 285
292 286
293 Handle<Object> Object::WrapForRead(Isolate* isolate,
294 Handle<Object> object,
295 Representation representation) {
296 ASSERT(!object->IsUninitialized());
297 if (!representation.IsDouble()) {
298 ASSERT(object->FitsRepresentation(representation));
299 return object;
300 }
301 return isolate->factory()->NewHeapNumber(HeapNumber::cast(*object)->value());
302 }
303
304
305 StringShape::StringShape(const String* str) 287 StringShape::StringShape(const String* str)
306 : type_(str->map()->instance_type()) { 288 : type_(str->map()->instance_type()) {
307 set_valid(); 289 set_valid();
308 ASSERT((type_ & kIsNotStringMask) == kStringTag); 290 ASSERT((type_ & kIsNotStringMask) == kStringTag);
309 } 291 }
310 292
311 293
312 StringShape::StringShape(Map* map) 294 StringShape::StringShape(Map* map)
313 : type_(map->instance_type()) { 295 : type_(map->instance_type()) {
314 set_valid(); 296 set_valid();
(...skipping 2775 matching lines...) Expand 10 before | Expand all | Expand 10 after
3090 CAST_ACCESSOR(ExternalUint32Array) 3072 CAST_ACCESSOR(ExternalUint32Array)
3091 CAST_ACCESSOR(ExternalUint8Array) 3073 CAST_ACCESSOR(ExternalUint8Array)
3092 CAST_ACCESSOR(ExternalUint8ClampedArray) 3074 CAST_ACCESSOR(ExternalUint8ClampedArray)
3093 CAST_ACCESSOR(FixedArray) 3075 CAST_ACCESSOR(FixedArray)
3094 CAST_ACCESSOR(FixedArrayBase) 3076 CAST_ACCESSOR(FixedArrayBase)
3095 CAST_ACCESSOR(FixedDoubleArray) 3077 CAST_ACCESSOR(FixedDoubleArray)
3096 CAST_ACCESSOR(FixedTypedArrayBase) 3078 CAST_ACCESSOR(FixedTypedArrayBase)
3097 CAST_ACCESSOR(Foreign) 3079 CAST_ACCESSOR(Foreign)
3098 CAST_ACCESSOR(FreeSpace) 3080 CAST_ACCESSOR(FreeSpace)
3099 CAST_ACCESSOR(GlobalObject) 3081 CAST_ACCESSOR(GlobalObject)
3082 CAST_ACCESSOR(HeapNumber)
3100 CAST_ACCESSOR(HeapObject) 3083 CAST_ACCESSOR(HeapObject)
3101 CAST_ACCESSOR(JSArray) 3084 CAST_ACCESSOR(JSArray)
3102 CAST_ACCESSOR(JSArrayBuffer) 3085 CAST_ACCESSOR(JSArrayBuffer)
3103 CAST_ACCESSOR(JSArrayBufferView) 3086 CAST_ACCESSOR(JSArrayBufferView)
3104 CAST_ACCESSOR(JSBuiltinsObject) 3087 CAST_ACCESSOR(JSBuiltinsObject)
3105 CAST_ACCESSOR(JSDataView) 3088 CAST_ACCESSOR(JSDataView)
3106 CAST_ACCESSOR(JSDate) 3089 CAST_ACCESSOR(JSDate)
3107 CAST_ACCESSOR(JSFunction) 3090 CAST_ACCESSOR(JSFunction)
3108 CAST_ACCESSOR(JSFunctionProxy) 3091 CAST_ACCESSOR(JSFunctionProxy)
3109 CAST_ACCESSOR(JSFunctionResultCache) 3092 CAST_ACCESSOR(JSFunctionResultCache)
(...skipping 2844 matching lines...) Expand 10 before | Expand all | Expand 10 after
5954 return continuation() == kGeneratorExecuting; 5937 return continuation() == kGeneratorExecuting;
5955 } 5938 }
5956 5939
5957 ACCESSORS(JSModule, context, Object, kContextOffset) 5940 ACCESSORS(JSModule, context, Object, kContextOffset)
5958 ACCESSORS(JSModule, scope_info, ScopeInfo, kScopeInfoOffset) 5941 ACCESSORS(JSModule, scope_info, ScopeInfo, kScopeInfoOffset)
5959 5942
5960 5943
5961 ACCESSORS(JSValue, value, Object, kValueOffset) 5944 ACCESSORS(JSValue, value, Object, kValueOffset)
5962 5945
5963 5946
5964 HeapNumber* HeapNumber::cast(Object* object) {
5965 SLOW_ASSERT(object->IsHeapNumber() || object->IsMutableHeapNumber());
5966 return reinterpret_cast<HeapNumber*>(object);
5967 }
5968
5969
5970 const HeapNumber* HeapNumber::cast(const Object* object) {
5971 SLOW_ASSERT(object->IsHeapNumber() || object->IsMutableHeapNumber());
5972 return reinterpret_cast<const HeapNumber*>(object);
5973 }
5974
5975
5976 ACCESSORS(JSDate, value, Object, kValueOffset) 5947 ACCESSORS(JSDate, value, Object, kValueOffset)
5977 ACCESSORS(JSDate, cache_stamp, Object, kCacheStampOffset) 5948 ACCESSORS(JSDate, cache_stamp, Object, kCacheStampOffset)
5978 ACCESSORS(JSDate, year, Object, kYearOffset) 5949 ACCESSORS(JSDate, year, Object, kYearOffset)
5979 ACCESSORS(JSDate, month, Object, kMonthOffset) 5950 ACCESSORS(JSDate, month, Object, kMonthOffset)
5980 ACCESSORS(JSDate, day, Object, kDayOffset) 5951 ACCESSORS(JSDate, day, Object, kDayOffset)
5981 ACCESSORS(JSDate, weekday, Object, kWeekdayOffset) 5952 ACCESSORS(JSDate, weekday, Object, kWeekdayOffset)
5982 ACCESSORS(JSDate, hour, Object, kHourOffset) 5953 ACCESSORS(JSDate, hour, Object, kHourOffset)
5983 ACCESSORS(JSDate, min, Object, kMinOffset) 5954 ACCESSORS(JSDate, min, Object, kMinOffset)
5984 ACCESSORS(JSDate, sec, Object, kSecOffset) 5955 ACCESSORS(JSDate, sec, Object, kSecOffset)
5985 5956
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after
7051 #undef READ_SHORT_FIELD 7022 #undef READ_SHORT_FIELD
7052 #undef WRITE_SHORT_FIELD 7023 #undef WRITE_SHORT_FIELD
7053 #undef READ_BYTE_FIELD 7024 #undef READ_BYTE_FIELD
7054 #undef WRITE_BYTE_FIELD 7025 #undef WRITE_BYTE_FIELD
7055 #undef NOBARRIER_READ_BYTE_FIELD 7026 #undef NOBARRIER_READ_BYTE_FIELD
7056 #undef NOBARRIER_WRITE_BYTE_FIELD 7027 #undef NOBARRIER_WRITE_BYTE_FIELD
7057 7028
7058 } } // namespace v8::internal 7029 } } // namespace v8::internal
7059 7030
7060 #endif // V8_OBJECTS_INL_H_ 7031 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects-debug.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698