Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: src/runtime.cc

Issue 12440061: Improve SeqString::Truncate for latest allocated strings. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: renamed according to suggestion Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.cc ('k') | src/spaces.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5119 matching lines...) Expand 10 before | Expand all | Expand 10 after
5130 if (length == 0) return isolate->heap()->empty_string(); 5130 if (length == 0) return isolate->heap()->empty_string();
5131 if (is_one_byte) { 5131 if (is_one_byte) {
5132 return isolate->heap()->AllocateRawOneByteString(length); 5132 return isolate->heap()->AllocateRawOneByteString(length);
5133 } else { 5133 } else {
5134 return isolate->heap()->AllocateRawTwoByteString(length); 5134 return isolate->heap()->AllocateRawTwoByteString(length);
5135 } 5135 }
5136 } 5136 }
5137 5137
5138 5138
5139 RUNTIME_FUNCTION(MaybeObject*, Runtime_TruncateString) { 5139 RUNTIME_FUNCTION(MaybeObject*, Runtime_TruncateString) {
5140 NoHandleAllocation ha(isolate); 5140 HandleScope scope(isolate);
5141 CONVERT_ARG_CHECKED(SeqString, string, 0); 5141 CONVERT_ARG_HANDLE_CHECKED(SeqString, string, 0);
5142 CONVERT_SMI_ARG_CHECKED(new_length, 1); 5142 CONVERT_SMI_ARG_CHECKED(new_length, 1);
5143 return string->Truncate(new_length); 5143 return *SeqString::Truncate(string, new_length);
5144 } 5144 }
5145 5145
5146 5146
5147 RUNTIME_FUNCTION(MaybeObject*, Runtime_URIEscape) { 5147 RUNTIME_FUNCTION(MaybeObject*, Runtime_URIEscape) {
5148 HandleScope scope(isolate); 5148 HandleScope scope(isolate);
5149 ASSERT(args.length() == 1); 5149 ASSERT(args.length() == 1);
5150 CONVERT_ARG_HANDLE_CHECKED(String, source, 0); 5150 CONVERT_ARG_HANDLE_CHECKED(String, source, 0);
5151 Handle<String> string = FlattenGetString(source); 5151 Handle<String> string = FlattenGetString(source);
5152 String::FlatContent content = string->GetFlatContent(); 5152 String::FlatContent content = string->GetFlatContent();
5153 ASSERT(content.IsFlat()); 5153 ASSERT(content.IsFlat());
(...skipping 7832 matching lines...) Expand 10 before | Expand all | Expand 10 after
12986 // Handle last resort GC and make sure to allow future allocations 12986 // Handle last resort GC and make sure to allow future allocations
12987 // to grow the heap without causing GCs (if possible). 12987 // to grow the heap without causing GCs (if possible).
12988 isolate->counters()->gc_last_resort_from_js()->Increment(); 12988 isolate->counters()->gc_last_resort_from_js()->Increment();
12989 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 12989 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
12990 "Runtime::PerformGC"); 12990 "Runtime::PerformGC");
12991 } 12991 }
12992 } 12992 }
12993 12993
12994 12994
12995 } } // namespace v8::internal 12995 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | src/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698