| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 // Create a new string object which holds a proper substring of a string. | 138 // Create a new string object which holds a proper substring of a string. |
| 139 Handle<String> NewProperSubString(Handle<String> str, | 139 Handle<String> NewProperSubString(Handle<String> str, |
| 140 int begin, | 140 int begin, |
| 141 int end); | 141 int end); |
| 142 | 142 |
| 143 // Creates a new external String object. There are two String encodings | 143 // Creates a new external String object. There are two String encodings |
| 144 // in the system: ASCII and two byte. Unlike other String types, it does | 144 // in the system: ASCII and two byte. Unlike other String types, it does |
| 145 // not make sense to have a UTF-8 factory function for external strings, | 145 // not make sense to have a UTF-8 factory function for external strings, |
| 146 // because we cannot change the underlying buffer. | 146 // because we cannot change the underlying buffer. |
| 147 Handle<String> NewExternalStringFromAscii( | 147 Handle<String> NewExternalStringFromAscii( |
| 148 ExternalAsciiString::Resource* resource); | 148 const ExternalAsciiString::Resource* resource); |
| 149 Handle<String> NewExternalStringFromTwoByte( | 149 Handle<String> NewExternalStringFromTwoByte( |
| 150 ExternalTwoByteString::Resource* resource); | 150 const ExternalTwoByteString::Resource* resource); |
| 151 | 151 |
| 152 // Create a global (but otherwise uninitialized) context. | 152 // Create a global (but otherwise uninitialized) context. |
| 153 Handle<Context> NewGlobalContext(); | 153 Handle<Context> NewGlobalContext(); |
| 154 | 154 |
| 155 // Create a function context. | 155 // Create a function context. |
| 156 Handle<Context> NewFunctionContext(int length, | 156 Handle<Context> NewFunctionContext(int length, |
| 157 Handle<JSFunction> function); | 157 Handle<JSFunction> function); |
| 158 | 158 |
| 159 // Create a catch context. | 159 // Create a catch context. |
| 160 Handle<Context> NewCatchContext(Handle<JSFunction> function, | 160 Handle<Context> NewCatchContext(Handle<JSFunction> function, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 | 196 |
| 197 Handle<ExternalArray> NewExternalArray( | 197 Handle<ExternalArray> NewExternalArray( |
| 198 int length, | 198 int length, |
| 199 ExternalArrayType array_type, | 199 ExternalArrayType array_type, |
| 200 void* external_pointer, | 200 void* external_pointer, |
| 201 PretenureFlag pretenure = NOT_TENURED); | 201 PretenureFlag pretenure = NOT_TENURED); |
| 202 | 202 |
| 203 Handle<JSGlobalPropertyCell> NewJSGlobalPropertyCell( | 203 Handle<JSGlobalPropertyCell> NewJSGlobalPropertyCell( |
| 204 Handle<Object> value); | 204 Handle<Object> value); |
| 205 | 205 |
| 206 Handle<Map> NewMap(InstanceType type, int instance_size); | 206 Handle<Map> NewMap(InstanceType type, |
| 207 int instance_size, |
| 208 ElementsKind elements_kind = FAST_ELEMENTS); |
| 207 | 209 |
| 208 Handle<JSObject> NewFunctionPrototype(Handle<JSFunction> function); | 210 Handle<JSObject> NewFunctionPrototype(Handle<JSFunction> function); |
| 209 | 211 |
| 210 Handle<Map> CopyMapDropDescriptors(Handle<Map> map); | 212 Handle<Map> CopyMapDropDescriptors(Handle<Map> map); |
| 211 | 213 |
| 212 // Copy the map adding more inobject properties if possible without | 214 // Copy the map adding more inobject properties if possible without |
| 213 // overflowing the instance size. | 215 // overflowing the instance size. |
| 214 Handle<Map> CopyMap(Handle<Map> map, int extra_inobject_props); | 216 Handle<Map> CopyMap(Handle<Map> map, int extra_inobject_props); |
| 215 | 217 |
| 216 Handle<Map> CopyMapDropTransitions(Handle<Map> map); | 218 Handle<Map> CopyMapDropTransitions(Handle<Map> map); |
| 217 | 219 |
| 218 Handle<Map> GetFastElementsMap(Handle<Map> map); | 220 Handle<Map> GetElementsTransitionMap(Handle<JSObject> object, |
| 219 | 221 ElementsKind elements_kind); |
| 220 Handle<Map> GetSlowElementsMap(Handle<Map> map); | |
| 221 | |
| 222 Handle<Map> GetElementsTransitionMap(Handle<Map> map, | |
| 223 ElementsKind elements_kind, | |
| 224 bool safe_to_add_transition); | |
| 225 | 222 |
| 226 Handle<FixedArray> CopyFixedArray(Handle<FixedArray> array); | 223 Handle<FixedArray> CopyFixedArray(Handle<FixedArray> array); |
| 227 | 224 |
| 228 // Numbers (eg, literals) are pretenured by the parser. | 225 // Numbers (eg, literals) are pretenured by the parser. |
| 229 Handle<Object> NewNumber(double value, | 226 Handle<Object> NewNumber(double value, |
| 230 PretenureFlag pretenure = NOT_TENURED); | 227 PretenureFlag pretenure = NOT_TENURED); |
| 231 | 228 |
| 232 Handle<Object> NewNumberFromInt(int value); | 229 Handle<Object> NewNumberFromInt(int value); |
| 233 Handle<Object> NewNumberFromUint(uint32_t value); | 230 Handle<Object> NewNumberFromUint(uint32_t value); |
| 234 | 231 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 251 Handle<JSObject> NewJSObjectFromMap(Handle<Map> map); | 248 Handle<JSObject> NewJSObjectFromMap(Handle<Map> map); |
| 252 | 249 |
| 253 // JS arrays are pretenured when allocated by the parser. | 250 // JS arrays are pretenured when allocated by the parser. |
| 254 Handle<JSArray> NewJSArray(int capacity, | 251 Handle<JSArray> NewJSArray(int capacity, |
| 255 PretenureFlag pretenure = NOT_TENURED); | 252 PretenureFlag pretenure = NOT_TENURED); |
| 256 | 253 |
| 257 Handle<JSArray> NewJSArrayWithElements( | 254 Handle<JSArray> NewJSArrayWithElements( |
| 258 Handle<FixedArray> elements, | 255 Handle<FixedArray> elements, |
| 259 PretenureFlag pretenure = NOT_TENURED); | 256 PretenureFlag pretenure = NOT_TENURED); |
| 260 | 257 |
| 258 void SetContent(Handle<JSArray> array, Handle<FixedArray> elements); |
| 259 |
| 260 void EnsureCanContainNonSmiElements(Handle<JSArray> array); |
| 261 |
| 261 Handle<JSProxy> NewJSProxy(Handle<Object> handler, Handle<Object> prototype); | 262 Handle<JSProxy> NewJSProxy(Handle<Object> handler, Handle<Object> prototype); |
| 262 | 263 |
| 263 // Change the type of the argument into a JS object/function and reinitialize. | 264 // Change the type of the argument into a JS object/function and reinitialize. |
| 264 void BecomeJSObject(Handle<JSReceiver> object); | 265 void BecomeJSObject(Handle<JSReceiver> object); |
| 265 void BecomeJSFunction(Handle<JSReceiver> object); | 266 void BecomeJSFunction(Handle<JSReceiver> object); |
| 266 | 267 |
| 268 void SetIdentityHash(Handle<JSObject> object, Object* hash); |
| 269 |
| 267 Handle<JSFunction> NewFunction(Handle<String> name, | 270 Handle<JSFunction> NewFunction(Handle<String> name, |
| 268 Handle<Object> prototype); | 271 Handle<Object> prototype); |
| 269 | 272 |
| 270 Handle<JSFunction> NewFunctionWithoutPrototype( | 273 Handle<JSFunction> NewFunctionWithoutPrototype( |
| 271 Handle<String> name, | 274 Handle<String> name, |
| 272 StrictModeFlag strict_mode); | 275 StrictModeFlag strict_mode); |
| 273 | 276 |
| 274 Handle<JSFunction> NewFunction(Handle<Object> super, bool is_global); | 277 Handle<JSFunction> NewFunction(Handle<Object> super, bool is_global); |
| 275 | 278 |
| 276 Handle<JSFunction> BaseNewFunctionFromSharedFunctionInfo( | 279 Handle<JSFunction> BaseNewFunctionFromSharedFunctionInfo( |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 Handle<JSFunction> NewFunctionWithoutPrototype(Handle<String> name, | 352 Handle<JSFunction> NewFunctionWithoutPrototype(Handle<String> name, |
| 350 Handle<Code> code); | 353 Handle<Code> code); |
| 351 | 354 |
| 352 Handle<DescriptorArray> CopyAppendForeignDescriptor( | 355 Handle<DescriptorArray> CopyAppendForeignDescriptor( |
| 353 Handle<DescriptorArray> array, | 356 Handle<DescriptorArray> array, |
| 354 Handle<String> key, | 357 Handle<String> key, |
| 355 Handle<Object> value, | 358 Handle<Object> value, |
| 356 PropertyAttributes attributes); | 359 PropertyAttributes attributes); |
| 357 | 360 |
| 358 Handle<String> NumberToString(Handle<Object> number); | 361 Handle<String> NumberToString(Handle<Object> number); |
| 362 Handle<String> Uint32ToString(uint32_t value); |
| 359 | 363 |
| 360 enum ApiInstanceType { | 364 enum ApiInstanceType { |
| 361 JavaScriptObject, | 365 JavaScriptObject, |
| 362 InnerGlobalObject, | 366 InnerGlobalObject, |
| 363 OuterGlobalObject | 367 OuterGlobalObject |
| 364 }; | 368 }; |
| 365 | 369 |
| 366 Handle<JSFunction> CreateApiFunction( | 370 Handle<JSFunction> CreateApiFunction( |
| 367 Handle<FunctionTemplateInfo> data, | 371 Handle<FunctionTemplateInfo> data, |
| 368 ApiInstanceType type = JavaScriptObject); | 372 ApiInstanceType type = JavaScriptObject); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 Handle<Object> match_pattern); | 439 Handle<Object> match_pattern); |
| 436 | 440 |
| 437 // Creates a new FixedArray that holds the data associated with the | 441 // Creates a new FixedArray that holds the data associated with the |
| 438 // irregexp regexp and stores it in the regexp. | 442 // irregexp regexp and stores it in the regexp. |
| 439 void SetRegExpIrregexpData(Handle<JSRegExp> regexp, | 443 void SetRegExpIrregexpData(Handle<JSRegExp> regexp, |
| 440 JSRegExp::Type type, | 444 JSRegExp::Type type, |
| 441 Handle<String> source, | 445 Handle<String> source, |
| 442 JSRegExp::Flags flags, | 446 JSRegExp::Flags flags, |
| 443 int capture_count); | 447 int capture_count); |
| 444 | 448 |
| 449 // Returns the value for a known global constant (a property of the global |
| 450 // object which is neither configurable nor writable) like 'undefined'. |
| 451 // Returns a null handle when the given name is unknown. |
| 452 Handle<Object> GlobalConstantFor(Handle<String> name); |
| 453 |
| 445 private: | 454 private: |
| 446 Isolate* isolate() { return reinterpret_cast<Isolate*>(this); } | 455 Isolate* isolate() { return reinterpret_cast<Isolate*>(this); } |
| 447 | 456 |
| 448 Handle<JSFunction> NewFunctionHelper(Handle<String> name, | 457 Handle<JSFunction> NewFunctionHelper(Handle<String> name, |
| 449 Handle<Object> prototype); | 458 Handle<Object> prototype); |
| 450 | 459 |
| 451 Handle<JSFunction> NewFunctionWithoutPrototypeHelper( | 460 Handle<JSFunction> NewFunctionWithoutPrototypeHelper( |
| 452 Handle<String> name, | 461 Handle<String> name, |
| 453 StrictModeFlag strict_mode); | 462 StrictModeFlag strict_mode); |
| 454 | 463 |
| 455 Handle<DescriptorArray> CopyAppendCallbackDescriptors( | 464 Handle<DescriptorArray> CopyAppendCallbackDescriptors( |
| 456 Handle<DescriptorArray> array, | 465 Handle<DescriptorArray> array, |
| 457 Handle<Object> descriptors); | 466 Handle<Object> descriptors); |
| 458 | 467 |
| 459 // Create a new map cache. | 468 // Create a new map cache. |
| 460 Handle<MapCache> NewMapCache(int at_least_space_for); | 469 Handle<MapCache> NewMapCache(int at_least_space_for); |
| 461 | 470 |
| 462 // Update the map cache in the global context with (keys, map) | 471 // Update the map cache in the global context with (keys, map) |
| 463 Handle<MapCache> AddToMapCache(Handle<Context> context, | 472 Handle<MapCache> AddToMapCache(Handle<Context> context, |
| 464 Handle<FixedArray> keys, | 473 Handle<FixedArray> keys, |
| 465 Handle<Map> map); | 474 Handle<Map> map); |
| 466 }; | 475 }; |
| 467 | 476 |
| 468 | 477 |
| 469 } } // namespace v8::internal | 478 } } // namespace v8::internal |
| 470 | 479 |
| 471 #endif // V8_FACTORY_H_ | 480 #endif // V8_FACTORY_H_ |
| OLD | NEW |