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 1517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1528 MaybeObject* maybe = GetElementsTransitionMap(GetIsolate(), elements_kind); | 1528 MaybeObject* maybe = GetElementsTransitionMap(GetIsolate(), elements_kind); |
1529 Map* map; | 1529 Map* map; |
1530 if (!maybe->To(&map)) return maybe; | 1530 if (!maybe->To(&map)) return maybe; |
1531 set_map(map); | 1531 set_map(map); |
1532 initialize_elements(); | 1532 initialize_elements(); |
1533 | 1533 |
1534 return this; | 1534 return this; |
1535 } | 1535 } |
1536 | 1536 |
1537 | 1537 |
1538 MaybeObject* JSObject::TryMigrateInstance() { | |
1539 Map* new_map = map()->CurrentMapForDeprecated(); | |
1540 if (new_map == NULL) return Smi::FromInt(0); | |
1541 Map* original_map = map(); | |
1542 MaybeObject* maybe_result = MigrateToMap(new_map); | |
1543 JSObject* result; | |
1544 if (FLAG_trace_migration && maybe_result->To(&result)) { | |
1545 PrintInstanceMigration(stdout, original_map, result->map()); | |
1546 } | |
1547 return maybe_result; | |
1548 } | |
1549 | |
1550 | |
1551 Handle<String> JSObject::ExpectedTransitionKey(Handle<Map> map) { | 1538 Handle<String> JSObject::ExpectedTransitionKey(Handle<Map> map) { |
1552 DisallowHeapAllocation no_gc; | 1539 DisallowHeapAllocation no_gc; |
1553 if (!map->HasTransitionArray()) return Handle<String>::null(); | 1540 if (!map->HasTransitionArray()) return Handle<String>::null(); |
1554 TransitionArray* transitions = map->transitions(); | 1541 TransitionArray* transitions = map->transitions(); |
1555 if (!transitions->IsSimpleTransition()) return Handle<String>::null(); | 1542 if (!transitions->IsSimpleTransition()) return Handle<String>::null(); |
1556 int transition = TransitionArray::kSimpleTransitionIndex; | 1543 int transition = TransitionArray::kSimpleTransitionIndex; |
1557 PropertyDetails details = transitions->GetTargetDetails(transition); | 1544 PropertyDetails details = transitions->GetTargetDetails(transition); |
1558 Name* name = transitions->GetKey(transition); | 1545 Name* name = transitions->GetKey(transition); |
1559 if (details.type() != FIELD) return Handle<String>::null(); | 1546 if (details.type() != FIELD) return Handle<String>::null(); |
1560 if (details.attributes() != NONE) return Handle<String>::null(); | 1547 if (details.attributes() != NONE) return Handle<String>::null(); |
(...skipping 4692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6253 #undef WRITE_UINT32_FIELD | 6240 #undef WRITE_UINT32_FIELD |
6254 #undef READ_SHORT_FIELD | 6241 #undef READ_SHORT_FIELD |
6255 #undef WRITE_SHORT_FIELD | 6242 #undef WRITE_SHORT_FIELD |
6256 #undef READ_BYTE_FIELD | 6243 #undef READ_BYTE_FIELD |
6257 #undef WRITE_BYTE_FIELD | 6244 #undef WRITE_BYTE_FIELD |
6258 | 6245 |
6259 | 6246 |
6260 } } // namespace v8::internal | 6247 } } // namespace v8::internal |
6261 | 6248 |
6262 #endif // V8_OBJECTS_INL_H_ | 6249 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |