| OLD | NEW | 
|---|
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #ifndef V8_FACTORY_H_ | 5 #ifndef V8_FACTORY_H_ | 
| 6 #define V8_FACTORY_H_ | 6 #define V8_FACTORY_H_ | 
| 7 | 7 | 
| 8 #include "src/isolate.h" | 8 #include "src/isolate.h" | 
| 9 #include "src/messages.h" | 9 #include "src/messages.h" | 
| 10 | 10 | 
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 391       bool allocate_properties = true, | 391       bool allocate_properties = true, | 
| 392       Handle<AllocationSite> allocation_site = Handle<AllocationSite>::null()); | 392       Handle<AllocationSite> allocation_site = Handle<AllocationSite>::null()); | 
| 393 | 393 | 
| 394   // JS modules are pretenured. | 394   // JS modules are pretenured. | 
| 395   Handle<JSModule> NewJSModule(Handle<Context> context, | 395   Handle<JSModule> NewJSModule(Handle<Context> context, | 
| 396                                Handle<ScopeInfo> scope_info); | 396                                Handle<ScopeInfo> scope_info); | 
| 397 | 397 | 
| 398   // JS arrays are pretenured when allocated by the parser. | 398   // JS arrays are pretenured when allocated by the parser. | 
| 399 | 399 | 
| 400   // Create a JSArray with no elements. | 400   // Create a JSArray with no elements. | 
| 401   Handle<JSArray> NewJSArray( | 401   Handle<JSArray> NewJSArray(ElementsKind elements_kind, | 
| 402       ElementsKind elements_kind, | 402                              Strength strength = Strength::WEAK, | 
| 403       ObjectStrength strength = WEAK, | 403                              PretenureFlag pretenure = NOT_TENURED); | 
| 404       PretenureFlag pretenure = NOT_TENURED); |  | 
| 405 | 404 | 
| 406   // Create a JSArray with a specified length and elements initialized | 405   // Create a JSArray with a specified length and elements initialized | 
| 407   // according to the specified mode. | 406   // according to the specified mode. | 
| 408   Handle<JSArray> NewJSArray( | 407   Handle<JSArray> NewJSArray( | 
| 409       ElementsKind elements_kind, int length, int capacity, | 408       ElementsKind elements_kind, int length, int capacity, | 
| 410       ObjectStrength strength = WEAK, | 409       Strength strength = Strength::WEAK, | 
| 411       ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS, | 410       ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS, | 
| 412       PretenureFlag pretenure = NOT_TENURED); | 411       PretenureFlag pretenure = NOT_TENURED); | 
| 413 | 412 | 
| 414   Handle<JSArray> NewJSArray( | 413   Handle<JSArray> NewJSArray( | 
| 415       int capacity, | 414       int capacity, ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND, | 
| 416       ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND, | 415       Strength strength = Strength::WEAK, | 
| 417       ObjectStrength strength = WEAK, |  | 
| 418       PretenureFlag pretenure = NOT_TENURED) { | 416       PretenureFlag pretenure = NOT_TENURED) { | 
| 419     if (capacity != 0) { | 417     if (capacity != 0) { | 
| 420       elements_kind = GetHoleyElementsKind(elements_kind); | 418       elements_kind = GetHoleyElementsKind(elements_kind); | 
| 421     } | 419     } | 
| 422     return NewJSArray(elements_kind, 0, capacity, strength, | 420     return NewJSArray(elements_kind, 0, capacity, strength, | 
| 423                       INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE, pretenure); | 421                       INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE, pretenure); | 
| 424   } | 422   } | 
| 425 | 423 | 
| 426   // Create a JSArray with the given elements. | 424   // Create a JSArray with the given elements. | 
| 427   Handle<JSArray> NewJSArrayWithElements( | 425   Handle<JSArray> NewJSArrayWithElements(Handle<FixedArrayBase> elements, | 
| 428       Handle<FixedArrayBase> elements, | 426                                          ElementsKind elements_kind, int length, | 
| 429       ElementsKind elements_kind, | 427                                          Strength strength = Strength::WEAK, | 
| 430       int length, | 428                                          PretenureFlag pretenure = NOT_TENURED); | 
| 431       ObjectStrength strength = WEAK, |  | 
| 432       PretenureFlag pretenure = NOT_TENURED); |  | 
| 433 | 429 | 
| 434   Handle<JSArray> NewJSArrayWithElements( | 430   Handle<JSArray> NewJSArrayWithElements( | 
| 435       Handle<FixedArrayBase> elements, | 431       Handle<FixedArrayBase> elements, | 
| 436       ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND, | 432       ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND, | 
| 437       ObjectStrength strength = WEAK, | 433       Strength strength = Strength::WEAK, | 
| 438       PretenureFlag pretenure = NOT_TENURED) { | 434       PretenureFlag pretenure = NOT_TENURED) { | 
| 439     return NewJSArrayWithElements(elements, elements_kind, elements->length(), | 435     return NewJSArrayWithElements(elements, elements_kind, elements->length(), | 
| 440                                   strength, pretenure); | 436                                   strength, pretenure); | 
| 441   } | 437   } | 
| 442 | 438 | 
| 443   void NewJSArrayStorage( | 439   void NewJSArrayStorage( | 
| 444       Handle<JSArray> array, | 440       Handle<JSArray> array, | 
| 445       int length, | 441       int length, | 
| 446       int capacity, | 442       int capacity, | 
| 447       ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS); | 443       ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS); | 
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 750   // Reinitialize a JSProxy into an (empty) JS object of respective type and | 746   // Reinitialize a JSProxy into an (empty) JS object of respective type and | 
| 751   // size, but keeping the original prototype.  The receiver must have at least | 747   // size, but keeping the original prototype.  The receiver must have at least | 
| 752   // the size of the new object.  The object is reinitialized and behaves as an | 748   // the size of the new object.  The object is reinitialized and behaves as an | 
| 753   // object that has been freshly allocated. | 749   // object that has been freshly allocated. | 
| 754   void ReinitializeJSProxy(Handle<JSProxy> proxy, InstanceType type, int size); | 750   void ReinitializeJSProxy(Handle<JSProxy> proxy, InstanceType type, int size); | 
| 755 }; | 751 }; | 
| 756 | 752 | 
| 757 } }  // namespace v8::internal | 753 } }  // namespace v8::internal | 
| 758 | 754 | 
| 759 #endif  // V8_FACTORY_H_ | 755 #endif  // V8_FACTORY_H_ | 
| OLD | NEW | 
|---|