OLD | NEW |
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // Allocates a pre-tenured empty AccessorPair. | 77 // Allocates a pre-tenured empty AccessorPair. |
78 Handle<AccessorPair> NewAccessorPair(); | 78 Handle<AccessorPair> NewAccessorPair(); |
79 | 79 |
80 Handle<TypeFeedbackInfo> NewTypeFeedbackInfo(); | 80 Handle<TypeFeedbackInfo> NewTypeFeedbackInfo(); |
81 | 81 |
82 Handle<String> LookupUtf8Symbol(Vector<const char> str); | 82 Handle<String> LookupUtf8Symbol(Vector<const char> str); |
83 Handle<String> LookupUtf8Symbol(const char* str) { | 83 Handle<String> LookupUtf8Symbol(const char* str) { |
84 return LookupUtf8Symbol(CStrVector(str)); | 84 return LookupUtf8Symbol(CStrVector(str)); |
85 } | 85 } |
86 Handle<String> LookupSymbol(Handle<String> str); | 86 Handle<String> LookupSymbol(Handle<String> str); |
87 Handle<String> LookupOneByteSymbol(Vector<const char> str); | 87 Handle<String> LookupOneByteSymbol(Vector<const uint8_t> str); |
88 Handle<String> LookupOneByteSymbol(Handle<SeqOneByteString>, | 88 Handle<String> LookupOneByteSymbol(Handle<SeqOneByteString>, |
89 int from, | 89 int from, |
90 int length); | 90 int length); |
91 Handle<String> LookupTwoByteSymbol(Vector<const uc16> str); | 91 Handle<String> LookupTwoByteSymbol(Vector<const uc16> str); |
92 | 92 |
93 | 93 |
94 // String creation functions. Most of the string creation functions take | 94 // String creation functions. Most of the string creation functions take |
95 // a Heap::PretenureFlag argument to optionally request that they be | 95 // a Heap::PretenureFlag argument to optionally request that they be |
96 // allocated in the old generation. The pretenure flag defaults to | 96 // allocated in the old generation. The pretenure flag defaults to |
97 // DONT_TENURE. | 97 // DONT_TENURE. |
98 // | 98 // |
99 // Creates a new String object. There are two String encodings: ASCII and | 99 // Creates a new String object. There are two String encodings: ASCII and |
100 // two byte. One should choose between the three string factory functions | 100 // two byte. One should choose between the three string factory functions |
101 // based on the encoding of the string buffer that the string is | 101 // based on the encoding of the string buffer that the string is |
102 // initialized from. | 102 // initialized from. |
103 // - ...FromAscii initializes the string from a buffer that is ASCII | 103 // - ...FromAscii initializes the string from a buffer that is ASCII |
104 // encoded (it does not check that the buffer is ASCII encoded) and | 104 // encoded (it does not check that the buffer is ASCII encoded) and |
105 // the result will be ASCII encoded. | 105 // the result will be ASCII encoded. |
106 // - ...FromUtf8 initializes the string from a buffer that is UTF-8 | 106 // - ...FromUtf8 initializes the string from a buffer that is UTF-8 |
107 // encoded. If the characters are all single-byte characters, the | 107 // encoded. If the characters are all single-byte characters, the |
108 // result will be ASCII encoded, otherwise it will converted to two | 108 // result will be ASCII encoded, otherwise it will converted to two |
109 // byte. | 109 // byte. |
110 // - ...FromTwoByte initializes the string from a buffer that is two | 110 // - ...FromTwoByte initializes the string from a buffer that is two |
111 // byte encoded. If the characters are all single-byte characters, | 111 // byte encoded. If the characters are all single-byte characters, |
112 // the result will be converted to ASCII, otherwise it will be left as | 112 // the result will be converted to ASCII, otherwise it will be left as |
113 // two byte. | 113 // two byte. |
114 // | 114 // |
115 // ASCII strings are pretenured when used as keys in the SourceCodeCache. | 115 // ASCII strings are pretenured when used as keys in the SourceCodeCache. |
116 Handle<String> NewStringFromAscii( | 116 Handle<String> NewStringFromOneByte( |
| 117 Vector<const uint8_t> str, |
| 118 PretenureFlag pretenure = NOT_TENURED); |
| 119 // TODO(dcarney): remove this function. |
| 120 inline Handle<String> NewStringFromAscii( |
117 Vector<const char> str, | 121 Vector<const char> str, |
118 PretenureFlag pretenure = NOT_TENURED); | 122 PretenureFlag pretenure = NOT_TENURED) { |
| 123 return NewStringFromOneByte(Vector<const uint8_t>::cast(str), pretenure); |
| 124 } |
119 | 125 |
120 // UTF8 strings are pretenured when used for regexp literal patterns and | 126 // UTF8 strings are pretenured when used for regexp literal patterns and |
121 // flags in the parser. | 127 // flags in the parser. |
122 Handle<String> NewStringFromUtf8( | 128 Handle<String> NewStringFromUtf8( |
123 Vector<const char> str, | 129 Vector<const char> str, |
124 PretenureFlag pretenure = NOT_TENURED); | 130 PretenureFlag pretenure = NOT_TENURED); |
125 | 131 |
126 Handle<String> NewStringFromTwoByte( | 132 Handle<String> NewStringFromTwoByte( |
127 Vector<const uc16> str, | 133 Vector<const uc16> str, |
128 PretenureFlag pretenure = NOT_TENURED); | 134 PretenureFlag pretenure = NOT_TENURED); |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 // Update the map cache in the native context with (keys, map) | 518 // Update the map cache in the native context with (keys, map) |
513 Handle<MapCache> AddToMapCache(Handle<Context> context, | 519 Handle<MapCache> AddToMapCache(Handle<Context> context, |
514 Handle<FixedArray> keys, | 520 Handle<FixedArray> keys, |
515 Handle<Map> map); | 521 Handle<Map> map); |
516 }; | 522 }; |
517 | 523 |
518 | 524 |
519 } } // namespace v8::internal | 525 } } // namespace v8::internal |
520 | 526 |
521 #endif // V8_FACTORY_H_ | 527 #endif // V8_FACTORY_H_ |
OLD | NEW |