| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 | 66 |
| 67 char* RegExpStack::RestoreStack(char* from) { | 67 char* RegExpStack::RestoreStack(char* from) { |
| 68 size_t size = sizeof(thread_local_); | 68 size_t size = sizeof(thread_local_); |
| 69 memcpy(&thread_local_, reinterpret_cast<void*>(from), size); | 69 memcpy(&thread_local_, reinterpret_cast<void*>(from), size); |
| 70 return from + size; | 70 return from + size; |
| 71 } | 71 } |
| 72 | 72 |
| 73 | 73 |
| 74 void RegExpStack::Reset() { | 74 void RegExpStack::Reset() { |
| 75 if (thread_local_.memory_size_ > kMinimumStackSize) { | 75 if (thread_local_.memory_size_ >= kMinimumStackSize) { |
| 76 DeleteArray(thread_local_.memory_); | 76 DeleteArray(thread_local_.memory_); |
| 77 thread_local_ = ThreadLocal(); | 77 thread_local_ = ThreadLocal(); |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 | 80 |
| 81 | 81 |
| 82 void RegExpStack::ThreadLocal::Free() { | 82 void RegExpStack::ThreadLocal::Free() { |
| 83 if (memory_size_ > 0) { | 83 if (memory_size_ > 0) { |
| 84 DeleteArray(memory_); | 84 DeleteArray(memory_); |
| 85 Clear(); | 85 Clear(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 102 } | 102 } |
| 103 thread_local_.memory_ = new_memory; | 103 thread_local_.memory_ = new_memory; |
| 104 thread_local_.memory_size_ = size; | 104 thread_local_.memory_size_ = size; |
| 105 thread_local_.limit_ = new_memory + kStackLimitSlack * kPointerSize; | 105 thread_local_.limit_ = new_memory + kStackLimitSlack * kPointerSize; |
| 106 } | 106 } |
| 107 return thread_local_.memory_ + thread_local_.memory_size_; | 107 return thread_local_.memory_ + thread_local_.memory_size_; |
| 108 } | 108 } |
| 109 | 109 |
| 110 | 110 |
| 111 }} // namespace v8::internal | 111 }} // namespace v8::internal |
| OLD | NEW |