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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 String::cast(this)->IsTwoByteRepresentation(); | 278 String::cast(this)->IsTwoByteRepresentation(); |
279 } | 279 } |
280 | 280 |
281 bool Object::HasValidElements() { | 281 bool Object::HasValidElements() { |
282 // Dictionary is covered under FixedArray. | 282 // Dictionary is covered under FixedArray. |
283 return IsFixedArray() || IsFixedDoubleArray() || IsExternalArray(); | 283 return IsFixedArray() || IsFixedDoubleArray() || IsExternalArray(); |
284 } | 284 } |
285 | 285 |
286 | 286 |
287 MaybeObject* Object::AllocateNewStorageFor(Heap* heap, | 287 MaybeObject* Object::AllocateNewStorageFor(Heap* heap, |
288 Representation representation) { | 288 Representation representation, |
| 289 PretenureFlag tenure) { |
289 if (!FLAG_track_double_fields) return this; | 290 if (!FLAG_track_double_fields) return this; |
290 if (!representation.IsDouble()) return this; | 291 if (!representation.IsDouble()) return this; |
291 if (IsUninitialized()) { | 292 if (IsUninitialized()) { |
292 return heap->AllocateHeapNumber(0); | 293 return heap->AllocateHeapNumber(0, tenure); |
293 } | 294 } |
294 return heap->AllocateHeapNumber(Number()); | 295 return heap->AllocateHeapNumber(Number(), tenure); |
295 } | 296 } |
296 | 297 |
297 | 298 |
298 StringShape::StringShape(String* str) | 299 StringShape::StringShape(String* str) |
299 : type_(str->map()->instance_type()) { | 300 : type_(str->map()->instance_type()) { |
300 set_valid(); | 301 set_valid(); |
301 ASSERT((type_ & kIsNotStringMask) == kStringTag); | 302 ASSERT((type_ & kIsNotStringMask) == kStringTag); |
302 } | 303 } |
303 | 304 |
304 | 305 |
(...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1534 MaybeObject* maybe = GetElementsTransitionMap(GetIsolate(), elements_kind); | 1535 MaybeObject* maybe = GetElementsTransitionMap(GetIsolate(), elements_kind); |
1535 Map* map; | 1536 Map* map; |
1536 if (!maybe->To(&map)) return maybe; | 1537 if (!maybe->To(&map)) return maybe; |
1537 set_map(map); | 1538 set_map(map); |
1538 initialize_elements(); | 1539 initialize_elements(); |
1539 | 1540 |
1540 return this; | 1541 return this; |
1541 } | 1542 } |
1542 | 1543 |
1543 | 1544 |
| 1545 MaybeObject* JSObject::TryMigrateInstance() { |
| 1546 Map* new_map = map()->CurrentMapForDeprecated(); |
| 1547 if (new_map == NULL) return Smi::FromInt(0); |
| 1548 Map* original_map = map(); |
| 1549 MaybeObject* maybe_result = MigrateToMap(new_map); |
| 1550 JSObject* result; |
| 1551 if (FLAG_trace_migration && maybe_result->To(&result)) { |
| 1552 PrintInstanceMigration(stdout, original_map, result->map()); |
| 1553 } |
| 1554 return maybe_result; |
| 1555 } |
| 1556 |
| 1557 |
1544 Handle<String> JSObject::ExpectedTransitionKey(Handle<Map> map) { | 1558 Handle<String> JSObject::ExpectedTransitionKey(Handle<Map> map) { |
1545 DisallowHeapAllocation no_gc; | 1559 DisallowHeapAllocation no_gc; |
1546 if (!map->HasTransitionArray()) return Handle<String>::null(); | 1560 if (!map->HasTransitionArray()) return Handle<String>::null(); |
1547 TransitionArray* transitions = map->transitions(); | 1561 TransitionArray* transitions = map->transitions(); |
1548 if (!transitions->IsSimpleTransition()) return Handle<String>::null(); | 1562 if (!transitions->IsSimpleTransition()) return Handle<String>::null(); |
1549 int transition = TransitionArray::kSimpleTransitionIndex; | 1563 int transition = TransitionArray::kSimpleTransitionIndex; |
1550 PropertyDetails details = transitions->GetTargetDetails(transition); | 1564 PropertyDetails details = transitions->GetTargetDetails(transition); |
1551 Name* name = transitions->GetKey(transition); | 1565 Name* name = transitions->GetKey(transition); |
1552 if (details.type() != FIELD) return Handle<String>::null(); | 1566 if (details.type() != FIELD) return Handle<String>::null(); |
1553 if (details.attributes() != NONE) return Handle<String>::null(); | 1567 if (details.attributes() != NONE) return Handle<String>::null(); |
(...skipping 4694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6248 #undef WRITE_UINT32_FIELD | 6262 #undef WRITE_UINT32_FIELD |
6249 #undef READ_SHORT_FIELD | 6263 #undef READ_SHORT_FIELD |
6250 #undef WRITE_SHORT_FIELD | 6264 #undef WRITE_SHORT_FIELD |
6251 #undef READ_BYTE_FIELD | 6265 #undef READ_BYTE_FIELD |
6252 #undef WRITE_BYTE_FIELD | 6266 #undef WRITE_BYTE_FIELD |
6253 | 6267 |
6254 | 6268 |
6255 } } // namespace v8::internal | 6269 } } // namespace v8::internal |
6256 | 6270 |
6257 #endif // V8_OBJECTS_INL_H_ | 6271 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |