| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 3250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3261 }; | 3261 }; |
| 3262 | 3262 |
| 3263 for (unsigned int i = 0; i < ARRAY_SIZE(writable_roots); i++) { | 3263 for (unsigned int i = 0; i < ARRAY_SIZE(writable_roots); i++) { |
| 3264 if (root_index == writable_roots[i]) | 3264 if (root_index == writable_roots[i]) |
| 3265 return true; | 3265 return true; |
| 3266 } | 3266 } |
| 3267 return false; | 3267 return false; |
| 3268 } | 3268 } |
| 3269 | 3269 |
| 3270 | 3270 |
| 3271 bool Heap::RootCanBeTreatedAsConstant(RootListIndex root_index) { |
| 3272 return !RootCanBeWrittenAfterInitialization(root_index) && |
| 3273 !InNewSpace(roots_array_start()[root_index]); |
| 3274 } |
| 3275 |
| 3276 |
| 3271 Object* RegExpResultsCache::Lookup(Heap* heap, | 3277 Object* RegExpResultsCache::Lookup(Heap* heap, |
| 3272 String* key_string, | 3278 String* key_string, |
| 3273 Object* key_pattern, | 3279 Object* key_pattern, |
| 3274 ResultsCacheType type) { | 3280 ResultsCacheType type) { |
| 3275 FixedArray* cache; | 3281 FixedArray* cache; |
| 3276 if (!key_string->IsInternalizedString()) return Smi::FromInt(0); | 3282 if (!key_string->IsInternalizedString()) return Smi::FromInt(0); |
| 3277 if (type == STRING_SPLIT_SUBSTRINGS) { | 3283 if (type == STRING_SPLIT_SUBSTRINGS) { |
| 3278 ASSERT(key_pattern->IsString()); | 3284 ASSERT(key_pattern->IsString()); |
| 3279 if (!key_pattern->IsInternalizedString()) return Smi::FromInt(0); | 3285 if (!key_pattern->IsInternalizedString()) return Smi::FromInt(0); |
| 3280 cache = heap->string_split_cache(); | 3286 cache = heap->string_split_cache(); |
| (...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4005 | 4011 |
| 4006 | 4012 |
| 4007 MaybeObject* Heap::AllocateByteArray(int length, PretenureFlag pretenure) { | 4013 MaybeObject* Heap::AllocateByteArray(int length, PretenureFlag pretenure) { |
| 4008 if (length < 0 || length > ByteArray::kMaxLength) { | 4014 if (length < 0 || length > ByteArray::kMaxLength) { |
| 4009 return Failure::OutOfMemoryException(0x7); | 4015 return Failure::OutOfMemoryException(0x7); |
| 4010 } | 4016 } |
| 4011 if (pretenure == NOT_TENURED) { | 4017 if (pretenure == NOT_TENURED) { |
| 4012 return AllocateByteArray(length); | 4018 return AllocateByteArray(length); |
| 4013 } | 4019 } |
| 4014 int size = ByteArray::SizeFor(length); | 4020 int size = ByteArray::SizeFor(length); |
| 4021 AllocationSpace space = |
| 4022 (size > Page::kMaxNonCodeHeapObjectSize) ? LO_SPACE : OLD_DATA_SPACE; |
| 4015 Object* result; | 4023 Object* result; |
| 4016 { MaybeObject* maybe_result = (size <= Page::kMaxNonCodeHeapObjectSize) | 4024 { MaybeObject* maybe_result = AllocateRaw(size, space, space); |
| 4017 ? old_data_space_->AllocateRaw(size) | |
| 4018 : lo_space_->AllocateRaw(size, NOT_EXECUTABLE); | |
| 4019 if (!maybe_result->ToObject(&result)) return maybe_result; | 4025 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 4020 } | 4026 } |
| 4021 | 4027 |
| 4022 reinterpret_cast<ByteArray*>(result)->set_map_no_write_barrier( | 4028 reinterpret_cast<ByteArray*>(result)->set_map_no_write_barrier( |
| 4023 byte_array_map()); | 4029 byte_array_map()); |
| 4024 reinterpret_cast<ByteArray*>(result)->set_length(length); | 4030 reinterpret_cast<ByteArray*>(result)->set_length(length); |
| 4025 return result; | 4031 return result; |
| 4026 } | 4032 } |
| 4027 | 4033 |
| 4028 | 4034 |
| (...skipping 4015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8044 if (FLAG_parallel_recompilation) { | 8050 if (FLAG_parallel_recompilation) { |
| 8045 heap_->relocation_mutex_->Lock(); | 8051 heap_->relocation_mutex_->Lock(); |
| 8046 #ifdef DEBUG | 8052 #ifdef DEBUG |
| 8047 heap_->relocation_mutex_locked_by_optimizer_thread_ = | 8053 heap_->relocation_mutex_locked_by_optimizer_thread_ = |
| 8048 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); | 8054 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); |
| 8049 #endif // DEBUG | 8055 #endif // DEBUG |
| 8050 } | 8056 } |
| 8051 } | 8057 } |
| 8052 | 8058 |
| 8053 } } // namespace v8::internal | 8059 } } // namespace v8::internal |
| OLD | NEW |