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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 | 394 |
395 // JS modules are pretenured. | 395 // JS modules are pretenured. |
396 Handle<JSModule> NewJSModule(Handle<Context> context, | 396 Handle<JSModule> NewJSModule(Handle<Context> context, |
397 Handle<ScopeInfo> scope_info); | 397 Handle<ScopeInfo> scope_info); |
398 | 398 |
399 // JS arrays are pretenured when allocated by the parser. | 399 // JS arrays are pretenured when allocated by the parser. |
400 | 400 |
401 // Create a JSArray with no elements. | 401 // Create a JSArray with no elements. |
402 Handle<JSArray> NewJSArray( | 402 Handle<JSArray> NewJSArray( |
403 ElementsKind elements_kind, | 403 ElementsKind elements_kind, |
| 404 ObjectStrength strength = WEAK, |
404 PretenureFlag pretenure = NOT_TENURED); | 405 PretenureFlag pretenure = NOT_TENURED); |
405 | 406 |
406 // Create a JSArray with a specified length and elements initialized | 407 // Create a JSArray with a specified length and elements initialized |
407 // according to the specified mode. | 408 // according to the specified mode. |
408 Handle<JSArray> NewJSArray( | 409 Handle<JSArray> NewJSArray( |
409 ElementsKind elements_kind, int length, int capacity, | 410 ElementsKind elements_kind, int length, int capacity, |
| 411 ObjectStrength strength = WEAK, |
410 ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS, | 412 ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS, |
411 PretenureFlag pretenure = NOT_TENURED); | 413 PretenureFlag pretenure = NOT_TENURED); |
412 | 414 |
413 Handle<JSArray> NewJSArray( | 415 Handle<JSArray> NewJSArray( |
414 int capacity, | 416 int capacity, |
415 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND, | 417 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND, |
| 418 ObjectStrength strength = WEAK, |
416 PretenureFlag pretenure = NOT_TENURED) { | 419 PretenureFlag pretenure = NOT_TENURED) { |
417 if (capacity != 0) { | 420 if (capacity != 0) { |
418 elements_kind = GetHoleyElementsKind(elements_kind); | 421 elements_kind = GetHoleyElementsKind(elements_kind); |
419 } | 422 } |
420 return NewJSArray(elements_kind, 0, capacity, | 423 return NewJSArray(elements_kind, 0, capacity, strength, |
421 INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE, pretenure); | 424 INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE, pretenure); |
422 } | 425 } |
423 | 426 |
424 // Create a JSArray with the given elements. | 427 // Create a JSArray with the given elements. |
425 Handle<JSArray> NewJSArrayWithElements( | 428 Handle<JSArray> NewJSArrayWithElements( |
426 Handle<FixedArrayBase> elements, | 429 Handle<FixedArrayBase> elements, |
427 ElementsKind elements_kind, | 430 ElementsKind elements_kind, |
428 int length, | 431 int length, |
| 432 ObjectStrength strength = WEAK, |
429 PretenureFlag pretenure = NOT_TENURED); | 433 PretenureFlag pretenure = NOT_TENURED); |
430 | 434 |
431 Handle<JSArray> NewJSArrayWithElements( | 435 Handle<JSArray> NewJSArrayWithElements( |
432 Handle<FixedArrayBase> elements, | 436 Handle<FixedArrayBase> elements, |
433 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND, | 437 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND, |
| 438 ObjectStrength strength = WEAK, |
434 PretenureFlag pretenure = NOT_TENURED) { | 439 PretenureFlag pretenure = NOT_TENURED) { |
435 return NewJSArrayWithElements( | 440 return NewJSArrayWithElements(elements, elements_kind, elements->length(), |
436 elements, elements_kind, elements->length(), pretenure); | 441 strength, pretenure); |
437 } | 442 } |
438 | 443 |
439 void NewJSArrayStorage( | 444 void NewJSArrayStorage( |
440 Handle<JSArray> array, | 445 Handle<JSArray> array, |
441 int length, | 446 int length, |
442 int capacity, | 447 int capacity, |
443 ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS); | 448 ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS); |
444 | 449 |
445 Handle<JSGeneratorObject> NewJSGeneratorObject(Handle<JSFunction> function); | 450 Handle<JSGeneratorObject> NewJSGeneratorObject(Handle<JSFunction> function); |
446 | 451 |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 // Reinitialize a JSProxy into an (empty) JS object of respective type and | 751 // Reinitialize a JSProxy into an (empty) JS object of respective type and |
747 // size, but keeping the original prototype. The receiver must have at least | 752 // size, but keeping the original prototype. The receiver must have at least |
748 // the size of the new object. The object is reinitialized and behaves as an | 753 // the size of the new object. The object is reinitialized and behaves as an |
749 // object that has been freshly allocated. | 754 // object that has been freshly allocated. |
750 void ReinitializeJSProxy(Handle<JSProxy> proxy, InstanceType type, int size); | 755 void ReinitializeJSProxy(Handle<JSProxy> proxy, InstanceType type, int size); |
751 }; | 756 }; |
752 | 757 |
753 } } // namespace v8::internal | 758 } } // namespace v8::internal |
754 | 759 |
755 #endif // V8_FACTORY_H_ | 760 #endif // V8_FACTORY_H_ |
OLD | NEW |