HELLO·Android
系统源代码
IT资讯
技术文章
我的收藏
注册
登录
-
我收藏的文章
创建代码块
我的代码块
我的账号
Kitkat
|
4.4.4_r1
下载
查看原文件
收藏
根目录
external
chromium_org
v8
src
factory.h
// Copyright 2012 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef V8_FACTORY_H_ #define V8_FACTORY_H_ #include "globals.h" #include "handles.h" #include "heap.h" namespace v8 { namespace internal { // Interface for handle based allocation. class Factory { public: // Allocate a new boxed value. Handle
NewBox( Handle
value, PretenureFlag pretenure = NOT_TENURED); // Allocate a new uninitialized fixed array. Handle
NewFixedArray( int size, PretenureFlag pretenure = NOT_TENURED); // Allocate a new fixed array with non-existing entries (the hole). Handle
NewFixedArrayWithHoles( int size, PretenureFlag pretenure = NOT_TENURED); // Allocate a new uninitialized fixed double array. Handle
NewFixedDoubleArray( int size, PretenureFlag pretenure = NOT_TENURED); Handle
NewConstantPoolArray( int number_of_int64_entries, int number_of_ptr_entries, int number_of_int32_entries); Handle
NewSeededNumberDictionary( int at_least_space_for); Handle
NewUnseededNumberDictionary( int at_least_space_for); Handle
NewNameDictionary(int at_least_space_for); Handle
NewObjectHashSet(int at_least_space_for); Handle
NewObjectHashTable( int at_least_space_for, MinimumCapacity capacity_option = USE_DEFAULT_MINIMUM_CAPACITY); Handle
NewWeakHashTable(int at_least_space_for); Handle
NewDescriptorArray(int number_of_descriptors, int slack = 0); Handle
NewDeoptimizationInputData( int deopt_entry_count, PretenureFlag pretenure); Handle
NewDeoptimizationOutputData( int deopt_entry_count, PretenureFlag pretenure); // Allocates a pre-tenured empty AccessorPair. Handle
NewAccessorPair(); Handle
NewTypeFeedbackInfo(); Handle
InternalizeUtf8String(Vector
str); Handle
InternalizeUtf8String(const char* str) { return InternalizeUtf8String(CStrVector(str)); } Handle
InternalizeString(Handle
str); Handle
InternalizeOneByteString(Vector
str); Handle
InternalizeOneByteString(Handle
, int from, int length); Handle
InternalizeTwoByteString(Vector
str); // String creation functions. Most of the string creation functions take // a Heap::PretenureFlag argument to optionally request that they be // allocated in the old generation. The pretenure flag defaults to // DONT_TENURE. // // Creates a new String object. There are two String encodings: ASCII and // two byte. One should choose between the three string factory functions // based on the encoding of the string buffer that the string is // initialized from. // - ...FromAscii initializes the string from a buffer that is ASCII // encoded (it does not check that the buffer is ASCII encoded) and // the result will be ASCII encoded. // - ...FromUtf8 initializes the string from a buffer that is UTF-8 // encoded. If the characters are all single-byte characters, the // result will be ASCII encoded, otherwise it will converted to two // byte. // - ...FromTwoByte initializes the string from a buffer that is two // byte encoded. If the characters are all single-byte characters, // the result will be converted to ASCII, otherwise it will be left as // two byte. // // ASCII strings are pretenured when used as keys in the SourceCodeCache. Handle
NewStringFromOneByte( Vector
str, PretenureFlag pretenure = NOT_TENURED); // TODO(dcarney): remove this function. inline Handle
NewStringFromAscii( Vector
str, PretenureFlag pretenure = NOT_TENURED) { return NewStringFromOneByte(Vector
::cast(str), pretenure); } // UTF8 strings are pretenured when used for regexp literal patterns and // flags in the parser. Handle
NewStringFromUtf8( Vector
str, PretenureFlag pretenure = NOT_TENURED); Handle
NewStringFromTwoByte( Vector
str, PretenureFlag pretenure = NOT_TENURED); // Allocates and partially initializes an ASCII or TwoByte String. The // characters of the string are uninitialized. Currently used in regexp code // only, where they are pretenured. Handle
NewRawOneByteString( int length, PretenureFlag pretenure = NOT_TENURED); Handle
NewRawTwoByteString( int length, PretenureFlag pretenure = NOT_TENURED); // Create a new cons string object which consists of a pair of strings. Handle
NewConsString(Handle
first, Handle
second); // Create a new sequential string containing the concatenation of the inputs. Handle
NewFlatConcatString(Handle
first, Handle
second); // Create a new string object which holds a substring of a string. Handle
NewSubString(Handle
str, int begin, int end); // Create a new string object which holds a proper substring of a string. Handle
NewProperSubString(Handle
str, int begin, int end); // Creates a new external String object. There are two String encodings // in the system: ASCII and two byte. Unlike other String types, it does // not make sense to have a UTF-8 factory function for external strings, // because we cannot change the underlying buffer. Handle
NewExternalStringFromAscii( const ExternalAsciiString::Resource* resource); Handle
NewExternalStringFromTwoByte( const ExternalTwoByteString::Resource* resource); // Create a symbol. Handle
NewSymbol(); Handle
NewPrivateSymbol(); // Create a global (but otherwise uninitialized) context. Handle
NewNativeContext(); // Create a global context. Handle
NewGlobalContext(Handle
function, Handle
scope_info); // Create a module context. Handle
NewModuleContext(Handle
scope_info); // Create a function context. Handle
NewFunctionContext(int length, Handle
function); // Create a catch context. Handle
NewCatchContext(Handle
function, Handle
previous, Handle
name, Handle
thrown_object); // Create a 'with' context. Handle
NewWithContext(Handle
function, Handle
previous, Handle
extension); // Create a block context. Handle
NewBlockContext(Handle
function, Handle
previous, Handle
scope_info); // Return the internalized version of the passed in string. Handle
InternalizedStringFromString(Handle
value); // Allocate a new struct. The struct is pretenured (allocated directly in // the old generation). Handle
NewStruct(InstanceType type); Handle
NewAliasedArgumentsEntry( int aliased_context_slot); Handle
NewDeclaredAccessorDescriptor(); Handle
NewDeclaredAccessorInfo(); Handle
NewExecutableAccessorInfo(); Handle
登录后可以享受更多权益
您还没有登录,登录后您可以:
收藏Android系统代码
收藏喜欢的文章
多个平台共享账号
去登录
首次使用?从这里
注册