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