OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 | 478 |
479 | 479 |
480 Handle<Map> Factory::CopyMapDropTransitions(Handle<Map> src) { | 480 Handle<Map> Factory::CopyMapDropTransitions(Handle<Map> src) { |
481 CALL_HEAP_FUNCTION(isolate(), src->CopyDropTransitions(), Map); | 481 CALL_HEAP_FUNCTION(isolate(), src->CopyDropTransitions(), Map); |
482 } | 482 } |
483 | 483 |
484 | 484 |
485 Handle<Map> Factory::GetElementsTransitionMap( | 485 Handle<Map> Factory::GetElementsTransitionMap( |
486 Handle<JSObject> src, | 486 Handle<JSObject> src, |
487 ElementsKind elements_kind) { | 487 ElementsKind elements_kind) { |
488 CALL_HEAP_FUNCTION(isolate(), | 488 Isolate* i = isolate(); |
489 src->GetElementsTransitionMap(elements_kind), | 489 CALL_HEAP_FUNCTION(i, |
| 490 src->GetElementsTransitionMap(i, elements_kind), |
490 Map); | 491 Map); |
491 } | 492 } |
492 | 493 |
493 | 494 |
494 Handle<FixedArray> Factory::CopyFixedArray(Handle<FixedArray> array) { | 495 Handle<FixedArray> Factory::CopyFixedArray(Handle<FixedArray> array) { |
495 CALL_HEAP_FUNCTION(isolate(), array->Copy(), FixedArray); | 496 CALL_HEAP_FUNCTION(isolate(), array->Copy(), FixedArray); |
496 } | 497 } |
497 | 498 |
498 | 499 |
499 Handle<FixedDoubleArray> Factory::CopyFixedDoubleArray( | 500 Handle<FixedDoubleArray> Factory::CopyFixedDoubleArray( |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 Handle<JSFunction> function = NewFunction(name, prototype); | 748 Handle<JSFunction> function = NewFunction(name, prototype); |
748 | 749 |
749 // Set up the code pointer in both the shared function info and in | 750 // Set up the code pointer in both the shared function info and in |
750 // the function itself. | 751 // the function itself. |
751 function->shared()->set_code(*code); | 752 function->shared()->set_code(*code); |
752 function->set_code(*code); | 753 function->set_code(*code); |
753 | 754 |
754 if (force_initial_map || | 755 if (force_initial_map || |
755 type != JS_OBJECT_TYPE || | 756 type != JS_OBJECT_TYPE || |
756 instance_size != JSObject::kHeaderSize) { | 757 instance_size != JSObject::kHeaderSize) { |
757 ElementsKind default_elements_kind = FLAG_smi_only_arrays | |
758 ? FAST_SMI_ONLY_ELEMENTS | |
759 : FAST_ELEMENTS; | |
760 Handle<Map> initial_map = NewMap(type, | 758 Handle<Map> initial_map = NewMap(type, |
761 instance_size, | 759 instance_size, |
762 default_elements_kind); | 760 FAST_SMI_ONLY_ELEMENTS); |
763 function->set_initial_map(*initial_map); | 761 function->set_initial_map(*initial_map); |
764 initial_map->set_constructor(*function); | 762 initial_map->set_constructor(*function); |
765 } | 763 } |
766 | 764 |
767 // Set function.prototype and give the prototype a constructor | 765 // Set function.prototype and give the prototype a constructor |
768 // property that refers to the function. | 766 // property that refers to the function. |
769 SetPrototypeProperty(function, prototype); | 767 SetPrototypeProperty(function, prototype); |
770 // Currently safe because it is only invoked from Genesis. | 768 // Currently safe because it is only invoked from Genesis. |
771 CHECK_NOT_EMPTY_HANDLE(isolate(), | 769 CHECK_NOT_EMPTY_HANDLE(isolate(), |
772 JSObject::SetLocalPropertyIgnoreAttributes( | 770 JSObject::SetLocalPropertyIgnoreAttributes( |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 | 929 |
932 Handle<JSObject> Factory::NewJSObjectFromMap(Handle<Map> map) { | 930 Handle<JSObject> Factory::NewJSObjectFromMap(Handle<Map> map) { |
933 CALL_HEAP_FUNCTION( | 931 CALL_HEAP_FUNCTION( |
934 isolate(), | 932 isolate(), |
935 isolate()->heap()->AllocateJSObjectFromMap(*map, NOT_TENURED), | 933 isolate()->heap()->AllocateJSObjectFromMap(*map, NOT_TENURED), |
936 JSObject); | 934 JSObject); |
937 } | 935 } |
938 | 936 |
939 | 937 |
940 Handle<JSArray> Factory::NewJSArray(int capacity, | 938 Handle<JSArray> Factory::NewJSArray(int capacity, |
| 939 ElementsKind elements_kind, |
941 PretenureFlag pretenure) { | 940 PretenureFlag pretenure) { |
942 Handle<JSObject> obj = NewJSObject(isolate()->array_function(), pretenure); | |
943 CALL_HEAP_FUNCTION(isolate(), | 941 CALL_HEAP_FUNCTION(isolate(), |
944 Handle<JSArray>::cast(obj)->Initialize(capacity), | 942 isolate()->heap()->AllocateJSArrayAndStorage( |
| 943 elements_kind, |
| 944 0, |
| 945 capacity, |
| 946 INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE, |
| 947 pretenure), |
945 JSArray); | 948 JSArray); |
946 } | 949 } |
947 | 950 |
948 | 951 |
949 Handle<JSArray> Factory::NewJSArrayWithElements(Handle<FixedArrayBase> elements, | 952 Handle<JSArray> Factory::NewJSArrayWithElements(Handle<FixedArrayBase> elements, |
| 953 ElementsKind elements_kind, |
950 PretenureFlag pretenure) { | 954 PretenureFlag pretenure) { |
951 Handle<JSArray> result = | 955 CALL_HEAP_FUNCTION( |
952 Handle<JSArray>::cast(NewJSObject(isolate()->array_function(), | 956 isolate(), |
953 pretenure)); | 957 isolate()->heap()->AllocateJSArrayWithElements(*elements, |
954 result->set_length(Smi::FromInt(0)); | 958 elements_kind, |
955 SetContent(result, elements); | 959 pretenure), |
956 return result; | 960 JSArray); |
957 } | 961 } |
958 | 962 |
959 | 963 |
960 void Factory::SetElementsCapacityAndLength(Handle<JSArray> array, | 964 void Factory::SetElementsCapacityAndLength(Handle<JSArray> array, |
961 int capacity, | 965 int capacity, |
962 int length) { | 966 int length) { |
963 ElementsAccessor* accessor = array->GetElementsAccessor(); | 967 ElementsAccessor* accessor = array->GetElementsAccessor(); |
964 CALL_HEAP_FUNCTION_VOID( | 968 CALL_HEAP_FUNCTION_VOID( |
965 isolate(), | 969 isolate(), |
966 accessor->SetCapacityAndLength(*array, capacity, length)); | 970 accessor->SetCapacityAndLength(*array, capacity, length)); |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1411 | 1415 |
1412 | 1416 |
1413 Handle<Object> Factory::ToBoolean(bool value) { | 1417 Handle<Object> Factory::ToBoolean(bool value) { |
1414 return Handle<Object>(value | 1418 return Handle<Object>(value |
1415 ? isolate()->heap()->true_value() | 1419 ? isolate()->heap()->true_value() |
1416 : isolate()->heap()->false_value()); | 1420 : isolate()->heap()->false_value()); |
1417 } | 1421 } |
1418 | 1422 |
1419 | 1423 |
1420 } } // namespace v8::internal | 1424 } } // namespace v8::internal |
OLD | NEW |