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

Side by Side Diff: src/factory.cc

Issue 11469014: Add a safe API for creating ASCII-only strings
Patch Set: Created 8 years 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
« no previous file with comments | « src/factory.h ('k') | src/heap.h » ('j') | src/heap.cc » ('J')
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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 197
198 198
199 Handle<String> Factory::NewStringFromAscii(Vector<const char> string, 199 Handle<String> Factory::NewStringFromAscii(Vector<const char> string,
200 PretenureFlag pretenure) { 200 PretenureFlag pretenure) {
201 CALL_HEAP_FUNCTION( 201 CALL_HEAP_FUNCTION(
202 isolate(), 202 isolate(),
203 isolate()->heap()->AllocateStringFromOneByte(string, pretenure), 203 isolate()->heap()->AllocateStringFromOneByte(string, pretenure),
204 String); 204 String);
205 } 205 }
206 206
207
208 Handle<String> Factory::NewStringFromAsciiSafe(Vector<const char> string,
209 PretenureFlag pretenure) {
210 CALL_HEAP_FUNCTION(
211 isolate(),
212 isolate()->heap()->AllocateStringFromAsciiSafe(string, pretenure),
213 String);
214 }
215
216
207 Handle<String> Factory::NewStringFromUtf8(Vector<const char> string, 217 Handle<String> Factory::NewStringFromUtf8(Vector<const char> string,
208 PretenureFlag pretenure) { 218 PretenureFlag pretenure) {
209 CALL_HEAP_FUNCTION( 219 CALL_HEAP_FUNCTION(
210 isolate(), 220 isolate(),
211 isolate()->heap()->AllocateStringFromUtf8(string, pretenure), 221 isolate()->heap()->AllocateStringFromUtf8(string, pretenure),
212 String); 222 String);
213 } 223 }
214 224
215 225
216 Handle<String> Factory::NewStringFromTwoByte(Vector<const uc16> string, 226 Handle<String> Factory::NewStringFromTwoByte(Vector<const uc16> string,
(...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after
1443 1453
1444 1454
1445 Handle<Object> Factory::ToBoolean(bool value) { 1455 Handle<Object> Factory::ToBoolean(bool value) {
1446 return Handle<Object>(value 1456 return Handle<Object>(value
1447 ? isolate()->heap()->true_value() 1457 ? isolate()->heap()->true_value()
1448 : isolate()->heap()->false_value()); 1458 : isolate()->heap()->false_value());
1449 } 1459 }
1450 1460
1451 1461
1452 } } // namespace v8::internal 1462 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/factory.h ('k') | src/heap.h » ('j') | src/heap.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698