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

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

Issue 12843031: Merged r14063, r14064 into trunk branch. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 7 years, 9 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/ic.cc ('k') | src/version.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 // 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 1472 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 set_properties(new_properties); 1483 set_properties(new_properties);
1484 } 1484 }
1485 set_map(map); 1485 set_map(map);
1486 return this; 1486 return this;
1487 } 1487 }
1488 1488
1489 1489
1490 bool JSObject::TryTransitionToField(Handle<JSObject> object, 1490 bool JSObject::TryTransitionToField(Handle<JSObject> object,
1491 Handle<Name> key) { 1491 Handle<Name> key) {
1492 if (!object->map()->HasTransitionArray()) return false; 1492 if (!object->map()->HasTransitionArray()) return false;
1493 Handle<TransitionArray> transitions(object->map()->transitions()); 1493 TransitionArray* transitions = object->map()->transitions();
1494 int transition = transitions->Search(*key); 1494 int transition = transitions->Search(*key);
1495 if (transition == TransitionArray::kNotFound) return false; 1495 if (transition == TransitionArray::kNotFound) return false;
1496 PropertyDetails target_details = transitions->GetTargetDetails(transition); 1496 PropertyDetails target_details = transitions->GetTargetDetails(transition);
1497 if (target_details.type() != FIELD) return false; 1497 if (target_details.type() != FIELD) return false;
1498 if (target_details.attributes() != NONE) return false; 1498 if (target_details.attributes() != NONE) return false;
1499 Handle<Map> target(transitions->GetTarget(transition)); 1499 Handle<Map> target(transitions->GetTarget(transition));
1500 JSObject::AddFastPropertyUsingMap(object, target); 1500 JSObject::AddFastPropertyUsingMap(object, target);
1501 return true; 1501 return true;
1502 } 1502 }
1503 1503
(...skipping 2614 matching lines...) Expand 10 before | Expand all | Expand 10 after
4118 4118
4119 TransitionArray* Map::transitions() { 4119 TransitionArray* Map::transitions() {
4120 ASSERT(HasTransitionArray()); 4120 ASSERT(HasTransitionArray());
4121 Object* object = READ_FIELD(this, kTransitionsOrBackPointerOffset); 4121 Object* object = READ_FIELD(this, kTransitionsOrBackPointerOffset);
4122 return TransitionArray::cast(object); 4122 return TransitionArray::cast(object);
4123 } 4123 }
4124 4124
4125 4125
4126 void Map::set_transitions(TransitionArray* transition_array, 4126 void Map::set_transitions(TransitionArray* transition_array,
4127 WriteBarrierMode mode) { 4127 WriteBarrierMode mode) {
4128 // In release mode, only run this code if verify_heap is on. 4128 // Transition arrays are not shared. When one is replaced, it should not
4129 if (Heap::ShouldZapGarbage() && HasTransitionArray()) { 4129 // keep referenced objects alive, so we zap it.
4130 CHECK(transitions() != transition_array); 4130 // When there is another reference to the array somewhere (e.g. a handle),
4131 // not zapping turns from a waste of memory into a source of crashes.
4132 if (HasTransitionArray()) {
4133 ASSERT(transitions() != transition_array);
4131 ZapTransitions(); 4134 ZapTransitions();
4132 } 4135 }
4133 4136
4134 WRITE_FIELD(this, kTransitionsOrBackPointerOffset, transition_array); 4137 WRITE_FIELD(this, kTransitionsOrBackPointerOffset, transition_array);
4135 CONDITIONAL_WRITE_BARRIER( 4138 CONDITIONAL_WRITE_BARRIER(
4136 GetHeap(), this, kTransitionsOrBackPointerOffset, transition_array, mode); 4139 GetHeap(), this, kTransitionsOrBackPointerOffset, transition_array, mode);
4137 } 4140 }
4138 4141
4139 4142
4140 void Map::init_back_pointer(Object* undefined) { 4143 void Map::init_back_pointer(Object* undefined) {
(...skipping 1871 matching lines...) Expand 10 before | Expand all | Expand 10 after
6012 #undef WRITE_UINT32_FIELD 6015 #undef WRITE_UINT32_FIELD
6013 #undef READ_SHORT_FIELD 6016 #undef READ_SHORT_FIELD
6014 #undef WRITE_SHORT_FIELD 6017 #undef WRITE_SHORT_FIELD
6015 #undef READ_BYTE_FIELD 6018 #undef READ_BYTE_FIELD
6016 #undef WRITE_BYTE_FIELD 6019 #undef WRITE_BYTE_FIELD
6017 6020
6018 6021
6019 } } // namespace v8::internal 6022 } } // namespace v8::internal
6020 6023
6021 #endif // V8_OBJECTS_INL_H_ 6024 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/ic.cc ('k') | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698