OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 4705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4716 write_cursor[3] = replacement[3]; | 4716 write_cursor[3] = replacement[3]; |
4717 write_cursor[4] = replacement[4]; | 4717 write_cursor[4] = replacement[4]; |
4718 write_cursor[5] = replacement[5]; | 4718 write_cursor[5] = replacement[5]; |
4719 } | 4719 } |
4720 } | 4720 } |
4721 write_cursor += len; | 4721 write_cursor += len; |
4722 } | 4722 } |
4723 } | 4723 } |
4724 *(write_cursor++) = '"'; | 4724 *(write_cursor++) = '"'; |
4725 | 4725 |
4726 int final_length = | 4726 int final_length = static_cast<int>( |
4727 write_cursor - reinterpret_cast<Char*>( | 4727 write_cursor - reinterpret_cast<Char*>( |
4728 new_string->address() + SeqAsciiString::kHeaderSize); | 4728 new_string->address() + SeqAsciiString::kHeaderSize)); |
4729 Heap::new_space()->ShrinkStringAtAllocationBoundary<StringType>(new_string, | 4729 Heap::new_space()->ShrinkStringAtAllocationBoundary<StringType>(new_string, |
4730 final_length); | 4730 final_length); |
4731 return new_string; | 4731 return new_string; |
4732 } | 4732 } |
4733 | 4733 |
4734 | 4734 |
4735 static MaybeObject* Runtime_QuoteJSONString(Arguments args) { | 4735 static MaybeObject* Runtime_QuoteJSONString(Arguments args) { |
4736 NoHandleAllocation ha; | 4736 NoHandleAllocation ha; |
4737 CONVERT_CHECKED(String, str, args[0]); | 4737 CONVERT_CHECKED(String, str, args[0]); |
4738 if (!str->IsFlat()) { | 4738 if (!str->IsFlat()) { |
(...skipping 6039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10778 } else { | 10778 } else { |
10779 // Handle last resort GC and make sure to allow future allocations | 10779 // Handle last resort GC and make sure to allow future allocations |
10780 // to grow the heap without causing GCs (if possible). | 10780 // to grow the heap without causing GCs (if possible). |
10781 Counters::gc_last_resort_from_js.Increment(); | 10781 Counters::gc_last_resort_from_js.Increment(); |
10782 Heap::CollectAllGarbage(false); | 10782 Heap::CollectAllGarbage(false); |
10783 } | 10783 } |
10784 } | 10784 } |
10785 | 10785 |
10786 | 10786 |
10787 } } // namespace v8::internal | 10787 } } // namespace v8::internal |
OLD | NEW |