| 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 5819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5830 #endif | 5830 #endif |
| 5831 | 5831 |
| 5832 // Given a word and two range boundaries returns a word with high bit | 5832 // Given a word and two range boundaries returns a word with high bit |
| 5833 // set in every byte iff the corresponding input byte was strictly in | 5833 // set in every byte iff the corresponding input byte was strictly in |
| 5834 // the range (m, n). All the other bits in the result are cleared. | 5834 // the range (m, n). All the other bits in the result are cleared. |
| 5835 // This function is only useful when it can be inlined and the | 5835 // This function is only useful when it can be inlined and the |
| 5836 // boundaries are statically known. | 5836 // boundaries are statically known. |
| 5837 // Requires: all bytes in the input word and the boundaries must be | 5837 // Requires: all bytes in the input word and the boundaries must be |
| 5838 // ASCII (less than 0x7F). | 5838 // ASCII (less than 0x7F). |
| 5839 static inline uintptr_t AsciiRangeMask(uintptr_t w, char m, char n) { | 5839 static inline uintptr_t AsciiRangeMask(uintptr_t w, char m, char n) { |
| 5840 // Every byte in an ASCII string is less than or equal to 0x7F. | |
| 5841 ASSERT((w & (kOneInEveryByte * 0x7F)) == w); | |
| 5842 // Use strict inequalities since in edge cases the function could be | 5840 // Use strict inequalities since in edge cases the function could be |
| 5843 // further simplified. | 5841 // further simplified. |
| 5844 ASSERT(0 < m && m < n); | 5842 ASSERT(0 < m && m < n); |
| 5845 #ifndef ENABLE_LATIN_1 | 5843 #ifndef ENABLE_LATIN_1 |
| 5844 // Every byte in an ASCII string is less than or equal to 0x7F. |
| 5845 ASSERT((w & (kOneInEveryByte * 0x7F)) == w); |
| 5846 ASSERT(n < 0x7F); | 5846 ASSERT(n < 0x7F); |
| 5847 #endif | 5847 #endif |
| 5848 // Has high bit set in every w byte less than n. | 5848 // Has high bit set in every w byte less than n. |
| 5849 uintptr_t tmp1 = kOneInEveryByte * (0x7F + n) - w; | 5849 uintptr_t tmp1 = kOneInEveryByte * (0x7F + n) - w; |
| 5850 // Has high bit set in every w byte greater than m. | 5850 // Has high bit set in every w byte greater than m. |
| 5851 uintptr_t tmp2 = w + kOneInEveryByte * (0x7F - m); | 5851 uintptr_t tmp2 = w + kOneInEveryByte * (0x7F - m); |
| 5852 return (tmp1 & tmp2 & (kOneInEveryByte * 0x80)); | 5852 return (tmp1 & tmp2 & (kOneInEveryByte * 0x80)); |
| 5853 } | 5853 } |
| 5854 | 5854 |
| 5855 | 5855 |
| (...skipping 7677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13533 // Handle last resort GC and make sure to allow future allocations | 13533 // Handle last resort GC and make sure to allow future allocations |
| 13534 // to grow the heap without causing GCs (if possible). | 13534 // to grow the heap without causing GCs (if possible). |
| 13535 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13535 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 13536 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13536 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 13537 "Runtime::PerformGC"); | 13537 "Runtime::PerformGC"); |
| 13538 } | 13538 } |
| 13539 } | 13539 } |
| 13540 | 13540 |
| 13541 | 13541 |
| 13542 } } // namespace v8::internal | 13542 } } // namespace v8::internal |
| OLD | NEW |