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

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

Issue 23583052: Handlify JSObject::MigrateInstance and friends. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comment from other CL. Created 7 years, 3 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.cc ('k') | no next file » | 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) {
290 if (!FLAG_track_double_fields) return this; 289 if (!FLAG_track_double_fields) return this;
291 if (!representation.IsDouble()) return this; 290 if (!representation.IsDouble()) return this;
292 if (IsUninitialized()) { 291 if (IsUninitialized()) {
293 return heap->AllocateHeapNumber(0, tenure); 292 return heap->AllocateHeapNumber(0);
294 } 293 }
295 return heap->AllocateHeapNumber(Number(), tenure); 294 return heap->AllocateHeapNumber(Number());
296 } 295 }
297 296
298 297
299 StringShape::StringShape(String* str) 298 StringShape::StringShape(String* str)
300 : type_(str->map()->instance_type()) { 299 : type_(str->map()->instance_type()) {
301 set_valid(); 300 set_valid();
302 ASSERT((type_ & kIsNotStringMask) == kStringTag); 301 ASSERT((type_ & kIsNotStringMask) == kStringTag);
303 } 302 }
304 303
305 304
(...skipping 1229 matching lines...) Expand 10 before | Expand all | Expand 10 after
1535 MaybeObject* maybe = GetElementsTransitionMap(GetIsolate(), elements_kind); 1534 MaybeObject* maybe = GetElementsTransitionMap(GetIsolate(), elements_kind);
1536 Map* map; 1535 Map* map;
1537 if (!maybe->To(&map)) return maybe; 1536 if (!maybe->To(&map)) return maybe;
1538 set_map(map); 1537 set_map(map);
1539 initialize_elements(); 1538 initialize_elements();
1540 1539
1541 return this; 1540 return this;
1542 } 1541 }
1543 1542
1544 1543
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
1558 Handle<String> JSObject::ExpectedTransitionKey(Handle<Map> map) { 1544 Handle<String> JSObject::ExpectedTransitionKey(Handle<Map> map) {
1559 DisallowHeapAllocation no_gc; 1545 DisallowHeapAllocation no_gc;
1560 if (!map->HasTransitionArray()) return Handle<String>::null(); 1546 if (!map->HasTransitionArray()) return Handle<String>::null();
1561 TransitionArray* transitions = map->transitions(); 1547 TransitionArray* transitions = map->transitions();
1562 if (!transitions->IsSimpleTransition()) return Handle<String>::null(); 1548 if (!transitions->IsSimpleTransition()) return Handle<String>::null();
1563 int transition = TransitionArray::kSimpleTransitionIndex; 1549 int transition = TransitionArray::kSimpleTransitionIndex;
1564 PropertyDetails details = transitions->GetTargetDetails(transition); 1550 PropertyDetails details = transitions->GetTargetDetails(transition);
1565 Name* name = transitions->GetKey(transition); 1551 Name* name = transitions->GetKey(transition);
1566 if (details.type() != FIELD) return Handle<String>::null(); 1552 if (details.type() != FIELD) return Handle<String>::null();
1567 if (details.attributes() != NONE) return Handle<String>::null(); 1553 if (details.attributes() != NONE) return Handle<String>::null();
(...skipping 4694 matching lines...) Expand 10 before | Expand all | Expand 10 after
6262 #undef WRITE_UINT32_FIELD 6248 #undef WRITE_UINT32_FIELD
6263 #undef READ_SHORT_FIELD 6249 #undef READ_SHORT_FIELD
6264 #undef WRITE_SHORT_FIELD 6250 #undef WRITE_SHORT_FIELD
6265 #undef READ_BYTE_FIELD 6251 #undef READ_BYTE_FIELD
6266 #undef WRITE_BYTE_FIELD 6252 #undef WRITE_BYTE_FIELD
6267 6253
6268 6254
6269 } } // namespace v8::internal 6255 } } // namespace v8::internal
6270 6256
6271 #endif // V8_OBJECTS_INL_H_ 6257 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698