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

Side by Side Diff: src/objects.cc

Issue 11085070: Enable --verify-heap in release mode (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: After rebase plus one new issue fix Created 8 years, 2 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
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 2151 matching lines...) Expand 10 before | Expand all | Expand 10 after
2162 Object** zap = reinterpret_cast<Object**>(new_end); 2162 Object** zap = reinterpret_cast<Object**>(new_end);
2163 zap++; // Header of filler must be at least one word so skip that. 2163 zap++; // Header of filler must be at least one word so skip that.
2164 for (int i = 1; i < to_trim; i++) { 2164 for (int i = 1; i < to_trim; i++) {
2165 *zap++ = Smi::FromInt(0); 2165 *zap++ = Smi::FromInt(0);
2166 } 2166 }
2167 } 2167 }
2168 2168
2169 2169
2170 template<RightTrimMode trim_mode> 2170 template<RightTrimMode trim_mode>
2171 static void RightTrimFixedArray(Heap* heap, FixedArray* elms, int to_trim) { 2171 static void RightTrimFixedArray(Heap* heap, FixedArray* elms, int to_trim) {
2172 #ifdef DEBUG
2173 bool zapInFromGCMode = true;
2174 #else
2175 bool zapInFromGCMode = FLAG_verify_heap;
2176 #endif
2177
2172 ASSERT(elms->map() != HEAP->fixed_cow_array_map()); 2178 ASSERT(elms->map() != HEAP->fixed_cow_array_map());
2173 // For now this trick is only applied to fixed arrays in new and paged space. 2179 // For now this trick is only applied to fixed arrays in new and paged space.
2174 ASSERT(!HEAP->lo_space()->Contains(elms)); 2180 ASSERT(!HEAP->lo_space()->Contains(elms));
2175 2181
2176 const int len = elms->length(); 2182 const int len = elms->length();
2177 2183
2178 ASSERT(to_trim < len); 2184 ASSERT(to_trim < len);
2179 2185
2180 Address new_end = elms->address() + FixedArray::SizeFor(len - to_trim); 2186 Address new_end = elms->address() + FixedArray::SizeFor(len - to_trim);
2181 2187
2182 if (trim_mode == FROM_GC) { 2188 if (trim_mode != FROM_GC || zapInFromGCMode) {
Michael Starzinger 2012/10/11 12:42:46 See comment about Heap::ShouldZapGarbage earlier.
mvstanton1 2012/10/12 08:40:50 Done.
2183 #ifdef DEBUG 2189 ZapEndOfFixedArray(new_end, to_trim);
2184 ZapEndOfFixedArray(new_end, to_trim);
2185 #endif
2186 } else {
2187 ZapEndOfFixedArray(new_end, to_trim);
2188 } 2190 }
2189 2191
2190 int size_delta = to_trim * kPointerSize; 2192 int size_delta = to_trim * kPointerSize;
2191 2193
2192 // Technically in new space this write might be omitted (except for 2194 // Technically in new space this write might be omitted (except for
2193 // debug mode which iterates through the heap), but to play safer 2195 // debug mode which iterates through the heap), but to play safer
2194 // we still do it. 2196 // we still do it.
2195 heap->CreateFillerObjectAt(new_end, size_delta); 2197 heap->CreateFillerObjectAt(new_end, size_delta);
2196 2198
2197 elms->set_length(len - to_trim); 2199 elms->set_length(len - to_trim);
(...skipping 6855 matching lines...) Expand 10 before | Expand all | Expand 10 after
9053 } 9055 }
9054 9056
9055 int last = transitions - 1; 9057 int last = transitions - 1;
9056 9058
9057 cache->set(header + last * step + kProtoTransitionPrototypeOffset, prototype); 9059 cache->set(header + last * step + kProtoTransitionPrototypeOffset, prototype);
9058 cache->set(header + last * step + kProtoTransitionMapOffset, map); 9060 cache->set(header + last * step + kProtoTransitionMapOffset, map);
9059 SetNumberOfProtoTransitions(transitions); 9061 SetNumberOfProtoTransitions(transitions);
9060 9062
9061 return cache; 9063 return cache;
9062 } 9064 }
9063 9065
Michael Starzinger 2012/10/11 12:42:46 Additional empty newline here.
mvstanton1 2012/10/12 08:40:50 Done.
9066 void Map::ZapTransitions() {
9067 TransitionArray* transition_array = transitions();
9068 MemsetPointer(transition_array->data_start(),
9069 GetHeap()->the_hole_value(),
9070 transition_array->length());
9071 }
9072
9073
9074 void Map::ZapPrototypeTransitions() {
9075 FixedArray* proto_transitions = GetPrototypeTransitions();
9076 MemsetPointer(proto_transitions->data_start(),
9077 GetHeap()->the_hole_value(),
9078 proto_transitions->length());
9079 }
9080
9064 9081
9065 MaybeObject* JSReceiver::SetPrototype(Object* value, 9082 MaybeObject* JSReceiver::SetPrototype(Object* value,
9066 bool skip_hidden_prototypes) { 9083 bool skip_hidden_prototypes) {
9067 #ifdef DEBUG 9084 #ifdef DEBUG
9068 int size = Size(); 9085 int size = Size();
9069 #endif 9086 #endif
9070 9087
9071 Heap* heap = GetHeap(); 9088 Heap* heap = GetHeap();
9072 // Silently ignore the change if value is not a JSObject or null. 9089 // Silently ignore the change if value is not a JSObject or null.
9073 // SpiderMonkey behaves this way. 9090 // SpiderMonkey behaves this way.
(...skipping 4451 matching lines...) Expand 10 before | Expand all | Expand 10 after
13525 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 13542 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
13526 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 13543 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
13527 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 13544 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
13528 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 13545 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
13529 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 13546 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
13530 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 13547 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
13531 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 13548 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
13532 } 13549 }
13533 13550
13534 } } // namespace v8::internal 13551 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698