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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 js_object); | 195 js_object); |
196 if (!maybe_result->ToObject(&result)) return maybe_result; | 196 if (!maybe_result->ToObject(&result)) return maybe_result; |
197 } | 197 } |
198 elements->set(i, result); | 198 elements->set(i, result); |
199 } | 199 } |
200 } | 200 } |
201 } | 201 } |
202 break; | 202 break; |
203 } | 203 } |
204 case DICTIONARY_ELEMENTS: { | 204 case DICTIONARY_ELEMENTS: { |
205 NumberDictionary* element_dictionary = copy->element_dictionary(); | 205 SeededNumberDictionary* element_dictionary = copy->element_dictionary(); |
206 int capacity = element_dictionary->Capacity(); | 206 int capacity = element_dictionary->Capacity(); |
207 for (int i = 0; i < capacity; i++) { | 207 for (int i = 0; i < capacity; i++) { |
208 Object* k = element_dictionary->KeyAt(i); | 208 Object* k = element_dictionary->KeyAt(i); |
209 if (element_dictionary->IsKey(k)) { | 209 if (element_dictionary->IsKey(k)) { |
210 Object* value = element_dictionary->ValueAt(i); | 210 Object* value = element_dictionary->ValueAt(i); |
211 if (value->IsJSObject()) { | 211 if (value->IsJSObject()) { |
212 JSObject* js_object = JSObject::cast(value); | 212 JSObject* js_object = JSObject::cast(value); |
213 { MaybeObject* maybe_result = DeepCopyBoilerplate(isolate, | 213 { MaybeObject* maybe_result = DeepCopyBoilerplate(isolate, |
214 js_object); | 214 js_object); |
215 if (!maybe_result->ToObject(&result)) return maybe_result; | 215 if (!maybe_result->ToObject(&result)) return maybe_result; |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
971 | 971 |
972 case JSObject::DICTIONARY_ELEMENT: { | 972 case JSObject::DICTIONARY_ELEMENT: { |
973 Handle<JSObject> holder = obj; | 973 Handle<JSObject> holder = obj; |
974 if (obj->IsJSGlobalProxy()) { | 974 if (obj->IsJSGlobalProxy()) { |
975 Object* proto = obj->GetPrototype(); | 975 Object* proto = obj->GetPrototype(); |
976 if (proto->IsNull()) return heap->undefined_value(); | 976 if (proto->IsNull()) return heap->undefined_value(); |
977 ASSERT(proto->IsJSGlobalObject()); | 977 ASSERT(proto->IsJSGlobalObject()); |
978 holder = Handle<JSObject>(JSObject::cast(proto)); | 978 holder = Handle<JSObject>(JSObject::cast(proto)); |
979 } | 979 } |
980 FixedArray* elements = FixedArray::cast(holder->elements()); | 980 FixedArray* elements = FixedArray::cast(holder->elements()); |
981 NumberDictionary* dictionary = NULL; | 981 SeededNumberDictionary* dictionary = NULL; |
982 if (elements->map() == heap->non_strict_arguments_elements_map()) { | 982 if (elements->map() == heap->non_strict_arguments_elements_map()) { |
983 dictionary = NumberDictionary::cast(elements->get(1)); | 983 dictionary = SeededNumberDictionary::cast(elements->get(1)); |
984 } else { | 984 } else { |
985 dictionary = NumberDictionary::cast(elements); | 985 dictionary = SeededNumberDictionary::cast(elements); |
986 } | 986 } |
987 int entry = dictionary->FindEntry(index); | 987 int entry = dictionary->FindEntry(index); |
988 ASSERT(entry != NumberDictionary::kNotFound); | 988 ASSERT(entry != SeededNumberDictionary::kNotFound); |
989 PropertyDetails details = dictionary->DetailsAt(entry); | 989 PropertyDetails details = dictionary->DetailsAt(entry); |
990 switch (details.type()) { | 990 switch (details.type()) { |
991 case CALLBACKS: { | 991 case CALLBACKS: { |
992 // This is an accessor property with getter and/or setter. | 992 // This is an accessor property with getter and/or setter. |
993 FixedArray* callbacks = | 993 FixedArray* callbacks = |
994 FixedArray::cast(dictionary->ValueAt(entry)); | 994 FixedArray::cast(dictionary->ValueAt(entry)); |
995 elms->set(IS_ACCESSOR_INDEX, heap->true_value()); | 995 elms->set(IS_ACCESSOR_INDEX, heap->true_value()); |
996 if (CheckElementAccess(*obj, index, v8::ACCESS_GET)) { | 996 if (CheckElementAccess(*obj, index, v8::ACCESS_GET)) { |
997 elms->set(GETTER_INDEX, callbacks->get(0)); | 997 elms->set(GETTER_INDEX, callbacks->get(0)); |
998 } | 998 } |
(...skipping 3336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4335 // Don't allow element properties to be redefined on objects with external | 4335 // Don't allow element properties to be redefined on objects with external |
4336 // array elements. | 4336 // array elements. |
4337 if (js_object->HasExternalArrayElements()) { | 4337 if (js_object->HasExternalArrayElements()) { |
4338 Handle<Object> args[2] = { js_object, name }; | 4338 Handle<Object> args[2] = { js_object, name }; |
4339 Handle<Object> error = | 4339 Handle<Object> error = |
4340 isolate->factory()->NewTypeError("redef_external_array_element", | 4340 isolate->factory()->NewTypeError("redef_external_array_element", |
4341 HandleVector(args, 2)); | 4341 HandleVector(args, 2)); |
4342 return isolate->Throw(*error); | 4342 return isolate->Throw(*error); |
4343 } | 4343 } |
4344 | 4344 |
4345 Handle<NumberDictionary> dictionary = NormalizeElements(js_object); | 4345 Handle<SeededNumberDictionary> dictionary = NormalizeElements(js_object); |
4346 // Make sure that we never go back to fast case. | 4346 // Make sure that we never go back to fast case. |
4347 dictionary->set_requires_slow_elements(); | 4347 dictionary->set_requires_slow_elements(); |
4348 PropertyDetails details = PropertyDetails(attr, NORMAL); | 4348 PropertyDetails details = PropertyDetails(attr, NORMAL); |
4349 Handle<NumberDictionary> extended_dictionary = | 4349 Handle<SeededNumberDictionary> extended_dictionary = |
4350 NumberDictionarySet(dictionary, index, obj_value, details); | 4350 SeededNumberDictionarySet(dictionary, index, obj_value, details); |
4351 if (*extended_dictionary != *dictionary) { | 4351 if (*extended_dictionary != *dictionary) { |
4352 if (js_object->GetElementsKind() == NON_STRICT_ARGUMENTS_ELEMENTS) { | 4352 if (js_object->GetElementsKind() == NON_STRICT_ARGUMENTS_ELEMENTS) { |
4353 FixedArray::cast(js_object->elements())->set(1, *extended_dictionary); | 4353 FixedArray::cast(js_object->elements())->set(1, *extended_dictionary); |
4354 } else { | 4354 } else { |
4355 js_object->set_elements(*extended_dictionary); | 4355 js_object->set_elements(*extended_dictionary); |
4356 } | 4356 } |
4357 } | 4357 } |
4358 return *obj_value; | 4358 return *obj_value; |
4359 } | 4359 } |
4360 | 4360 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4401 | 4401 |
4402 // Special case for elements if any of the flags are true. | 4402 // Special case for elements if any of the flags are true. |
4403 // If elements are in fast case we always implicitly assume that: | 4403 // If elements are in fast case we always implicitly assume that: |
4404 // DONT_DELETE: false, DONT_ENUM: false, READ_ONLY: false. | 4404 // DONT_DELETE: false, DONT_ENUM: false, READ_ONLY: false. |
4405 static MaybeObject* NormalizeObjectSetElement(Isolate* isolate, | 4405 static MaybeObject* NormalizeObjectSetElement(Isolate* isolate, |
4406 Handle<JSObject> js_object, | 4406 Handle<JSObject> js_object, |
4407 uint32_t index, | 4407 uint32_t index, |
4408 Handle<Object> value, | 4408 Handle<Object> value, |
4409 PropertyAttributes attr) { | 4409 PropertyAttributes attr) { |
4410 // Normalize the elements to enable attributes on the property. | 4410 // Normalize the elements to enable attributes on the property. |
4411 Handle<NumberDictionary> dictionary = NormalizeElements(js_object); | 4411 Handle<SeededNumberDictionary> dictionary = NormalizeElements(js_object); |
4412 // Make sure that we never go back to fast case. | 4412 // Make sure that we never go back to fast case. |
4413 dictionary->set_requires_slow_elements(); | 4413 dictionary->set_requires_slow_elements(); |
4414 PropertyDetails details = PropertyDetails(attr, NORMAL); | 4414 PropertyDetails details = PropertyDetails(attr, NORMAL); |
4415 Handle<NumberDictionary> extended_dictionary = | 4415 Handle<SeededNumberDictionary> extended_dictionary = |
4416 NumberDictionarySet(dictionary, index, value, details); | 4416 SeededNumberDictionarySet(dictionary, index, value, details); |
4417 if (*extended_dictionary != *dictionary) { | 4417 if (*extended_dictionary != *dictionary) { |
4418 js_object->set_elements(*extended_dictionary); | 4418 js_object->set_elements(*extended_dictionary); |
4419 } | 4419 } |
4420 return *value; | 4420 return *value; |
4421 } | 4421 } |
4422 | 4422 |
4423 | 4423 |
4424 MaybeObject* Runtime::SetObjectProperty(Isolate* isolate, | 4424 MaybeObject* Runtime::SetObjectProperty(Isolate* isolate, |
4425 Handle<Object> object, | 4425 Handle<Object> object, |
4426 Handle<Object> key, | 4426 Handle<Object> key, |
(...skipping 5051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9478 return; | 9478 return; |
9479 } | 9479 } |
9480 // Our initial estimate of length was foiled, possibly by | 9480 // Our initial estimate of length was foiled, possibly by |
9481 // getters on the arrays increasing the length of later arrays | 9481 // getters on the arrays increasing the length of later arrays |
9482 // during iteration. | 9482 // during iteration. |
9483 // This shouldn't happen in anything but pathological cases. | 9483 // This shouldn't happen in anything but pathological cases. |
9484 SetDictionaryMode(index); | 9484 SetDictionaryMode(index); |
9485 // Fall-through to dictionary mode. | 9485 // Fall-through to dictionary mode. |
9486 } | 9486 } |
9487 ASSERT(!fast_elements_); | 9487 ASSERT(!fast_elements_); |
9488 Handle<NumberDictionary> dict(NumberDictionary::cast(*storage_)); | 9488 Handle<SeededNumberDictionary> dict( |
9489 Handle<NumberDictionary> result = | 9489 SeededNumberDictionary::cast(*storage_)); |
| 9490 Handle<SeededNumberDictionary> result = |
9490 isolate_->factory()->DictionaryAtNumberPut(dict, index, elm); | 9491 isolate_->factory()->DictionaryAtNumberPut(dict, index, elm); |
9491 if (!result.is_identical_to(dict)) { | 9492 if (!result.is_identical_to(dict)) { |
9492 // Dictionary needed to grow. | 9493 // Dictionary needed to grow. |
9493 clear_storage(); | 9494 clear_storage(); |
9494 set_storage(*result); | 9495 set_storage(*result); |
9495 } | 9496 } |
9496 } | 9497 } |
9497 | 9498 |
9498 void increase_index_offset(uint32_t delta) { | 9499 void increase_index_offset(uint32_t delta) { |
9499 if (JSObject::kMaxElementCount - index_offset_ < delta) { | 9500 if (JSObject::kMaxElementCount - index_offset_ < delta) { |
(...skipping 17 matching lines...) Expand all Loading... |
9517 array->set_length(*length); | 9518 array->set_length(*length); |
9518 array->set_elements(*storage_); | 9519 array->set_elements(*storage_); |
9519 return array; | 9520 return array; |
9520 } | 9521 } |
9521 | 9522 |
9522 private: | 9523 private: |
9523 // Convert storage to dictionary mode. | 9524 // Convert storage to dictionary mode. |
9524 void SetDictionaryMode(uint32_t index) { | 9525 void SetDictionaryMode(uint32_t index) { |
9525 ASSERT(fast_elements_); | 9526 ASSERT(fast_elements_); |
9526 Handle<FixedArray> current_storage(*storage_); | 9527 Handle<FixedArray> current_storage(*storage_); |
9527 Handle<NumberDictionary> slow_storage( | 9528 Handle<SeededNumberDictionary> slow_storage( |
9528 isolate_->factory()->NewNumberDictionary(current_storage->length())); | 9529 isolate_->factory()->NewSeededNumberDictionary( |
| 9530 current_storage->length())); |
9529 uint32_t current_length = static_cast<uint32_t>(current_storage->length()); | 9531 uint32_t current_length = static_cast<uint32_t>(current_storage->length()); |
9530 for (uint32_t i = 0; i < current_length; i++) { | 9532 for (uint32_t i = 0; i < current_length; i++) { |
9531 HandleScope loop_scope; | 9533 HandleScope loop_scope; |
9532 Handle<Object> element(current_storage->get(i)); | 9534 Handle<Object> element(current_storage->get(i)); |
9533 if (!element->IsTheHole()) { | 9535 if (!element->IsTheHole()) { |
9534 Handle<NumberDictionary> new_storage = | 9536 Handle<SeededNumberDictionary> new_storage = |
9535 isolate_->factory()->DictionaryAtNumberPut(slow_storage, i, element); | 9537 isolate_->factory()->DictionaryAtNumberPut(slow_storage, i, element); |
9536 if (!new_storage.is_identical_to(slow_storage)) { | 9538 if (!new_storage.is_identical_to(slow_storage)) { |
9537 slow_storage = loop_scope.CloseAndEscape(new_storage); | 9539 slow_storage = loop_scope.CloseAndEscape(new_storage); |
9538 } | 9540 } |
9539 } | 9541 } |
9540 } | 9542 } |
9541 clear_storage(); | 9543 clear_storage(); |
9542 set_storage(*slow_storage); | 9544 set_storage(*slow_storage); |
9543 fast_elements_ = false; | 9545 fast_elements_ = false; |
9544 } | 9546 } |
(...skipping 26 matching lines...) Expand all Loading... |
9571 // a 32-bit signed integer. | 9573 // a 32-bit signed integer. |
9572 ASSERT(static_cast<int32_t>(FixedArray::kMaxLength) >= 0); | 9574 ASSERT(static_cast<int32_t>(FixedArray::kMaxLength) >= 0); |
9573 int fast_length = static_cast<int>(length); | 9575 int fast_length = static_cast<int>(length); |
9574 Handle<FixedArray> elements(FixedArray::cast(array->elements())); | 9576 Handle<FixedArray> elements(FixedArray::cast(array->elements())); |
9575 for (int i = 0; i < fast_length; i++) { | 9577 for (int i = 0; i < fast_length; i++) { |
9576 if (!elements->get(i)->IsTheHole()) element_count++; | 9578 if (!elements->get(i)->IsTheHole()) element_count++; |
9577 } | 9579 } |
9578 break; | 9580 break; |
9579 } | 9581 } |
9580 case DICTIONARY_ELEMENTS: { | 9582 case DICTIONARY_ELEMENTS: { |
9581 Handle<NumberDictionary> dictionary( | 9583 Handle<SeededNumberDictionary> dictionary( |
9582 NumberDictionary::cast(array->elements())); | 9584 SeededNumberDictionary::cast(array->elements())); |
9583 int capacity = dictionary->Capacity(); | 9585 int capacity = dictionary->Capacity(); |
9584 for (int i = 0; i < capacity; i++) { | 9586 for (int i = 0; i < capacity; i++) { |
9585 Handle<Object> key(dictionary->KeyAt(i)); | 9587 Handle<Object> key(dictionary->KeyAt(i)); |
9586 if (dictionary->IsKey(*key)) { | 9588 if (dictionary->IsKey(*key)) { |
9587 element_count++; | 9589 element_count++; |
9588 } | 9590 } |
9589 } | 9591 } |
9590 break; | 9592 break; |
9591 } | 9593 } |
9592 default: | 9594 default: |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9660 uint32_t length = static_cast<uint32_t>(elements->length()); | 9662 uint32_t length = static_cast<uint32_t>(elements->length()); |
9661 if (range < length) length = range; | 9663 if (range < length) length = range; |
9662 for (uint32_t i = 0; i < length; i++) { | 9664 for (uint32_t i = 0; i < length; i++) { |
9663 if (!elements->get(i)->IsTheHole()) { | 9665 if (!elements->get(i)->IsTheHole()) { |
9664 indices->Add(i); | 9666 indices->Add(i); |
9665 } | 9667 } |
9666 } | 9668 } |
9667 break; | 9669 break; |
9668 } | 9670 } |
9669 case DICTIONARY_ELEMENTS: { | 9671 case DICTIONARY_ELEMENTS: { |
9670 Handle<NumberDictionary> dict(NumberDictionary::cast(object->elements())); | 9672 Handle<SeededNumberDictionary> dict( |
| 9673 SeededNumberDictionary::cast(object->elements())); |
9671 uint32_t capacity = dict->Capacity(); | 9674 uint32_t capacity = dict->Capacity(); |
9672 for (uint32_t j = 0; j < capacity; j++) { | 9675 for (uint32_t j = 0; j < capacity; j++) { |
9673 HandleScope loop_scope; | 9676 HandleScope loop_scope; |
9674 Handle<Object> k(dict->KeyAt(j)); | 9677 Handle<Object> k(dict->KeyAt(j)); |
9675 if (dict->IsKey(*k)) { | 9678 if (dict->IsKey(*k)) { |
9676 ASSERT(k->IsNumber()); | 9679 ASSERT(k->IsNumber()); |
9677 uint32_t index = static_cast<uint32_t>(k->Number()); | 9680 uint32_t index = static_cast<uint32_t>(k->Number()); |
9678 if (index < range) { | 9681 if (index < range) { |
9679 indices->Add(index); | 9682 indices->Add(index); |
9680 } | 9683 } |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9789 // Call GetElement on receiver, not its prototype, or getters won't | 9792 // Call GetElement on receiver, not its prototype, or getters won't |
9790 // have the correct receiver. | 9793 // have the correct receiver. |
9791 element_value = GetElement(receiver, j); | 9794 element_value = GetElement(receiver, j); |
9792 if (element_value.is_null()) return false; | 9795 if (element_value.is_null()) return false; |
9793 visitor->visit(j, element_value); | 9796 visitor->visit(j, element_value); |
9794 } | 9797 } |
9795 } | 9798 } |
9796 break; | 9799 break; |
9797 } | 9800 } |
9798 case DICTIONARY_ELEMENTS: { | 9801 case DICTIONARY_ELEMENTS: { |
9799 Handle<NumberDictionary> dict(receiver->element_dictionary()); | 9802 Handle<SeededNumberDictionary> dict(receiver->element_dictionary()); |
9800 List<uint32_t> indices(dict->Capacity() / 2); | 9803 List<uint32_t> indices(dict->Capacity() / 2); |
9801 // Collect all indices in the object and the prototypes less | 9804 // Collect all indices in the object and the prototypes less |
9802 // than length. This might introduce duplicates in the indices list. | 9805 // than length. This might introduce duplicates in the indices list. |
9803 CollectElementIndices(receiver, length, &indices); | 9806 CollectElementIndices(receiver, length, &indices); |
9804 indices.Sort(&compareUInt32); | 9807 indices.Sort(&compareUInt32); |
9805 int j = 0; | 9808 int j = 0; |
9806 int n = indices.length(); | 9809 int n = indices.length(); |
9807 while (j < n) { | 9810 while (j < n) { |
9808 HandleScope loop_scope; | 9811 HandleScope loop_scope; |
9809 uint32_t index = indices[j]; | 9812 uint32_t index = indices[j]; |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9938 if (fast_case) { | 9941 if (fast_case) { |
9939 // The backing storage array must have non-existing elements to | 9942 // The backing storage array must have non-existing elements to |
9940 // preserve holes across concat operations. | 9943 // preserve holes across concat operations. |
9941 storage = isolate->factory()->NewFixedArrayWithHoles( | 9944 storage = isolate->factory()->NewFixedArrayWithHoles( |
9942 estimate_result_length); | 9945 estimate_result_length); |
9943 } else { | 9946 } else { |
9944 // TODO(126): move 25% pre-allocation logic into Dictionary::Allocate | 9947 // TODO(126): move 25% pre-allocation logic into Dictionary::Allocate |
9945 uint32_t at_least_space_for = estimate_nof_elements + | 9948 uint32_t at_least_space_for = estimate_nof_elements + |
9946 (estimate_nof_elements >> 2); | 9949 (estimate_nof_elements >> 2); |
9947 storage = Handle<FixedArray>::cast( | 9950 storage = Handle<FixedArray>::cast( |
9948 isolate->factory()->NewNumberDictionary(at_least_space_for)); | 9951 isolate->factory()->NewSeededNumberDictionary(at_least_space_for)); |
9949 } | 9952 } |
9950 | 9953 |
9951 ArrayConcatVisitor visitor(isolate, storage, fast_case); | 9954 ArrayConcatVisitor visitor(isolate, storage, fast_case); |
9952 | 9955 |
9953 for (int i = 0; i < argument_count; i++) { | 9956 for (int i = 0; i < argument_count; i++) { |
9954 Handle<Object> obj(elements->get(i)); | 9957 Handle<Object> obj(elements->get(i)); |
9955 if (obj->IsJSArray()) { | 9958 if (obj->IsJSArray()) { |
9956 Handle<JSArray> array = Handle<JSArray>::cast(obj); | 9959 Handle<JSArray> array = Handle<JSArray>::cast(obj); |
9957 if (!IterateElements(isolate, array, &visitor)) { | 9960 if (!IterateElements(isolate, array, &visitor)) { |
9958 return Failure::Exception(); | 9961 return Failure::Exception(); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10024 return to; | 10027 return to; |
10025 } | 10028 } |
10026 | 10029 |
10027 | 10030 |
10028 // How many elements does this object/array have? | 10031 // How many elements does this object/array have? |
10029 RUNTIME_FUNCTION(MaybeObject*, Runtime_EstimateNumberOfElements) { | 10032 RUNTIME_FUNCTION(MaybeObject*, Runtime_EstimateNumberOfElements) { |
10030 ASSERT(args.length() == 1); | 10033 ASSERT(args.length() == 1); |
10031 CONVERT_CHECKED(JSObject, object, args[0]); | 10034 CONVERT_CHECKED(JSObject, object, args[0]); |
10032 HeapObject* elements = object->elements(); | 10035 HeapObject* elements = object->elements(); |
10033 if (elements->IsDictionary()) { | 10036 if (elements->IsDictionary()) { |
10034 return Smi::FromInt(NumberDictionary::cast(elements)->NumberOfElements()); | 10037 int result = SeededNumberDictionary::cast(elements)->NumberOfElements(); |
| 10038 return Smi::FromInt(result); |
10035 } else if (object->IsJSArray()) { | 10039 } else if (object->IsJSArray()) { |
10036 return JSArray::cast(object)->length(); | 10040 return JSArray::cast(object)->length(); |
10037 } else { | 10041 } else { |
10038 return Smi::FromInt(FixedArray::cast(elements)->length()); | 10042 return Smi::FromInt(FixedArray::cast(elements)->length()); |
10039 } | 10043 } |
10040 } | 10044 } |
10041 | 10045 |
10042 | 10046 |
10043 RUNTIME_FUNCTION(MaybeObject*, Runtime_SwapElements) { | 10047 RUNTIME_FUNCTION(MaybeObject*, Runtime_SwapElements) { |
10044 HandleScope handle_scope(isolate); | 10048 HandleScope handle_scope(isolate); |
(...skipping 3188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13233 } else { | 13237 } else { |
13234 // Handle last resort GC and make sure to allow future allocations | 13238 // Handle last resort GC and make sure to allow future allocations |
13235 // to grow the heap without causing GCs (if possible). | 13239 // to grow the heap without causing GCs (if possible). |
13236 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13240 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13237 isolate->heap()->CollectAllGarbage(false); | 13241 isolate->heap()->CollectAllGarbage(false); |
13238 } | 13242 } |
13239 } | 13243 } |
13240 | 13244 |
13241 | 13245 |
13242 } } // namespace v8::internal | 13246 } } // namespace v8::internal |
OLD | NEW |