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

Side by Side Diff: src/builtins.cc

Issue 1770001: Use Heap::CreateFillerArrayAt to create a filler instead of copied code. (Closed)
Patch Set: Created 10 years, 8 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
« no previous file with comments | « no previous file | src/heap.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 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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 STATIC_ASSERT(FixedArray::kLengthOffset == kPointerSize); 341 STATIC_ASSERT(FixedArray::kLengthOffset == kPointerSize);
342 STATIC_ASSERT(FixedArray::kHeaderSize == 2 * kPointerSize); 342 STATIC_ASSERT(FixedArray::kHeaderSize == 2 * kPointerSize);
343 343
344 Object** former_start = HeapObject::RawField(elms, 0); 344 Object** former_start = HeapObject::RawField(elms, 0);
345 345
346 const int len = elms->length(); 346 const int len = elms->length();
347 347
348 // Technically in new space this write might be omitted (except for 348 // Technically in new space this write might be omitted (except for
349 // debug mode which iterates through the heap), but to play safer 349 // debug mode which iterates through the heap), but to play safer
350 // we still do it. 350 // we still do it.
351 if (to_trim == 1) { 351 Heap::CreateFillerObjectAt(elms->address(), to_trim * kPointerSize);
352 former_start[0] = Heap::raw_unchecked_one_pointer_filler_map();
353 } else if (to_trim == 2) {
354 former_start[0] = Heap::raw_unchecked_two_pointer_filler_map();
355 } else {
356 former_start[0] = Heap::raw_unchecked_byte_array_map();
357 ByteArray* as_byte_array = reinterpret_cast<ByteArray*>(elms);
358 as_byte_array->set_length(ByteArray::LengthFor(to_trim * kPointerSize));
359 }
360 352
361 former_start[to_trim] = Heap::fixed_array_map(); 353 former_start[to_trim] = Heap::fixed_array_map();
362 former_start[to_trim + 1] = reinterpret_cast<Object*>(len - to_trim); 354 former_start[to_trim + 1] = reinterpret_cast<Object*>(len - to_trim);
363 355
364 ASSERT_EQ(elms->address() + to_trim * kPointerSize, 356 ASSERT_EQ(elms->address() + to_trim * kPointerSize,
365 (elms + to_trim * kPointerSize)->address()); 357 (elms + to_trim * kPointerSize)->address());
366 return elms + to_trim * kPointerSize; 358 return elms + to_trim * kPointerSize;
367 } 359 }
368 360
369 361
(...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1540 if (entry->contains(pc)) { 1532 if (entry->contains(pc)) {
1541 return names_[i]; 1533 return names_[i];
1542 } 1534 }
1543 } 1535 }
1544 } 1536 }
1545 return NULL; 1537 return NULL;
1546 } 1538 }
1547 1539
1548 1540
1549 } } // namespace v8::internal 1541 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698