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

Side by Side Diff: src/factory.cc

Issue 1041723002: Added %_NewConsString intrinsic. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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
« no previous file with comments | « src/factory.h ('k') | src/runtime/runtime.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/factory.h" 5 #include "src/factory.h"
6 6
7 #include "src/allocation-site-scopes.h" 7 #include "src/allocation-site-scopes.h"
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/conversions.h" 9 #include "src/conversions.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 return result; 531 return result;
532 } 532 }
533 533
534 return (is_one_byte_data_in_two_byte_string) 534 return (is_one_byte_data_in_two_byte_string)
535 ? ConcatStringContent<uint8_t>( 535 ? ConcatStringContent<uint8_t>(
536 NewRawOneByteString(length).ToHandleChecked(), left, right) 536 NewRawOneByteString(length).ToHandleChecked(), left, right)
537 : ConcatStringContent<uc16>( 537 : ConcatStringContent<uc16>(
538 NewRawTwoByteString(length).ToHandleChecked(), left, right); 538 NewRawTwoByteString(length).ToHandleChecked(), left, right);
539 } 539 }
540 540
541 Handle<Map> map = (is_one_byte || is_one_byte_data_in_two_byte_string) 541 return (is_one_byte || is_one_byte_data_in_two_byte_string)
542 ? cons_one_byte_string_map() 542 ? NewOneByteConsString(length, left, right)
543 : cons_string_map(); 543 : NewTwoByteConsString(length, left, right);
544 Handle<ConsString> result = New<ConsString>(map, NEW_SPACE); 544 }
545
546
547 MaybeHandle<String> Factory::NewOneByteConsString(int length,
548 Handle<String> left,
549 Handle<String> right) {
550 return NewRawConsString(cons_one_byte_string_map(), length, left, right);
551 }
552
553
554 MaybeHandle<String> Factory::NewTwoByteConsString(int length,
555 Handle<String> left,
556 Handle<String> right) {
557 return NewRawConsString(cons_string_map(), length, left, right);
558 }
559
560
561 MaybeHandle<String> Factory::NewRawConsString(Handle<Map> map, int length,
562 Handle<String> left,
563 Handle<String> right) {
564 Handle<ConsString> result = New<ConsString>(map, NEW_SPACE);
545 565
546 DisallowHeapAllocation no_gc; 566 DisallowHeapAllocation no_gc;
547 WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc); 567 WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc);
548 568
549 result->set_hash_field(String::kEmptyHashField); 569 result->set_hash_field(String::kEmptyHashField);
550 result->set_length(length); 570 result->set_length(length);
551 result->set_first(*left, mode); 571 result->set_first(*left, mode);
552 result->set_second(*right, mode); 572 result->set_second(*right, mode);
553 return result; 573 return result;
554 } 574 }
(...skipping 1759 matching lines...) Expand 10 before | Expand all | Expand 10 after
2314 return Handle<Object>::null(); 2334 return Handle<Object>::null();
2315 } 2335 }
2316 2336
2317 2337
2318 Handle<Object> Factory::ToBoolean(bool value) { 2338 Handle<Object> Factory::ToBoolean(bool value) {
2319 return value ? true_value() : false_value(); 2339 return value ? true_value() : false_value();
2320 } 2340 }
2321 2341
2322 2342
2323 } } // namespace v8::internal 2343 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/factory.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698