OLD | NEW |
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/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/conversions.h" | 10 #include "src/conversions.h" |
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 } | 697 } |
698 Handle<ExternalTwoByteString> external_string = | 698 Handle<ExternalTwoByteString> external_string = |
699 New<ExternalTwoByteString>(map, NEW_SPACE); | 699 New<ExternalTwoByteString>(map, NEW_SPACE); |
700 external_string->set_length(static_cast<int>(length)); | 700 external_string->set_length(static_cast<int>(length)); |
701 external_string->set_hash_field(String::kEmptyHashField); | 701 external_string->set_hash_field(String::kEmptyHashField); |
702 external_string->set_resource(resource); | 702 external_string->set_resource(resource); |
703 | 703 |
704 return external_string; | 704 return external_string; |
705 } | 705 } |
706 | 706 |
| 707 Handle<ExternalOneByteString> Factory::NewNativeSourceString( |
| 708 const ExternalOneByteString::Resource* resource) { |
| 709 size_t length = resource->length(); |
| 710 DCHECK_LE(length, static_cast<size_t>(String::kMaxLength)); |
| 711 |
| 712 Handle<Map> map = native_source_string_map(); |
| 713 Handle<ExternalOneByteString> external_string = |
| 714 New<ExternalOneByteString>(map, OLD_SPACE); |
| 715 external_string->set_length(static_cast<int>(length)); |
| 716 external_string->set_hash_field(String::kEmptyHashField); |
| 717 external_string->set_resource(resource); |
| 718 |
| 719 return external_string; |
| 720 } |
| 721 |
707 | 722 |
708 Handle<Symbol> Factory::NewSymbol() { | 723 Handle<Symbol> Factory::NewSymbol() { |
709 CALL_HEAP_FUNCTION( | 724 CALL_HEAP_FUNCTION( |
710 isolate(), | 725 isolate(), |
711 isolate()->heap()->AllocateSymbol(), | 726 isolate()->heap()->AllocateSymbol(), |
712 Symbol); | 727 Symbol); |
713 } | 728 } |
714 | 729 |
715 | 730 |
716 Handle<Symbol> Factory::NewPrivateSymbol() { | 731 Handle<Symbol> Factory::NewPrivateSymbol() { |
(...skipping 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2378 } | 2393 } |
2379 | 2394 |
2380 | 2395 |
2381 Handle<Object> Factory::ToBoolean(bool value) { | 2396 Handle<Object> Factory::ToBoolean(bool value) { |
2382 return value ? true_value() : false_value(); | 2397 return value ? true_value() : false_value(); |
2383 } | 2398 } |
2384 | 2399 |
2385 | 2400 |
2386 } // namespace internal | 2401 } // namespace internal |
2387 } // namespace v8 | 2402 } // namespace v8 |
OLD | NEW |