| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 DeleteArray(thread_local_.memory_); | 74 DeleteArray(thread_local_.memory_); |
| 75 thread_local_ = ThreadLocal(); | 75 thread_local_ = ThreadLocal(); |
| 76 } | 76 } |
| 77 } | 77 } |
| 78 | 78 |
| 79 | 79 |
| 80 Address RegExpStack::EnsureCapacity(size_t size) { | 80 Address RegExpStack::EnsureCapacity(size_t size) { |
| 81 if (size > kMaximumStackSize) return NULL; | 81 if (size > kMaximumStackSize) return NULL; |
| 82 if (size < kMinimumStackSize) size = kMinimumStackSize; | 82 if (size < kMinimumStackSize) size = kMinimumStackSize; |
| 83 if (thread_local_.memory_size_ < size) { | 83 if (thread_local_.memory_size_ < size) { |
| 84 Address new_memory = NewArray<byte>(size); | 84 Address new_memory = NewArray<byte>(static_cast<int>(size)); |
| 85 if (thread_local_.memory_size_ > 0) { | 85 if (thread_local_.memory_size_ > 0) { |
| 86 // Copy original memory into top of new memory. | 86 // Copy original memory into top of new memory. |
| 87 memcpy(reinterpret_cast<void*>( | 87 memcpy(reinterpret_cast<void*>( |
| 88 new_memory + size - thread_local_.memory_size_), | 88 new_memory + size - thread_local_.memory_size_), |
| 89 reinterpret_cast<void*>(thread_local_.memory_), | 89 reinterpret_cast<void*>(thread_local_.memory_), |
| 90 thread_local_.memory_size_); | 90 thread_local_.memory_size_); |
| 91 DeleteArray(thread_local_.memory_); | 91 DeleteArray(thread_local_.memory_); |
| 92 } | 92 } |
| 93 thread_local_.memory_ = new_memory; | 93 thread_local_.memory_ = new_memory; |
| 94 thread_local_.memory_size_ = size; | 94 thread_local_.memory_size_ = size; |
| 95 thread_local_.limit_ = new_memory + kStackLimitSlack * kPointerSize; | 95 thread_local_.limit_ = new_memory + kStackLimitSlack * kPointerSize; |
| 96 } | 96 } |
| 97 return thread_local_.memory_ + thread_local_.memory_size_; | 97 return thread_local_.memory_ + thread_local_.memory_size_; |
| 98 } | 98 } |
| 99 | 99 |
| 100 | 100 |
| 101 RegExpStack::ThreadLocal RegExpStack::thread_local_; | 101 RegExpStack::ThreadLocal RegExpStack::thread_local_; |
| 102 | 102 |
| 103 }} // namespace v8::internal | 103 }} // namespace v8::internal |
| OLD | NEW |