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/factory.cc

Issue 17585003: Rollback of r15267, r15263, r15193 in trunk branch in preparation for 3.19 branch (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 7 years, 5 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/factory.h ('k') | src/flag-definitions.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 252
253 253
254 Handle<String> Factory::NewConsString(Handle<String> first, 254 Handle<String> Factory::NewConsString(Handle<String> first,
255 Handle<String> second) { 255 Handle<String> second) {
256 CALL_HEAP_FUNCTION(isolate(), 256 CALL_HEAP_FUNCTION(isolate(),
257 isolate()->heap()->AllocateConsString(*first, *second), 257 isolate()->heap()->AllocateConsString(*first, *second),
258 String); 258 String);
259 } 259 }
260 260
261 261
262 template<typename SinkChar, typename StringType>
263 Handle<String> ConcatStringContent(Handle<StringType> result,
264 Handle<String> first,
265 Handle<String> second) {
266 DisallowHeapAllocation pointer_stays_valid;
267 SinkChar* sink = result->GetChars();
268 String::WriteToFlat(*first, sink, 0, first->length());
269 String::WriteToFlat(*second, sink + first->length(), 0, second->length());
270 return result;
271 }
272
273
274 Handle<String> Factory::NewFlatConcatString(Handle<String> first,
275 Handle<String> second) {
276 int total_length = first->length() + second->length();
277 if (first->IsOneByteRepresentationUnderneath() &&
278 second->IsOneByteRepresentationUnderneath()) {
279 return ConcatStringContent<uint8_t>(
280 NewRawOneByteString(total_length), first, second);
281 } else {
282 return ConcatStringContent<uc16>(
283 NewRawTwoByteString(total_length), first, second);
284 }
285 }
286
287
288 Handle<String> Factory::NewSubString(Handle<String> str, 262 Handle<String> Factory::NewSubString(Handle<String> str,
289 int begin, 263 int begin,
290 int end) { 264 int end) {
291 CALL_HEAP_FUNCTION(isolate(), 265 CALL_HEAP_FUNCTION(isolate(),
292 str->SubString(begin, end), 266 str->SubString(begin, end),
293 String); 267 String);
294 } 268 }
295 269
296 270
297 Handle<String> Factory::NewProperSubString(Handle<String> str, 271 Handle<String> Factory::NewProperSubString(Handle<String> str,
(...skipping 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1598 return Handle<Object>::null(); 1572 return Handle<Object>::null();
1599 } 1573 }
1600 1574
1601 1575
1602 Handle<Object> Factory::ToBoolean(bool value) { 1576 Handle<Object> Factory::ToBoolean(bool value) {
1603 return value ? true_value() : false_value(); 1577 return value ? true_value() : false_value();
1604 } 1578 }
1605 1579
1606 1580
1607 } } // namespace v8::internal 1581 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/factory.h ('k') | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698