OLD | NEW |
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 2180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2191 Code* new_code = Code::cast(result); | 2191 Code* new_code = Code::cast(result); |
2192 ASSERT(!CodeRange::exists() || CodeRange::contains(code->address())); | 2192 ASSERT(!CodeRange::exists() || CodeRange::contains(code->address())); |
2193 new_code->Relocate(new_addr - old_addr); | 2193 new_code->Relocate(new_addr - old_addr); |
2194 return new_code; | 2194 return new_code; |
2195 } | 2195 } |
2196 | 2196 |
2197 | 2197 |
2198 Object* Heap::Allocate(Map* map, AllocationSpace space) { | 2198 Object* Heap::Allocate(Map* map, AllocationSpace space) { |
2199 ASSERT(gc_state_ == NOT_IN_GC); | 2199 ASSERT(gc_state_ == NOT_IN_GC); |
2200 ASSERT(map->instance_type() != MAP_TYPE); | 2200 ASSERT(map->instance_type() != MAP_TYPE); |
2201 Object* result = AllocateRaw(map->instance_size(), | 2201 // If allocation failures are disallowed, we may allocate in a different |
2202 space, | 2202 // space when new space is full and the object is not a large object. |
2203 TargetSpaceId(map->instance_type())); | 2203 AllocationSpace retry_space = |
| 2204 (space != NEW_SPACE) ? space : TargetSpaceId(map->instance_type()); |
| 2205 Object* result = |
| 2206 AllocateRaw(map->instance_size(), space, retry_space); |
2204 if (result->IsFailure()) return result; | 2207 if (result->IsFailure()) return result; |
2205 HeapObject::cast(result)->set_map(map); | 2208 HeapObject::cast(result)->set_map(map); |
2206 #ifdef ENABLE_LOGGING_AND_PROFILING | 2209 #ifdef ENABLE_LOGGING_AND_PROFILING |
2207 ProducerHeapProfile::RecordJSObjectAllocation(result); | 2210 ProducerHeapProfile::RecordJSObjectAllocation(result); |
2208 #endif | 2211 #endif |
2209 return result; | 2212 return result; |
2210 } | 2213 } |
2211 | 2214 |
2212 | 2215 |
2213 Object* Heap::InitializeFunction(JSFunction* function, | 2216 Object* Heap::InitializeFunction(JSFunction* function, |
(...skipping 1880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4094 void ExternalStringTable::TearDown() { | 4097 void ExternalStringTable::TearDown() { |
4095 new_space_strings_.Free(); | 4098 new_space_strings_.Free(); |
4096 old_space_strings_.Free(); | 4099 old_space_strings_.Free(); |
4097 } | 4100 } |
4098 | 4101 |
4099 | 4102 |
4100 List<Object*> ExternalStringTable::new_space_strings_; | 4103 List<Object*> ExternalStringTable::new_space_strings_; |
4101 List<Object*> ExternalStringTable::old_space_strings_; | 4104 List<Object*> ExternalStringTable::old_space_strings_; |
4102 | 4105 |
4103 } } // namespace v8::internal | 4106 } } // namespace v8::internal |
OLD | NEW |