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

Side by Side Diff: bleeding_edge/src/heap.cc

Issue 503042: Optimize the allocation of small, non-nested literal... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years 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 | « bleeding_edge/src/heap.h ('k') | bleeding_edge/src/ia32/codegen-ia32.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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 2243 matching lines...) Expand 10 before | Expand all | Expand 10 after
2254 // To get fast allocation and map sharing for arguments objects we 2254 // To get fast allocation and map sharing for arguments objects we
2255 // allocate them based on an arguments boilerplate. 2255 // allocate them based on an arguments boilerplate.
2256 2256
2257 // This calls Copy directly rather than using Heap::AllocateRaw so we 2257 // This calls Copy directly rather than using Heap::AllocateRaw so we
2258 // duplicate the check here. 2258 // duplicate the check here.
2259 ASSERT(allocation_allowed_ && gc_state_ == NOT_IN_GC); 2259 ASSERT(allocation_allowed_ && gc_state_ == NOT_IN_GC);
2260 2260
2261 JSObject* boilerplate = 2261 JSObject* boilerplate =
2262 Top::context()->global_context()->arguments_boilerplate(); 2262 Top::context()->global_context()->arguments_boilerplate();
2263 2263
2264 // Make the clone. 2264 // Check that the size of the boilerplate matches our
2265 Map* map = boilerplate->map(); 2265 // expectations. The ArgumentsAccessStub::GenerateNewObject relies
2266 int object_size = map->instance_size(); 2266 // on the size being a known constant.
2267 Object* result = AllocateRaw(object_size, NEW_SPACE, OLD_POINTER_SPACE); 2267 ASSERT(kArgumentsObjectSize == boilerplate->map()->instance_size());
2268
2269 // Do the allocation.
2270 Object* result =
2271 AllocateRaw(kArgumentsObjectSize, NEW_SPACE, OLD_POINTER_SPACE);
2268 if (result->IsFailure()) return result; 2272 if (result->IsFailure()) return result;
2269 2273
2270 // Copy the content. The arguments boilerplate doesn't have any 2274 // Copy the content. The arguments boilerplate doesn't have any
2271 // fields that point to new space so it's safe to skip the write 2275 // fields that point to new space so it's safe to skip the write
2272 // barrier here. 2276 // barrier here.
2273 CopyBlock(reinterpret_cast<Object**>(HeapObject::cast(result)->address()), 2277 CopyBlock(reinterpret_cast<Object**>(HeapObject::cast(result)->address()),
2274 reinterpret_cast<Object**>(boilerplate->address()), 2278 reinterpret_cast<Object**>(boilerplate->address()),
2275 object_size); 2279 kArgumentsObjectSize);
2276 2280
2277 // Set the two properties. 2281 // Set the two properties.
2278 JSObject::cast(result)->InObjectPropertyAtPut(arguments_callee_index, 2282 JSObject::cast(result)->InObjectPropertyAtPut(arguments_callee_index,
2279 callee); 2283 callee);
2280 JSObject::cast(result)->InObjectPropertyAtPut(arguments_length_index, 2284 JSObject::cast(result)->InObjectPropertyAtPut(arguments_length_index,
2281 Smi::FromInt(length), 2285 Smi::FromInt(length),
2282 SKIP_WRITE_BARRIER); 2286 SKIP_WRITE_BARRIER);
2283 2287
2284 // Check the state of the object 2288 // Check the state of the object
2285 ASSERT(JSObject::cast(result)->HasFastProperties()); 2289 ASSERT(JSObject::cast(result)->HasFastProperties());
(...skipping 1796 matching lines...) Expand 10 before | Expand all | Expand 10 after
4082 void ExternalStringTable::TearDown() { 4086 void ExternalStringTable::TearDown() {
4083 new_space_strings_.Free(); 4087 new_space_strings_.Free();
4084 old_space_strings_.Free(); 4088 old_space_strings_.Free();
4085 } 4089 }
4086 4090
4087 4091
4088 List<Object*> ExternalStringTable::new_space_strings_; 4092 List<Object*> ExternalStringTable::new_space_strings_;
4089 List<Object*> ExternalStringTable::old_space_strings_; 4093 List<Object*> ExternalStringTable::old_space_strings_;
4090 4094
4091 } } // namespace v8::internal 4095 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « bleeding_edge/src/heap.h ('k') | bleeding_edge/src/ia32/codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698