HELLO·Android
系统源代码
IT资讯
技术文章
我的收藏
注册
登录
-
我收藏的文章
创建代码块
我的代码块
我的账号
Gingerbread MR1
|
2.3.7_r1
下载
查看原文件
收藏
根目录
external
v8
src
factory.h
// Copyright 2006-2008 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 "heap.h" #include "zone-inl.h" namespace v8 { namespace internal { // Interface for handle based allocation. class Factory : public AllStatic { public: // Allocate a new fixed array with undefined entries. static Handle
NewFixedArray( int size, PretenureFlag pretenure = NOT_TENURED); // Allocate a new fixed array with non-existing entries (the hole). static Handle
NewFixedArrayWithHoles(int size); static Handle
NewNumberDictionary(int at_least_space_for); static Handle
NewStringDictionary(int at_least_space_for); static Handle
NewDescriptorArray(int number_of_descriptors); static Handle
LookupSymbol(Vector
str); static Handle
LookupAsciiSymbol(const char* str) { return LookupSymbol(CStrVector(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. static Handle
NewStringFromAscii( Vector
str, PretenureFlag pretenure = NOT_TENURED); // UTF8 strings are pretenured when used for regexp literal patterns and // flags in the parser. static Handle
NewStringFromUtf8( Vector
str, PretenureFlag pretenure = NOT_TENURED); static Handle
NewStringFromTwoByte(Vector
str, PretenureFlag pretenure = NOT_TENURED); // Allocates and partially initializes a TwoByte String. The characters of // the string are uninitialized. Currently used in regexp code only, where // they are pretenured. static Handle
NewRawTwoByteString( int length, PretenureFlag pretenure = NOT_TENURED); // Create a new cons string object which consists of a pair of strings. static Handle
NewConsString(Handle
first, Handle
second); // Create a new string object which holds a substring of a string. static Handle
NewSubString(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. static Handle
NewExternalStringFromAscii( ExternalAsciiString::Resource* resource); static Handle
NewExternalStringFromTwoByte( ExternalTwoByteString::Resource* resource); // Create a global (but otherwise uninitialized) context. static Handle
NewGlobalContext(); // Create a function context. static Handle
NewFunctionContext(int length, Handle
closure); // Create a 'with' context. static Handle
NewWithContext(Handle
previous, Handle
extension, bool is_catch_context); // Return the Symbol matching the passed in string. static Handle
SymbolFromString(Handle
value); // Allocate a new struct. The struct is pretenured (allocated directly in // the old generation). static Handle
NewStruct(InstanceType type); static Handle
NewAccessorInfo(); static Handle
登录后可以享受更多权益
您还没有登录,登录后您可以:
收藏Android系统代码
收藏喜欢的文章
多个平台共享账号
去登录
首次使用?从这里
注册