danno@chromium.org | fa458e4 | 2012-02-01 10:48:36 +0000 | [diff] [blame] | 1 | // Copyright 2012 the V8 project authors. All rights reserved. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 2 | // Redistribution and use in source and binary forms, with or without |
| 3 | // modification, are permitted provided that the following conditions are |
| 4 | // met: |
| 5 | // |
| 6 | // * Redistributions of source code must retain the above copyright |
| 7 | // notice, this list of conditions and the following disclaimer. |
| 8 | // * Redistributions in binary form must reproduce the above |
| 9 | // copyright notice, this list of conditions and the following |
| 10 | // disclaimer in the documentation and/or other materials provided |
| 11 | // with the distribution. |
| 12 | // * Neither the name of Google Inc. nor the names of its |
| 13 | // contributors may be used to endorse or promote products derived |
| 14 | // from this software without specific prior written permission. |
| 15 | // |
| 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | |
| 28 | #ifndef V8_FACTORY_H_ |
| 29 | #define V8_FACTORY_H_ |
| 30 | |
kasperl@chromium.org | 68ac009 | 2009-07-09 06:00:35 +0000 | [diff] [blame] | 31 | #include "globals.h" |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 32 | #include "handles.h" |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 33 | #include "heap.h" |
| 34 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 35 | namespace v8 { |
| 36 | namespace internal { |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 37 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 38 | // Interface for handle based allocation. |
| 39 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 40 | class Factory { |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 41 | public: |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 42 | // Allocate a new uninitialized fixed array. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 43 | Handle<FixedArray> NewFixedArray( |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 44 | int size, |
| 45 | PretenureFlag pretenure = NOT_TENURED); |
| 46 | |
kasperl@chromium.org | 9bbf968 | 2008-10-30 11:53:07 +0000 | [diff] [blame] | 47 | // Allocate a new fixed array with non-existing entries (the hole). |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 48 | Handle<FixedArray> NewFixedArrayWithHoles( |
ricow@chromium.org | c9c8082 | 2010-04-21 08:22:37 +0000 | [diff] [blame] | 49 | int size, |
| 50 | PretenureFlag pretenure = NOT_TENURED); |
kasperl@chromium.org | 9bbf968 | 2008-10-30 11:53:07 +0000 | [diff] [blame] | 51 | |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 52 | // Allocate a new uninitialized fixed double array. |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 53 | Handle<FixedDoubleArray> NewFixedDoubleArray( |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 54 | int size, |
| 55 | PretenureFlag pretenure = NOT_TENURED); |
| 56 | |
erik.corry@gmail.com | f2038fb | 2012-01-16 11:42:08 +0000 | [diff] [blame] | 57 | Handle<SeededNumberDictionary> NewSeededNumberDictionary( |
| 58 | int at_least_space_for); |
| 59 | |
| 60 | Handle<UnseededNumberDictionary> NewUnseededNumberDictionary( |
| 61 | int at_least_space_for); |
kasperl@chromium.org | 86f77b7 | 2009-07-06 08:21:57 +0000 | [diff] [blame] | 62 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 63 | Handle<StringDictionary> NewStringDictionary(int at_least_space_for); |
kasperl@chromium.org | 9bbf968 | 2008-10-30 11:53:07 +0000 | [diff] [blame] | 64 | |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 65 | Handle<ObjectHashSet> NewObjectHashSet(int at_least_space_for); |
| 66 | |
vegorov@chromium.org | 7943d46 | 2011-08-01 11:41:52 +0000 | [diff] [blame] | 67 | Handle<ObjectHashTable> NewObjectHashTable(int at_least_space_for); |
| 68 | |
verwaest@chromium.org | 33e09c8 | 2012-10-10 17:07:22 +0000 | [diff] [blame] | 69 | Handle<DescriptorArray> NewDescriptorArray(int number_of_descriptors, |
| 70 | int slack = 0); |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 71 | Handle<DeoptimizationInputData> NewDeoptimizationInputData( |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 72 | int deopt_entry_count, |
| 73 | PretenureFlag pretenure); |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 74 | Handle<DeoptimizationOutputData> NewDeoptimizationOutputData( |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 75 | int deopt_entry_count, |
| 76 | PretenureFlag pretenure); |
erik.corry@gmail.com | f2038fb | 2012-01-16 11:42:08 +0000 | [diff] [blame] | 77 | // Allocates a pre-tenured empty AccessorPair. |
| 78 | Handle<AccessorPair> NewAccessorPair(); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 79 | |
jkummerow@chromium.org | f7a5884 | 2012-02-21 10:08:21 +0000 | [diff] [blame] | 80 | Handle<TypeFeedbackInfo> NewTypeFeedbackInfo(); |
| 81 | |
yangguo@chromium.org | 4a9f655 | 2013-03-04 14:46:33 +0000 | [diff] [blame^] | 82 | Handle<String> InternalizeUtf8String(Vector<const char> str); |
| 83 | Handle<String> InternalizeUtf8String(const char* str) { |
| 84 | return InternalizeUtf8String(CStrVector(str)); |
yangguo@chromium.org | a6bbcc8 | 2012-12-21 12:35:02 +0000 | [diff] [blame] | 85 | } |
yangguo@chromium.org | 4a9f655 | 2013-03-04 14:46:33 +0000 | [diff] [blame^] | 86 | Handle<String> InternalizeString(Handle<String> str); |
| 87 | Handle<String> InternalizeOneByteString(Vector<const uint8_t> str); |
| 88 | Handle<String> InternalizeOneByteString(Handle<SeqOneByteString>, |
danno@chromium.org | 40cb878 | 2011-05-25 07:58:50 +0000 | [diff] [blame] | 89 | int from, |
| 90 | int length); |
yangguo@chromium.org | 4a9f655 | 2013-03-04 14:46:33 +0000 | [diff] [blame^] | 91 | Handle<String> InternalizeTwoByteString(Vector<const uc16> str); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 92 | |
| 93 | |
| 94 | // String creation functions. Most of the string creation functions take |
| 95 | // a Heap::PretenureFlag argument to optionally request that they be |
| 96 | // allocated in the old generation. The pretenure flag defaults to |
| 97 | // DONT_TENURE. |
| 98 | // |
| 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 |
| 101 | // based on the encoding of the string buffer that the string is |
| 102 | // initialized from. |
| 103 | // - ...FromAscii initializes the string from a buffer that is ASCII |
| 104 | // encoded (it does not check that the buffer is ASCII encoded) and |
| 105 | // the result will be ASCII encoded. |
| 106 | // - ...FromUtf8 initializes the string from a buffer that is UTF-8 |
| 107 | // encoded. If the characters are all single-byte characters, the |
| 108 | // result will be ASCII encoded, otherwise it will converted to two |
| 109 | // byte. |
| 110 | // - ...FromTwoByte initializes the string from a buffer that is two |
| 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 |
| 113 | // two byte. |
| 114 | // |
| 115 | // ASCII strings are pretenured when used as keys in the SourceCodeCache. |
jkummerow@chromium.org | 59297c7 | 2013-01-09 16:32:23 +0000 | [diff] [blame] | 116 | Handle<String> NewStringFromOneByte( |
| 117 | Vector<const uint8_t> str, |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 118 | PretenureFlag pretenure = NOT_TENURED); |
jkummerow@chromium.org | 59297c7 | 2013-01-09 16:32:23 +0000 | [diff] [blame] | 119 | // TODO(dcarney): remove this function. |
| 120 | inline Handle<String> NewStringFromAscii( |
| 121 | Vector<const char> str, |
| 122 | PretenureFlag pretenure = NOT_TENURED) { |
| 123 | return NewStringFromOneByte(Vector<const uint8_t>::cast(str), pretenure); |
| 124 | } |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 125 | |
| 126 | // UTF8 strings are pretenured when used for regexp literal patterns and |
| 127 | // flags in the parser. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 128 | Handle<String> NewStringFromUtf8( |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 129 | Vector<const char> str, |
| 130 | PretenureFlag pretenure = NOT_TENURED); |
| 131 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 132 | Handle<String> NewStringFromTwoByte( |
erik.corry@gmail.com | 4a2e25e | 2010-07-07 12:22:46 +0000 | [diff] [blame] | 133 | Vector<const uc16> str, |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 134 | PretenureFlag pretenure = NOT_TENURED); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 135 | |
erik.corry@gmail.com | 4a2e25e | 2010-07-07 12:22:46 +0000 | [diff] [blame] | 136 | // Allocates and partially initializes an ASCII or TwoByte String. The |
| 137 | // characters of the string are uninitialized. Currently used in regexp code |
| 138 | // only, where they are pretenured. |
yangguo@chromium.org | fb37721 | 2012-11-16 14:43:43 +0000 | [diff] [blame] | 139 | Handle<SeqOneByteString> NewRawOneByteString( |
erik.corry@gmail.com | 4a2e25e | 2010-07-07 12:22:46 +0000 | [diff] [blame] | 140 | int length, |
| 141 | PretenureFlag pretenure = NOT_TENURED); |
ager@chromium.org | 04921a8 | 2011-06-27 13:21:41 +0000 | [diff] [blame] | 142 | Handle<SeqTwoByteString> NewRawTwoByteString( |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 143 | int length, |
| 144 | PretenureFlag pretenure = NOT_TENURED); |
| 145 | |
| 146 | // Create a new cons string object which consists of a pair of strings. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 147 | Handle<String> NewConsString(Handle<String> first, |
| 148 | Handle<String> second); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 149 | |
ager@chromium.org | c4c9272 | 2009-11-18 14:12:51 +0000 | [diff] [blame] | 150 | // Create a new string object which holds a substring of a string. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 151 | Handle<String> NewSubString(Handle<String> str, |
| 152 | int begin, |
| 153 | int end); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 154 | |
ager@chromium.org | 04921a8 | 2011-06-27 13:21:41 +0000 | [diff] [blame] | 155 | // Create a new string object which holds a proper substring of a string. |
| 156 | Handle<String> NewProperSubString(Handle<String> str, |
| 157 | int begin, |
| 158 | int end); |
| 159 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 160 | // Creates a new external String object. There are two String encodings |
| 161 | // in the system: ASCII and two byte. Unlike other String types, it does |
| 162 | // not make sense to have a UTF-8 factory function for external strings, |
| 163 | // because we cannot change the underlying buffer. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 164 | Handle<String> NewExternalStringFromAscii( |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 165 | const ExternalAsciiString::Resource* resource); |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 166 | Handle<String> NewExternalStringFromTwoByte( |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 167 | const ExternalTwoByteString::Resource* resource); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 168 | |
yangguo@chromium.org | 4a9f655 | 2013-03-04 14:46:33 +0000 | [diff] [blame^] | 169 | // Create a symbol. |
| 170 | Handle<Symbol> NewSymbol(); |
| 171 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 172 | // Create a global (but otherwise uninitialized) context. |
yangguo@chromium.org | 46839fb | 2012-08-28 09:06:19 +0000 | [diff] [blame] | 173 | Handle<Context> NewNativeContext(); |
| 174 | |
| 175 | // Create a global context. |
| 176 | Handle<Context> NewGlobalContext(Handle<JSFunction> function, |
| 177 | Handle<ScopeInfo> scope_info); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 178 | |
erik.corry@gmail.com | ed49e96 | 2012-04-17 11:57:53 +0000 | [diff] [blame] | 179 | // Create a module context. |
danno@chromium.org | 81cac2b | 2012-07-10 11:28:27 +0000 | [diff] [blame] | 180 | Handle<Context> NewModuleContext(Handle<ScopeInfo> scope_info); |
erik.corry@gmail.com | ed49e96 | 2012-04-17 11:57:53 +0000 | [diff] [blame] | 181 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 182 | // Create a function context. |
erik.corry@gmail.com | ed49e96 | 2012-04-17 11:57:53 +0000 | [diff] [blame] | 183 | Handle<Context> NewFunctionContext(int length, Handle<JSFunction> function); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 184 | |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 185 | // Create a catch context. |
vegorov@chromium.org | 3cf4731 | 2011-06-29 13:20:01 +0000 | [diff] [blame] | 186 | Handle<Context> NewCatchContext(Handle<JSFunction> function, |
| 187 | Handle<Context> previous, |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 188 | Handle<String> name, |
| 189 | Handle<Object> thrown_object); |
| 190 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 191 | // Create a 'with' context. |
vegorov@chromium.org | 3cf4731 | 2011-06-29 13:20:01 +0000 | [diff] [blame] | 192 | Handle<Context> NewWithContext(Handle<JSFunction> function, |
| 193 | Handle<Context> previous, |
svenpanne@chromium.org | 6d786c9 | 2011-06-15 10:58:27 +0000 | [diff] [blame] | 194 | Handle<JSObject> extension); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 195 | |
erik.corry@gmail.com | ed49e96 | 2012-04-17 11:57:53 +0000 | [diff] [blame] | 196 | // Create a block context. |
whesse@chromium.org | 4acdc2c | 2011-08-15 13:01:23 +0000 | [diff] [blame] | 197 | Handle<Context> NewBlockContext(Handle<JSFunction> function, |
| 198 | Handle<Context> previous, |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 199 | Handle<ScopeInfo> scope_info); |
whesse@chromium.org | 4acdc2c | 2011-08-15 13:01:23 +0000 | [diff] [blame] | 200 | |
yangguo@chromium.org | 4a9f655 | 2013-03-04 14:46:33 +0000 | [diff] [blame^] | 201 | // Return the internalized version of the passed in string. |
| 202 | Handle<String> InternalizedStringFromString(Handle<String> value); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 203 | |
| 204 | // Allocate a new struct. The struct is pretenured (allocated directly in |
| 205 | // the old generation). |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 206 | Handle<Struct> NewStruct(InstanceType type); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 207 | |
hpayer@chromium.org | 7c3372b | 2013-02-13 17:26:04 +0000 | [diff] [blame] | 208 | Handle<DeclaredAccessorInfo> NewDeclaredAccessorInfo(); |
| 209 | |
| 210 | Handle<ExecutableAccessorInfo> NewExecutableAccessorInfo(); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 211 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 212 | Handle<Script> NewScript(Handle<String> source); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 213 | |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 214 | // Foreign objects are pretenured when allocated by the bootstrapper. |
| 215 | Handle<Foreign> NewForeign(Address addr, |
| 216 | PretenureFlag pretenure = NOT_TENURED); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 217 | |
ager@chromium.org | ea91cc5 | 2011-05-23 06:06:11 +0000 | [diff] [blame] | 218 | // Allocate a new foreign object. The foreign is pretenured (allocated |
| 219 | // directly in the old generation). |
| 220 | Handle<Foreign> NewForeign(const AccessorDescriptor* foreign); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 221 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 222 | Handle<ByteArray> NewByteArray(int length, |
| 223 | PretenureFlag pretenure = NOT_TENURED); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 224 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 225 | Handle<ExternalArray> NewExternalArray( |
ager@chromium.org | 3811b43 | 2009-10-28 14:53:37 +0000 | [diff] [blame] | 226 | int length, |
| 227 | ExternalArrayType array_type, |
| 228 | void* external_pointer, |
| 229 | PretenureFlag pretenure = NOT_TENURED); |
| 230 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 231 | Handle<JSGlobalPropertyCell> NewJSGlobalPropertyCell( |
kasperl@chromium.org | a555126 | 2010-12-07 12:49:48 +0000 | [diff] [blame] | 232 | Handle<Object> value); |
| 233 | |
svenpanne@chromium.org | 830d30c | 2012-05-29 13:20:14 +0000 | [diff] [blame] | 234 | Handle<Map> NewMap( |
| 235 | InstanceType type, |
| 236 | int instance_size, |
| 237 | ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 238 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 239 | Handle<JSObject> NewFunctionPrototype(Handle<JSFunction> function); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 240 | |
rossberg@chromium.org | 657d53b | 2012-07-12 11:06:03 +0000 | [diff] [blame] | 241 | Handle<Map> CopyWithPreallocatedFieldDescriptors(Handle<Map> map); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 242 | |
ager@chromium.org | 3291210 | 2009-01-16 10:38:43 +0000 | [diff] [blame] | 243 | // Copy the map adding more inobject properties if possible without |
| 244 | // overflowing the instance size. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 245 | Handle<Map> CopyMap(Handle<Map> map, int extra_inobject_props); |
verwaest@chromium.org | 753aee4 | 2012-07-17 16:15:42 +0000 | [diff] [blame] | 246 | Handle<Map> CopyMap(Handle<Map> map); |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 247 | |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 248 | Handle<Map> GetElementsTransitionMap(Handle<JSObject> object, |
| 249 | ElementsKind elements_kind); |
sgjesse@chromium.org | 496c03a | 2011-02-14 12:05:43 +0000 | [diff] [blame] | 250 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 251 | Handle<FixedArray> CopyFixedArray(Handle<FixedArray> array); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 252 | |
yangguo@chromium.org | eeb44b6 | 2012-11-13 13:56:09 +0000 | [diff] [blame] | 253 | Handle<FixedArray> CopySizeFixedArray(Handle<FixedArray> array, |
| 254 | int new_length); |
| 255 | |
erik.corry@gmail.com | 394dbcf | 2011-10-27 07:38:48 +0000 | [diff] [blame] | 256 | Handle<FixedDoubleArray> CopyFixedDoubleArray( |
| 257 | Handle<FixedDoubleArray> array); |
| 258 | |
ulan@chromium.org | 2efb900 | 2012-01-19 15:36:35 +0000 | [diff] [blame] | 259 | // Numbers (e.g. literals) are pretenured by the parser. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 260 | Handle<Object> NewNumber(double value, |
| 261 | PretenureFlag pretenure = NOT_TENURED); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 262 | |
erikcorry | 0ad885c | 2011-11-21 13:51:57 +0000 | [diff] [blame] | 263 | Handle<Object> NewNumberFromInt(int32_t value, |
| 264 | PretenureFlag pretenure = NOT_TENURED); |
| 265 | Handle<Object> NewNumberFromUint(uint32_t value, |
| 266 | PretenureFlag pretenure = NOT_TENURED); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 267 | |
| 268 | // These objects are used by the api to create env-independent data |
| 269 | // structures in the heap. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 270 | Handle<JSObject> NewNeanderObject(); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 271 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 272 | Handle<JSObject> NewArgumentsObject(Handle<Object> callee, int length); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 273 | |
| 274 | // JS objects are pretenured when allocated by the bootstrapper and |
| 275 | // runtime. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 276 | Handle<JSObject> NewJSObject(Handle<JSFunction> constructor, |
| 277 | PretenureFlag pretenure = NOT_TENURED); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 278 | |
kasperl@chromium.org | 2abc450 | 2009-07-02 07:00:29 +0000 | [diff] [blame] | 279 | // Global objects are pretenured. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 280 | Handle<GlobalObject> NewGlobalObject(Handle<JSFunction> constructor); |
kasperl@chromium.org | 2abc450 | 2009-07-02 07:00:29 +0000 | [diff] [blame] | 281 | |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 282 | // JS objects are pretenured when allocated by the bootstrapper and |
| 283 | // runtime. |
mstarzinger@chromium.org | 71fc346 | 2013-02-27 09:34:27 +0000 | [diff] [blame] | 284 | Handle<JSObject> NewJSObjectFromMap(Handle<Map> map, |
| 285 | PretenureFlag pretenure = NOT_TENURED); |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 286 | |
erik.corry@gmail.com | ed49e96 | 2012-04-17 11:57:53 +0000 | [diff] [blame] | 287 | // JS modules are pretenured. |
danno@chromium.org | 81cac2b | 2012-07-10 11:28:27 +0000 | [diff] [blame] | 288 | Handle<JSModule> NewJSModule(Handle<Context> context, |
| 289 | Handle<ScopeInfo> scope_info); |
erik.corry@gmail.com | ed49e96 | 2012-04-17 11:57:53 +0000 | [diff] [blame] | 290 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 291 | // JS arrays are pretenured when allocated by the parser. |
svenpanne@chromium.org | 830d30c | 2012-05-29 13:20:14 +0000 | [diff] [blame] | 292 | Handle<JSArray> NewJSArray( |
| 293 | int capacity, |
| 294 | ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND, |
| 295 | PretenureFlag pretenure = NOT_TENURED); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 296 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 297 | Handle<JSArray> NewJSArrayWithElements( |
ricow@chromium.org | 64e3a4b | 2011-12-13 08:07:27 +0000 | [diff] [blame] | 298 | Handle<FixedArrayBase> elements, |
svenpanne@chromium.org | 830d30c | 2012-05-29 13:20:14 +0000 | [diff] [blame] | 299 | ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND, |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 300 | PretenureFlag pretenure = NOT_TENURED); |
| 301 | |
ricow@chromium.org | 64e3a4b | 2011-12-13 08:07:27 +0000 | [diff] [blame] | 302 | void SetElementsCapacityAndLength(Handle<JSArray> array, |
| 303 | int capacity, |
| 304 | int length); |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 305 | |
ricow@chromium.org | 64e3a4b | 2011-12-13 08:07:27 +0000 | [diff] [blame] | 306 | void SetContent(Handle<JSArray> array, Handle<FixedArrayBase> elements); |
| 307 | |
| 308 | void EnsureCanContainHeapObjectElements(Handle<JSArray> array); |
| 309 | void EnsureCanContainElements(Handle<JSArray> array, |
| 310 | Handle<FixedArrayBase> elements, |
svenpanne@chromium.org | 830d30c | 2012-05-29 13:20:14 +0000 | [diff] [blame] | 311 | uint32_t length, |
ricow@chromium.org | 64e3a4b | 2011-12-13 08:07:27 +0000 | [diff] [blame] | 312 | EnsureElementsMode mode); |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 313 | |
vegorov@chromium.org | 7304bca | 2011-05-16 12:14:13 +0000 | [diff] [blame] | 314 | Handle<JSProxy> NewJSProxy(Handle<Object> handler, Handle<Object> prototype); |
| 315 | |
lrn@chromium.org | 34e6078 | 2011-09-15 07:25:40 +0000 | [diff] [blame] | 316 | // Change the type of the argument into a JS object/function and reinitialize. |
| 317 | void BecomeJSObject(Handle<JSReceiver> object); |
| 318 | void BecomeJSFunction(Handle<JSReceiver> object); |
rossberg@chromium.org | 717967f | 2011-07-20 13:44:42 +0000 | [diff] [blame] | 319 | |
jkummerow@chromium.org | 000f7fb | 2012-08-01 11:14:42 +0000 | [diff] [blame] | 320 | void SetIdentityHash(Handle<JSObject> object, Smi* hash); |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 321 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 322 | Handle<JSFunction> NewFunction(Handle<String> name, |
| 323 | Handle<Object> prototype); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 324 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 325 | Handle<JSFunction> NewFunctionWithoutPrototype( |
| 326 | Handle<String> name, |
mstarzinger@chromium.org | 1b3afd1 | 2011-11-29 14:28:56 +0000 | [diff] [blame] | 327 | LanguageMode language_mode); |
kmillikin@chromium.org | 4111b80 | 2010-05-03 10:34:42 +0000 | [diff] [blame] | 328 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 329 | Handle<JSFunction> NewFunction(Handle<Object> super, bool is_global); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 330 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 331 | Handle<JSFunction> BaseNewFunctionFromSharedFunctionInfo( |
kmillikin@chromium.org | 5d8f0e6 | 2010-03-24 08:21:20 +0000 | [diff] [blame] | 332 | Handle<SharedFunctionInfo> function_info, |
| 333 | Handle<Map> function_map, |
| 334 | PretenureFlag pretenure); |
| 335 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 336 | Handle<JSFunction> NewFunctionFromSharedFunctionInfo( |
kmillikin@chromium.org | 5d8f0e6 | 2010-03-24 08:21:20 +0000 | [diff] [blame] | 337 | Handle<SharedFunctionInfo> function_info, |
sgjesse@chromium.org | 846fb74 | 2009-12-18 08:56:33 +0000 | [diff] [blame] | 338 | Handle<Context> context, |
| 339 | PretenureFlag pretenure = TENURED); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 340 | |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 341 | Handle<ScopeInfo> NewScopeInfo(int length); |
whesse@chromium.org | 4acdc2c | 2011-08-15 13:01:23 +0000 | [diff] [blame] | 342 | |
yangguo@chromium.org | eeb44b6 | 2012-11-13 13:56:09 +0000 | [diff] [blame] | 343 | Handle<JSObject> NewExternal(void* value); |
| 344 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 345 | Handle<Code> NewCode(const CodeDesc& desc, |
| 346 | Code::Flags flags, |
| 347 | Handle<Object> self_reference, |
| 348 | bool immovable = false); |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 349 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 350 | Handle<Code> CopyCode(Handle<Code> code); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 351 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 352 | Handle<Code> CopyCode(Handle<Code> code, Vector<byte> reloc_info); |
fschneider@chromium.org | 086aac6 | 2010-03-17 13:18:24 +0000 | [diff] [blame] | 353 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 354 | Handle<Object> ToObject(Handle<Object> object); |
| 355 | Handle<Object> ToObject(Handle<Object> object, |
yangguo@chromium.org | 46839fb | 2012-08-28 09:06:19 +0000 | [diff] [blame] | 356 | Handle<Context> native_context); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 357 | |
| 358 | // Interface for creating error objects. |
| 359 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 360 | Handle<Object> NewError(const char* maker, const char* type, |
| 361 | Handle<JSArray> args); |
verwaest@chromium.org | 3714139 | 2012-05-31 13:27:02 +0000 | [diff] [blame] | 362 | Handle<String> EmergencyNewError(const char* type, Handle<JSArray> args); |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 363 | Handle<Object> NewError(const char* maker, const char* type, |
| 364 | Vector< Handle<Object> > args); |
| 365 | Handle<Object> NewError(const char* type, |
| 366 | Vector< Handle<Object> > args); |
| 367 | Handle<Object> NewError(Handle<String> message); |
| 368 | Handle<Object> NewError(const char* constructor, |
| 369 | Handle<String> message); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 370 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 371 | Handle<Object> NewTypeError(const char* type, |
| 372 | Vector< Handle<Object> > args); |
| 373 | Handle<Object> NewTypeError(Handle<String> message); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 374 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 375 | Handle<Object> NewRangeError(const char* type, |
| 376 | Vector< Handle<Object> > args); |
| 377 | Handle<Object> NewRangeError(Handle<String> message); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 378 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 379 | Handle<Object> NewSyntaxError(const char* type, Handle<JSArray> args); |
| 380 | Handle<Object> NewSyntaxError(Handle<String> message); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 381 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 382 | Handle<Object> NewReferenceError(const char* type, |
| 383 | Vector< Handle<Object> > args); |
| 384 | Handle<Object> NewReferenceError(Handle<String> message); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 385 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 386 | Handle<Object> NewEvalError(const char* type, |
| 387 | Vector< Handle<Object> > args); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 388 | |
| 389 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 390 | Handle<JSFunction> NewFunction(Handle<String> name, |
| 391 | InstanceType type, |
| 392 | int instance_size, |
| 393 | Handle<Code> code, |
| 394 | bool force_initial_map); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 395 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 396 | Handle<JSFunction> NewFunction(Handle<Map> function_map, |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 397 | Handle<SharedFunctionInfo> shared, Handle<Object> prototype); |
| 398 | |
| 399 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 400 | Handle<JSFunction> NewFunctionWithPrototype(Handle<String> name, |
| 401 | InstanceType type, |
| 402 | int instance_size, |
| 403 | Handle<JSObject> prototype, |
| 404 | Handle<Code> code, |
| 405 | bool force_initial_map); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 406 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 407 | Handle<JSFunction> NewFunctionWithoutPrototype(Handle<String> name, |
| 408 | Handle<Code> code); |
kmillikin@chromium.org | 4111b80 | 2010-05-03 10:34:42 +0000 | [diff] [blame] | 409 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 410 | Handle<String> NumberToString(Handle<Object> number); |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 411 | Handle<String> Uint32ToString(uint32_t value); |
sgjesse@chromium.org | c514574 | 2009-10-07 09:00:33 +0000 | [diff] [blame] | 412 | |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 413 | enum ApiInstanceType { |
| 414 | JavaScriptObject, |
| 415 | InnerGlobalObject, |
| 416 | OuterGlobalObject |
| 417 | }; |
| 418 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 419 | Handle<JSFunction> CreateApiFunction( |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 420 | Handle<FunctionTemplateInfo> data, |
| 421 | ApiInstanceType type = JavaScriptObject); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 422 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 423 | Handle<JSFunction> InstallMembers(Handle<JSFunction> function); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 424 | |
| 425 | // Installs interceptors on the instance. 'desc' is a function template, |
| 426 | // and instance is an object instance created by the function of this |
ager@chromium.org | 3291210 | 2009-01-16 10:38:43 +0000 | [diff] [blame] | 427 | // function template. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 428 | void ConfigureInstance(Handle<FunctionTemplateInfo> desc, |
| 429 | Handle<JSObject> instance, |
| 430 | bool* pending_exception); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 431 | |
kasperl@chromium.org | 68ac009 | 2009-07-09 06:00:35 +0000 | [diff] [blame] | 432 | #define ROOT_ACCESSOR(type, name, camel_name) \ |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 433 | inline Handle<type> name() { \ |
vegorov@chromium.org | 26c16f8 | 2010-08-11 13:41:03 +0000 | [diff] [blame] | 434 | return Handle<type>(BitCast<type**>( \ |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 435 | &isolate()->heap()->roots_[Heap::k##camel_name##RootIndex])); \ |
kasperl@chromium.org | 68ac009 | 2009-07-09 06:00:35 +0000 | [diff] [blame] | 436 | } |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 437 | ROOT_LIST(ROOT_ACCESSOR) |
| 438 | #undef ROOT_ACCESSOR_ACCESSOR |
| 439 | |
yangguo@chromium.org | 4a9f655 | 2013-03-04 14:46:33 +0000 | [diff] [blame^] | 440 | #define STRING_ACCESSOR(name, str) \ |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 441 | inline Handle<String> name() { \ |
vegorov@chromium.org | 26c16f8 | 2010-08-11 13:41:03 +0000 | [diff] [blame] | 442 | return Handle<String>(BitCast<String**>( \ |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 443 | &isolate()->heap()->roots_[Heap::k##name##RootIndex])); \ |
kasperl@chromium.org | 68ac009 | 2009-07-09 06:00:35 +0000 | [diff] [blame] | 444 | } |
yangguo@chromium.org | 4a9f655 | 2013-03-04 14:46:33 +0000 | [diff] [blame^] | 445 | INTERNALIZED_STRING_LIST(STRING_ACCESSOR) |
| 446 | #undef STRING_ACCESSOR |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 447 | |
yangguo@chromium.org | 4a9f655 | 2013-03-04 14:46:33 +0000 | [diff] [blame^] | 448 | Handle<String> hidden_string() { |
| 449 | return Handle<String>(&isolate()->heap()->hidden_string_); |
ager@chromium.org | 3b45ab5 | 2009-03-19 22:21:34 +0000 | [diff] [blame] | 450 | } |
| 451 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 452 | Handle<SharedFunctionInfo> NewSharedFunctionInfo( |
ager@chromium.org | 6a2b0aa | 2010-07-13 20:58:03 +0000 | [diff] [blame] | 453 | Handle<String> name, |
| 454 | int number_of_literals, |
| 455 | Handle<Code> code, |
jkummerow@chromium.org | c3b3712 | 2011-11-07 10:14:12 +0000 | [diff] [blame] | 456 | Handle<ScopeInfo> scope_info); |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 457 | Handle<SharedFunctionInfo> NewSharedFunctionInfo(Handle<String> name); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 458 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 459 | Handle<JSMessageObject> NewJSMessageObject( |
kmillikin@chromium.org | 31b1277 | 2011-02-02 16:08:26 +0000 | [diff] [blame] | 460 | Handle<String> type, |
| 461 | Handle<JSArray> arguments, |
| 462 | int start_position, |
| 463 | int end_position, |
| 464 | Handle<Object> script, |
| 465 | Handle<Object> stack_trace, |
| 466 | Handle<Object> stack_frames); |
| 467 | |
erik.corry@gmail.com | f2038fb | 2012-01-16 11:42:08 +0000 | [diff] [blame] | 468 | Handle<SeededNumberDictionary> DictionaryAtNumberPut( |
| 469 | Handle<SeededNumberDictionary>, |
| 470 | uint32_t key, |
| 471 | Handle<Object> value); |
| 472 | |
| 473 | Handle<UnseededNumberDictionary> DictionaryAtNumberPut( |
| 474 | Handle<UnseededNumberDictionary>, |
kasperl@chromium.org | 86f77b7 | 2009-07-06 08:21:57 +0000 | [diff] [blame] | 475 | uint32_t key, |
| 476 | Handle<Object> value); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 477 | |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 478 | #ifdef ENABLE_DEBUGGER_SUPPORT |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 479 | Handle<DebugInfo> NewDebugInfo(Handle<SharedFunctionInfo> shared); |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 480 | #endif |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 481 | |
yangguo@chromium.org | 46839fb | 2012-08-28 09:06:19 +0000 | [diff] [blame] | 482 | // Return a map using the map cache in the native context. |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 483 | // The key the an ordered set of property names. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 484 | Handle<Map> ObjectLiteralMapFromCache(Handle<Context> context, |
| 485 | Handle<FixedArray> keys); |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 486 | |
kasperl@chromium.org | 9fe21c6 | 2008-10-28 08:53:51 +0000 | [diff] [blame] | 487 | // Creates a new FixedArray that holds the data associated with the |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 488 | // atom regexp and stores it in the regexp. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 489 | void SetRegExpAtomData(Handle<JSRegExp> regexp, |
| 490 | JSRegExp::Type type, |
| 491 | Handle<String> source, |
| 492 | JSRegExp::Flags flags, |
| 493 | Handle<Object> match_pattern); |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 494 | |
| 495 | // Creates a new FixedArray that holds the data associated with the |
| 496 | // irregexp regexp and stores it in the regexp. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 497 | void SetRegExpIrregexpData(Handle<JSRegExp> regexp, |
| 498 | JSRegExp::Type type, |
| 499 | Handle<String> source, |
| 500 | JSRegExp::Flags flags, |
| 501 | int capture_count); |
kasperl@chromium.org | 9fe21c6 | 2008-10-28 08:53:51 +0000 | [diff] [blame] | 502 | |
erik.corry@gmail.com | c3b670f | 2011-10-05 21:44:48 +0000 | [diff] [blame] | 503 | // Returns the value for a known global constant (a property of the global |
| 504 | // object which is neither configurable nor writable) like 'undefined'. |
| 505 | // Returns a null handle when the given name is unknown. |
| 506 | Handle<Object> GlobalConstantFor(Handle<String> name); |
| 507 | |
svenpanne@chromium.org | a8bb4d9 | 2011-10-10 13:20:40 +0000 | [diff] [blame] | 508 | // Converts the given boolean condition to JavaScript boolean value. |
| 509 | Handle<Object> ToBoolean(bool value); |
| 510 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 511 | private: |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 512 | Isolate* isolate() { return reinterpret_cast<Isolate*>(this); } |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 513 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 514 | Handle<JSFunction> NewFunctionHelper(Handle<String> name, |
| 515 | Handle<Object> prototype); |
kmillikin@chromium.org | 4111b80 | 2010-05-03 10:34:42 +0000 | [diff] [blame] | 516 | |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 517 | Handle<JSFunction> NewFunctionWithoutPrototypeHelper( |
| 518 | Handle<String> name, |
mstarzinger@chromium.org | 1b3afd1 | 2011-11-29 14:28:56 +0000 | [diff] [blame] | 519 | LanguageMode language_mode); |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 520 | |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 521 | // Create a new map cache. |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 522 | Handle<MapCache> NewMapCache(int at_least_space_for); |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 523 | |
yangguo@chromium.org | 46839fb | 2012-08-28 09:06:19 +0000 | [diff] [blame] | 524 | // Update the map cache in the native context with (keys, map) |
sgjesse@chromium.org | ea88ce9 | 2011-03-23 11:19:56 +0000 | [diff] [blame] | 525 | Handle<MapCache> AddToMapCache(Handle<Context> context, |
| 526 | Handle<FixedArray> keys, |
| 527 | Handle<Map> map); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 528 | }; |
| 529 | |
| 530 | |
| 531 | } } // namespace v8::internal |
| 532 | |
| 533 | #endif // V8_FACTORY_H_ |