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

Unified Diff: runtime/vm/symbols.cc

Issue 10836061: Change the zone allocation api. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/stack_frame_test.cc ('k') | runtime/vm/zone.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/symbols.cc
===================================================================
--- runtime/vm/symbols.cc (revision 10253)
+++ runtime/vm/symbols.cc (working copy)
@@ -92,21 +92,20 @@
RawString* Symbols::New(const char* str) {
intptr_t width = 0;
intptr_t len = Utf8::CodePointCount(str, &width);
- intptr_t size = len * width;
Zone* zone = Isolate::Current()->current_zone();
if (len == 0) {
return Symbols::New(reinterpret_cast<uint8_t*>(NULL), 0);
} else if (width == 1) {
- uint8_t* characters = reinterpret_cast<uint8_t*>(zone->Allocate(size));
+ uint8_t* characters = zone->Alloc<uint8_t>(len);
Utf8::Decode(str, characters, len);
return New(characters, len);
} else if (width == 2) {
- uint16_t* characters = reinterpret_cast<uint16_t*>(zone->Allocate(size));
+ uint16_t* characters = zone->Alloc<uint16_t>(len);
Utf8::Decode(str, characters, len);
return New(characters, len);
}
ASSERT(width == 4);
- uint32_t* characters = reinterpret_cast<uint32_t*>(zone->Allocate(size));
+ uint32_t* characters = zone->Alloc<uint32_t>(len);
Utf8::Decode(str, characters, len);
return New(characters, len);
}
« no previous file with comments | « runtime/vm/stack_frame_test.cc ('k') | runtime/vm/zone.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698