| 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 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 919 | 919 |
| 920 Handle<JSArray> Factory::NewJSArray(int capacity, | 920 Handle<JSArray> Factory::NewJSArray(int capacity, |
| 921 PretenureFlag pretenure) { | 921 PretenureFlag pretenure) { |
| 922 Handle<JSObject> obj = NewJSObject(isolate()->array_function(), pretenure); | 922 Handle<JSObject> obj = NewJSObject(isolate()->array_function(), pretenure); |
| 923 CALL_HEAP_FUNCTION(isolate(), | 923 CALL_HEAP_FUNCTION(isolate(), |
| 924 Handle<JSArray>::cast(obj)->Initialize(capacity), | 924 Handle<JSArray>::cast(obj)->Initialize(capacity), |
| 925 JSArray); | 925 JSArray); |
| 926 } | 926 } |
| 927 | 927 |
| 928 | 928 |
| 929 Handle<JSArray> Factory::NewJSArrayWithElements(Handle<FixedArray> elements, | 929 Handle<JSArray> Factory::NewJSArrayWithElements(Handle<FixedArrayBase> elements, |
| 930 PretenureFlag pretenure) { | 930 PretenureFlag pretenure) { |
| 931 Handle<JSArray> result = | 931 Handle<JSArray> result = |
| 932 Handle<JSArray>::cast(NewJSObject(isolate()->array_function(), | 932 Handle<JSArray>::cast(NewJSObject(isolate()->array_function(), |
| 933 pretenure)); | 933 pretenure)); |
| 934 result->set_length(Smi::FromInt(0)); |
| 934 SetContent(result, elements); | 935 SetContent(result, elements); |
| 935 return result; | 936 return result; |
| 936 } | 937 } |
| 937 | 938 |
| 938 | 939 |
| 940 void Factory::SetElementsCapacityAndLength(Handle<JSArray> array, |
| 941 int capacity, |
| 942 int length) { |
| 943 ElementsAccessor* accessor = array->GetElementsAccessor(); |
| 944 CALL_HEAP_FUNCTION_VOID( |
| 945 isolate(), |
| 946 accessor->SetCapacityAndLength(*array, capacity, length)); |
| 947 } |
| 948 |
| 949 |
| 939 void Factory::SetContent(Handle<JSArray> array, | 950 void Factory::SetContent(Handle<JSArray> array, |
| 940 Handle<FixedArray> elements) { | 951 Handle<FixedArrayBase> elements) { |
| 941 CALL_HEAP_FUNCTION_VOID( | 952 CALL_HEAP_FUNCTION_VOID( |
| 942 isolate(), | 953 isolate(), |
| 943 array->SetContent(*elements)); | 954 array->SetContent(*elements)); |
| 944 } | 955 } |
| 945 | 956 |
| 946 | 957 |
| 947 void Factory::EnsureCanContainNonSmiElements(Handle<JSArray> array) { | 958 void Factory::EnsureCanContainHeapObjectElements(Handle<JSArray> array) { |
| 948 CALL_HEAP_FUNCTION_VOID( | 959 CALL_HEAP_FUNCTION_VOID( |
| 949 isolate(), | 960 isolate(), |
| 950 array->EnsureCanContainNonSmiElements()); | 961 array->EnsureCanContainHeapObjectElements()); |
| 951 } | 962 } |
| 952 | 963 |
| 953 | 964 |
| 965 void Factory::EnsureCanContainElements(Handle<JSArray> array, |
| 966 Handle<FixedArrayBase> elements, |
| 967 EnsureElementsMode mode) { |
| 968 CALL_HEAP_FUNCTION_VOID( |
| 969 isolate(), |
| 970 array->EnsureCanContainElements(*elements, mode)); |
| 971 } |
| 972 |
| 973 |
| 954 Handle<JSProxy> Factory::NewJSProxy(Handle<Object> handler, | 974 Handle<JSProxy> Factory::NewJSProxy(Handle<Object> handler, |
| 955 Handle<Object> prototype) { | 975 Handle<Object> prototype) { |
| 956 CALL_HEAP_FUNCTION( | 976 CALL_HEAP_FUNCTION( |
| 957 isolate(), | 977 isolate(), |
| 958 isolate()->heap()->AllocateJSProxy(*handler, *prototype), | 978 isolate()->heap()->AllocateJSProxy(*handler, *prototype), |
| 959 JSProxy); | 979 JSProxy); |
| 960 } | 980 } |
| 961 | 981 |
| 962 | 982 |
| 963 void Factory::BecomeJSObject(Handle<JSReceiver> object) { | 983 void Factory::BecomeJSObject(Handle<JSReceiver> object) { |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1361 | 1381 |
| 1362 | 1382 |
| 1363 Handle<Object> Factory::ToBoolean(bool value) { | 1383 Handle<Object> Factory::ToBoolean(bool value) { |
| 1364 return Handle<Object>(value | 1384 return Handle<Object>(value |
| 1365 ? isolate()->heap()->true_value() | 1385 ? isolate()->heap()->true_value() |
| 1366 : isolate()->heap()->false_value()); | 1386 : isolate()->heap()->false_value()); |
| 1367 } | 1387 } |
| 1368 | 1388 |
| 1369 | 1389 |
| 1370 } } // namespace v8::internal | 1390 } } // namespace v8::internal |
| OLD | NEW |