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 "isolate.h" | 8 #include "isolate.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 Handle<AllocationSite> allocation_site = Handle<AllocationSite>::null()); | 318 Handle<AllocationSite> allocation_site = Handle<AllocationSite>::null()); |
319 | 319 |
320 Handle<JSObject> NewJSObjectFromMapForDeoptimizer( | 320 Handle<JSObject> NewJSObjectFromMapForDeoptimizer( |
321 Handle<Map> map, PretenureFlag pretenure = NOT_TENURED); | 321 Handle<Map> map, PretenureFlag pretenure = NOT_TENURED); |
322 | 322 |
323 // JS modules are pretenured. | 323 // JS modules are pretenured. |
324 Handle<JSModule> NewJSModule(Handle<Context> context, | 324 Handle<JSModule> NewJSModule(Handle<Context> context, |
325 Handle<ScopeInfo> scope_info); | 325 Handle<ScopeInfo> scope_info); |
326 | 326 |
327 // JS arrays are pretenured when allocated by the parser. | 327 // JS arrays are pretenured when allocated by the parser. |
| 328 |
| 329 Handle<JSArray> NewJSArray( |
| 330 ElementsKind elements_kind, |
| 331 PretenureFlag pretenure = NOT_TENURED); |
| 332 |
328 Handle<JSArray> NewJSArray( | 333 Handle<JSArray> NewJSArray( |
329 ElementsKind elements_kind, | 334 ElementsKind elements_kind, |
330 int length, | 335 int length, |
331 int capacity, | 336 int capacity, |
332 ArrayStorageAllocationMode mode = INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE, | 337 ArrayStorageAllocationMode mode = INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE, |
333 PretenureFlag pretenure = NOT_TENURED); | 338 PretenureFlag pretenure = NOT_TENURED); |
334 | 339 |
335 Handle<JSArray> NewJSArray( | 340 Handle<JSArray> NewJSArray( |
336 int capacity, | 341 int capacity, |
337 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND, | 342 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND, |
338 PretenureFlag pretenure = NOT_TENURED) { | 343 PretenureFlag pretenure = NOT_TENURED) { |
339 if (capacity != 0) { | 344 if (capacity != 0) { |
340 elements_kind = GetHoleyElementsKind(elements_kind); | 345 elements_kind = GetHoleyElementsKind(elements_kind); |
341 } | 346 } |
342 return NewJSArray(elements_kind, 0, capacity, | 347 return NewJSArray(elements_kind, 0, capacity, |
343 INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE, pretenure); | 348 INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE, pretenure); |
344 } | 349 } |
345 | 350 |
| 351 // Allocate a JSArray with no elements |
346 Handle<JSArray> NewJSArrayWithElements( | 352 Handle<JSArray> NewJSArrayWithElements( |
347 Handle<FixedArrayBase> elements, | 353 Handle<FixedArrayBase> elements, |
348 ElementsKind elements_kind, | 354 ElementsKind elements_kind, |
349 int length, | 355 int length, |
350 PretenureFlag pretenure = NOT_TENURED); | 356 PretenureFlag pretenure = NOT_TENURED); |
351 | 357 |
352 Handle<JSArray> NewJSArrayWithElements( | 358 Handle<JSArray> NewJSArrayWithElements( |
353 Handle<FixedArrayBase> elements, | 359 Handle<FixedArrayBase> elements, |
354 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND, | 360 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND, |
355 PretenureFlag pretenure = NOT_TENURED) { | 361 PretenureFlag pretenure = NOT_TENURED) { |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 | 603 |
598 // Update the map cache in the native context with (keys, map) | 604 // Update the map cache in the native context with (keys, map) |
599 Handle<MapCache> AddToMapCache(Handle<Context> context, | 605 Handle<MapCache> AddToMapCache(Handle<Context> context, |
600 Handle<FixedArray> keys, | 606 Handle<FixedArray> keys, |
601 Handle<Map> map); | 607 Handle<Map> map); |
602 }; | 608 }; |
603 | 609 |
604 } } // namespace v8::internal | 610 } } // namespace v8::internal |
605 | 611 |
606 #endif // V8_FACTORY_H_ | 612 #endif // V8_FACTORY_H_ |
OLD | NEW |