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

Side by Side Diff: src/heap.cc

Issue 17308: Allocate as many object-literal properties as possible inobject.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 11 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/handles.cc ('k') | src/objects.h » ('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 2275 matching lines...) Expand 10 before | Expand all | Expand 10 after
2286 FixedArray* result = FixedArray::cast(obj); 2286 FixedArray* result = FixedArray::cast(obj);
2287 result->set_length(len); 2287 result->set_length(len);
2288 // Copy the content 2288 // Copy the content
2289 WriteBarrierMode mode = result->GetWriteBarrierMode(); 2289 WriteBarrierMode mode = result->GetWriteBarrierMode();
2290 for (int i = 0; i < len; i++) result->set(i, src->get(i), mode); 2290 for (int i = 0; i < len; i++) result->set(i, src->get(i), mode);
2291 return result; 2291 return result;
2292 } 2292 }
2293 2293
2294 2294
2295 Object* Heap::AllocateFixedArray(int length) { 2295 Object* Heap::AllocateFixedArray(int length) {
2296 if (length == 0) return empty_fixed_array();
2296 Object* result = AllocateRawFixedArray(length); 2297 Object* result = AllocateRawFixedArray(length);
2297 if (!result->IsFailure()) { 2298 if (!result->IsFailure()) {
2298 // Initialize header. 2299 // Initialize header.
2299 reinterpret_cast<Array*>(result)->set_map(fixed_array_map()); 2300 reinterpret_cast<Array*>(result)->set_map(fixed_array_map());
2300 FixedArray* array = FixedArray::cast(result); 2301 FixedArray* array = FixedArray::cast(result);
2301 array->set_length(length); 2302 array->set_length(length);
2302 Object* value = undefined_value(); 2303 Object* value = undefined_value();
2303 // Initialize body. 2304 // Initialize body.
2304 for (int index = 0; index < length; index++) { 2305 for (int index = 0; index < length; index++) {
2305 array->set(index, value, SKIP_WRITE_BARRIER); 2306 array->set(index, value, SKIP_WRITE_BARRIER);
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after
3356 #ifdef DEBUG 3357 #ifdef DEBUG
3357 bool Heap::GarbageCollectionGreedyCheck() { 3358 bool Heap::GarbageCollectionGreedyCheck() {
3358 ASSERT(FLAG_gc_greedy); 3359 ASSERT(FLAG_gc_greedy);
3359 if (Bootstrapper::IsActive()) return true; 3360 if (Bootstrapper::IsActive()) return true;
3360 if (disallow_allocation_failure()) return true; 3361 if (disallow_allocation_failure()) return true;
3361 return CollectGarbage(0, NEW_SPACE); 3362 return CollectGarbage(0, NEW_SPACE);
3362 } 3363 }
3363 #endif 3364 #endif
3364 3365
3365 } } // namespace v8::internal 3366 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/handles.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698