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

Side by Side Diff: src/factory.cc

Issue 395713002: Allow embedding of ConsString objects into code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed moar comments by Yang Guo. Created 6 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/hydrogen-instructions.cc » ('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/conversions.h" 8 #include "src/conversions.h"
9 #include "src/isolate-inl.h" 9 #include "src/isolate-inl.h"
10 #include "src/macro-assembler.h" 10 #include "src/macro-assembler.h"
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc); 536 WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc);
537 537
538 result->set_hash_field(String::kEmptyHashField); 538 result->set_hash_field(String::kEmptyHashField);
539 result->set_length(length); 539 result->set_length(length);
540 result->set_first(*left, mode); 540 result->set_first(*left, mode);
541 result->set_second(*right, mode); 541 result->set_second(*right, mode);
542 return result; 542 return result;
543 } 543 }
544 544
545 545
546 Handle<String> Factory::NewFlatConcatString(Handle<String> first,
547 Handle<String> second) {
548 int total_length = first->length() + second->length();
549 if (first->IsOneByteRepresentation() && second->IsOneByteRepresentation()) {
550 return ConcatStringContent<uint8_t>(
551 NewRawOneByteString(total_length).ToHandleChecked(), first, second);
552 } else {
553 return ConcatStringContent<uc16>(
554 NewRawTwoByteString(total_length).ToHandleChecked(), first, second);
555 }
556 }
557
558
559 Handle<String> Factory::NewProperSubString(Handle<String> str, 546 Handle<String> Factory::NewProperSubString(Handle<String> str,
560 int begin, 547 int begin,
561 int end) { 548 int end) {
562 #if VERIFY_HEAP 549 #if VERIFY_HEAP
563 if (FLAG_verify_heap) str->StringVerify(); 550 if (FLAG_verify_heap) str->StringVerify();
564 #endif 551 #endif
565 ASSERT(begin > 0 || end < str->length()); 552 ASSERT(begin > 0 || end < str->length());
566 553
567 str = String::Flatten(str); 554 str = String::Flatten(str);
568 555
(...skipping 1810 matching lines...) Expand 10 before | Expand all | Expand 10 after
2379 return Handle<Object>::null(); 2366 return Handle<Object>::null();
2380 } 2367 }
2381 2368
2382 2369
2383 Handle<Object> Factory::ToBoolean(bool value) { 2370 Handle<Object> Factory::ToBoolean(bool value) {
2384 return value ? true_value() : false_value(); 2371 return value ? true_value() : false_value();
2385 } 2372 }
2386 2373
2387 2374
2388 } } // namespace v8::internal 2375 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/factory.h ('k') | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698