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

Side by Side Diff: src/builtins.cc

Issue 2144006: Cardmarking writebarrier. (Closed)
Patch Set: change NewSpace and SemiSpace Contains to match HasHeapObjectTag Created 10 years, 7 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
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 static void FillWithHoles(FixedArray* dst, int from, int to) { 298 static void FillWithHoles(FixedArray* dst, int from, int to) {
299 MemsetPointer(dst->data_start() + from, Heap::the_hole_value(), to - from); 299 MemsetPointer(dst->data_start() + from, Heap::the_hole_value(), to - from);
300 } 300 }
301 301
302 302
303 static FixedArray* LeftTrimFixedArray(FixedArray* elms, int to_trim) { 303 static FixedArray* LeftTrimFixedArray(FixedArray* elms, int to_trim) {
304 // For now this trick is only applied to fixed arrays in new space. 304 // For now this trick is only applied to fixed arrays in new space.
305 // In large object space the object's start must coincide with chunk 305 // In large object space the object's start must coincide with chunk
306 // and thus the trick is just not applicable. 306 // and thus the trick is just not applicable.
307 // In old space we do not use this trick to avoid dealing with 307 // In old space we do not use this trick to avoid dealing with
308 // remembered sets. 308 // region dirty marks.
309 ASSERT(Heap::new_space()->Contains(elms)); 309 ASSERT(Heap::new_space()->Contains(elms));
310 310
311 STATIC_ASSERT(FixedArray::kMapOffset == 0); 311 STATIC_ASSERT(FixedArray::kMapOffset == 0);
312 STATIC_ASSERT(FixedArray::kLengthOffset == kPointerSize); 312 STATIC_ASSERT(FixedArray::kLengthOffset == kPointerSize);
313 STATIC_ASSERT(FixedArray::kHeaderSize == 2 * kPointerSize); 313 STATIC_ASSERT(FixedArray::kHeaderSize == 2 * kPointerSize);
314 314
315 Object** former_start = HeapObject::RawField(elms, 0); 315 Object** former_start = HeapObject::RawField(elms, 0);
316 316
317 const int len = elms->length(); 317 const int len = elms->length();
318 318
319 // Technically in new space this write might be omitted (except for 319 // Technically in new space this write might be omitted (except for
320 // debug mode which iterates through the heap), but to play safer 320 // debug mode which iterates through the heap), but to play safer
321 // we still do it. 321 // we still do it.
322 Heap::CreateFillerObjectAt(elms->address(), to_trim * kPointerSize); 322 Heap::CreateFillerObjectAt(elms->address(), to_trim * kPointerSize);
323 323
324 former_start[to_trim] = Heap::fixed_array_map(); 324 former_start[to_trim] = Heap::fixed_array_map();
325 former_start[to_trim + 1] = reinterpret_cast<Object*>(len - to_trim); 325 former_start[to_trim + 1] = Smi::FromInt(len - to_trim);
326 326
327 ASSERT_EQ(elms->address() + to_trim * kPointerSize, 327 ASSERT_EQ(elms->address() + to_trim * kPointerSize,
328 (elms + to_trim * kPointerSize)->address()); 328 (elms + to_trim * kPointerSize)->address());
329 return elms + to_trim * kPointerSize; 329 return elms + to_trim * kPointerSize;
330 } 330 }
331 331
332 332
333 static bool ArrayPrototypeHasNoElements(Context* global_context, 333 static bool ArrayPrototypeHasNoElements(Context* global_context,
334 JSObject* array_proto) { 334 JSObject* array_proto) {
335 // This method depends on non writability of Object and Array prototype 335 // This method depends on non writability of Object and Array prototype
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 if (len == 0) return Heap::undefined_value(); 493 if (len == 0) return Heap::undefined_value();
494 494
495 // Get first element 495 // Get first element
496 Object* first = elms->get(0); 496 Object* first = elms->get(0);
497 if (first->IsTheHole()) { 497 if (first->IsTheHole()) {
498 first = Heap::undefined_value(); 498 first = Heap::undefined_value();
499 } 499 }
500 500
501 if (Heap::new_space()->Contains(elms)) { 501 if (Heap::new_space()->Contains(elms)) {
502 // As elms still in the same space they used to be (new space), 502 // As elms still in the same space they used to be (new space),
503 // there is no need to update remembered set. 503 // there is no need to update region dirty mark.
504 array->set_elements(LeftTrimFixedArray(elms, 1), SKIP_WRITE_BARRIER); 504 array->set_elements(LeftTrimFixedArray(elms, 1), SKIP_WRITE_BARRIER);
505 } else { 505 } else {
506 // Shift the elements. 506 // Shift the elements.
507 AssertNoAllocation no_gc; 507 AssertNoAllocation no_gc;
508 MoveElements(&no_gc, elms, 0, elms, 1, len - 1); 508 MoveElements(&no_gc, elms, 0, elms, 1, len - 1);
509 elms->set(len - 1, Heap::the_hole_value()); 509 elms->set(len - 1, Heap::the_hole_value());
510 } 510 }
511 511
512 // Set the length. 512 // Set the length.
513 array->set_length(Smi::FromInt(len - 1)); 513 array->set_length(Smi::FromInt(len - 1));
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 if (entry->contains(pc)) { 1507 if (entry->contains(pc)) {
1508 return names_[i]; 1508 return names_[i];
1509 } 1509 }
1510 } 1510 }
1511 } 1511 }
1512 return NULL; 1512 return NULL;
1513 } 1513 }
1514 1514
1515 1515
1516 } } // namespace v8::internal 1516 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.cc ('k') | src/flag-definitions.h » ('j') | src/spaces.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698