| OLD | NEW |
| 1 // Copyright 2012 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 |
| (...skipping 2438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2449 } | 2449 } |
| 2450 set_instance_descriptors(DescriptorArray::cast(new_descriptors)); | 2450 set_instance_descriptors(DescriptorArray::cast(new_descriptors)); |
| 2451 return this; | 2451 return this; |
| 2452 } | 2452 } |
| 2453 | 2453 |
| 2454 | 2454 |
| 2455 Handle<Map> JSObject::GetElementsTransitionMap(Handle<JSObject> object, | 2455 Handle<Map> JSObject::GetElementsTransitionMap(Handle<JSObject> object, |
| 2456 ElementsKind to_kind) { | 2456 ElementsKind to_kind) { |
| 2457 Isolate* isolate = object->GetIsolate(); | 2457 Isolate* isolate = object->GetIsolate(); |
| 2458 CALL_HEAP_FUNCTION(isolate, | 2458 CALL_HEAP_FUNCTION(isolate, |
| 2459 object->GetElementsTransitionMap(to_kind), | 2459 object->GetElementsTransitionMap(isolate, to_kind), |
| 2460 Map); | 2460 Map); |
| 2461 } | 2461 } |
| 2462 | 2462 |
| 2463 | 2463 |
| 2464 MaybeObject* JSObject::GetElementsTransitionMap(ElementsKind to_kind) { | 2464 MaybeObject* JSObject::GetElementsTransitionMapSlow(ElementsKind to_kind) { |
| 2465 Map* current_map = map(); | 2465 Map* current_map = map(); |
| 2466 ElementsKind from_kind = current_map->elements_kind(); | 2466 ElementsKind from_kind = current_map->elements_kind(); |
| 2467 | 2467 |
| 2468 if (from_kind == to_kind) return current_map; | 2468 if (from_kind == to_kind) return current_map; |
| 2469 | 2469 |
| 2470 // Only objects with FastProperties can have DescriptorArrays and can track | 2470 // Only objects with FastProperties can have DescriptorArrays and can track |
| 2471 // element-related maps. Also don't add descriptors to maps that are shared. | 2471 // element-related maps. Also don't add descriptors to maps that are shared. |
| 2472 bool safe_to_add_transition = HasFastProperties() && | 2472 bool safe_to_add_transition = HasFastProperties() && |
| 2473 !current_map->IsUndefined() && | 2473 !current_map->IsUndefined() && |
| 2474 !current_map->is_shared(); | 2474 !current_map->is_shared(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 2496 // one. | 2496 // one. |
| 2497 { MaybeObject* maybe_map = current_map->CopyDropTransitions(); | 2497 { MaybeObject* maybe_map = current_map->CopyDropTransitions(); |
| 2498 if (!maybe_map->To(&new_map)) return maybe_map; | 2498 if (!maybe_map->To(&new_map)) return maybe_map; |
| 2499 } | 2499 } |
| 2500 | 2500 |
| 2501 new_map->set_elements_kind(to_kind); | 2501 new_map->set_elements_kind(to_kind); |
| 2502 | 2502 |
| 2503 // Only remember the map transition if the object's map is NOT equal to the | 2503 // Only remember the map transition if the object's map is NOT equal to the |
| 2504 // global object_function's map and there is not an already existing | 2504 // global object_function's map and there is not an already existing |
| 2505 // non-matching element transition. | 2505 // non-matching element transition. |
| 2506 Context* global_context = GetIsolate()->context()->global_context(); |
| 2506 bool allow_map_transition = safe_to_add_transition && | 2507 bool allow_map_transition = safe_to_add_transition && |
| 2507 (GetIsolate()->context()->global_context()->object_function()->map() != | 2508 (global_context->object_function()->map() != map()); |
| 2508 map()); | |
| 2509 if (allow_map_transition) { | 2509 if (allow_map_transition) { |
| 2510 MaybeObject* maybe_transition = | 2510 MaybeObject* maybe_transition = |
| 2511 current_map->AddElementsTransition(to_kind, new_map); | 2511 current_map->AddElementsTransition(to_kind, new_map); |
| 2512 if (maybe_transition->IsFailure()) return maybe_transition; | 2512 if (maybe_transition->IsFailure()) return maybe_transition; |
| 2513 } | 2513 } |
| 2514 return new_map; | 2514 return new_map; |
| 2515 } | 2515 } |
| 2516 | 2516 |
| 2517 | 2517 |
| 2518 void JSObject::LocalLookupRealNamedProperty(String* name, | 2518 void JSObject::LocalLookupRealNamedProperty(String* name, |
| (...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3571 } | 3571 } |
| 3572 } | 3572 } |
| 3573 | 3573 |
| 3574 // Switch to using the dictionary as the backing storage for elements. | 3574 // Switch to using the dictionary as the backing storage for elements. |
| 3575 if (is_arguments) { | 3575 if (is_arguments) { |
| 3576 FixedArray::cast(elements())->set(1, dictionary); | 3576 FixedArray::cast(elements())->set(1, dictionary); |
| 3577 } else { | 3577 } else { |
| 3578 // Set the new map first to satify the elements type assert in | 3578 // Set the new map first to satify the elements type assert in |
| 3579 // set_elements(). | 3579 // set_elements(). |
| 3580 Object* new_map; | 3580 Object* new_map; |
| 3581 MaybeObject* maybe = GetElementsTransitionMap(DICTIONARY_ELEMENTS); | 3581 MaybeObject* maybe = GetElementsTransitionMap(GetIsolate(), |
| 3582 DICTIONARY_ELEMENTS); |
| 3582 if (!maybe->ToObject(&new_map)) return maybe; | 3583 if (!maybe->ToObject(&new_map)) return maybe; |
| 3583 set_map(Map::cast(new_map)); | 3584 set_map(Map::cast(new_map)); |
| 3584 set_elements(dictionary); | 3585 set_elements(dictionary); |
| 3585 } | 3586 } |
| 3586 | 3587 |
| 3587 old_map->GetHeap()->isolate()->counters()->elements_to_dictionary()-> | 3588 old_map->GetHeap()->isolate()->counters()->elements_to_dictionary()-> |
| 3588 Increment(); | 3589 Increment(); |
| 3589 | 3590 |
| 3590 #ifdef DEBUG | 3591 #ifdef DEBUG |
| 3591 if (FLAG_trace_normalization) { | 3592 if (FLAG_trace_normalization) { |
| (...skipping 3702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7294 if (!shared_info->script()->IsScript()) return false; | 7295 if (!shared_info->script()->IsScript()) return false; |
| 7295 if (shared_info->optimization_disabled()) return false; | 7296 if (shared_info->optimization_disabled()) return false; |
| 7296 Code* code = shared_info->code(); | 7297 Code* code = shared_info->code(); |
| 7297 if (code->kind() == Code::OPTIMIZED_FUNCTION) return true; | 7298 if (code->kind() == Code::OPTIMIZED_FUNCTION) return true; |
| 7298 // If we never ran this (unlikely) then lets try to optimize it. | 7299 // If we never ran this (unlikely) then lets try to optimize it. |
| 7299 if (code->kind() != Code::FUNCTION) return true; | 7300 if (code->kind() != Code::FUNCTION) return true; |
| 7300 return code->optimizable(); | 7301 return code->optimizable(); |
| 7301 } | 7302 } |
| 7302 | 7303 |
| 7303 | 7304 |
| 7304 Object* JSFunction::SetInstancePrototype(Object* value) { | 7305 MaybeObject* JSFunction::SetInstancePrototype(Object* value) { |
| 7305 ASSERT(value->IsJSObject()); | 7306 ASSERT(value->IsJSObject()); |
| 7306 Heap* heap = GetHeap(); | 7307 Heap* heap = GetHeap(); |
| 7307 if (has_initial_map()) { | 7308 if (has_initial_map()) { |
| 7308 initial_map()->set_prototype(value); | 7309 // If the function has allocated the initial map |
| 7310 // replace it with a copy containing the new prototype. |
| 7311 Map* new_map; |
| 7312 MaybeObject* maybe_new_map = initial_map()->CopyDropTransitions(); |
| 7313 if (!maybe_new_map->To(&new_map)) return maybe_new_map; |
| 7314 new_map->set_prototype(value); |
| 7315 MaybeObject* maybe_object = |
| 7316 set_initial_map_and_cache_transitions(new_map); |
| 7317 if (maybe_object->IsFailure()) return maybe_object; |
| 7309 } else { | 7318 } else { |
| 7310 // Put the value in the initial map field until an initial map is | 7319 // Put the value in the initial map field until an initial map is |
| 7311 // needed. At that point, a new initial map is created and the | 7320 // needed. At that point, a new initial map is created and the |
| 7312 // prototype is put into the initial map where it belongs. | 7321 // prototype is put into the initial map where it belongs. |
| 7313 set_prototype_or_initial_map(value); | 7322 set_prototype_or_initial_map(value); |
| 7314 } | 7323 } |
| 7315 heap->ClearInstanceofCache(); | 7324 heap->ClearInstanceofCache(); |
| 7316 return value; | 7325 return value; |
| 7317 } | 7326 } |
| 7318 | 7327 |
| (...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8314 // The resized array has FAST_SMI_ONLY_ELEMENTS if the capacity mode forces | 8323 // The resized array has FAST_SMI_ONLY_ELEMENTS if the capacity mode forces |
| 8315 // it, or if it's allowed and the old elements array contained only SMIs. | 8324 // it, or if it's allowed and the old elements array contained only SMIs. |
| 8316 bool has_fast_smi_only_elements = | 8325 bool has_fast_smi_only_elements = |
| 8317 (set_capacity_mode == kForceSmiOnlyElements) || | 8326 (set_capacity_mode == kForceSmiOnlyElements) || |
| 8318 ((set_capacity_mode == kAllowSmiOnlyElements) && | 8327 ((set_capacity_mode == kAllowSmiOnlyElements) && |
| 8319 (elements()->map()->has_fast_smi_only_elements() || | 8328 (elements()->map()->has_fast_smi_only_elements() || |
| 8320 elements() == heap->empty_fixed_array())); | 8329 elements() == heap->empty_fixed_array())); |
| 8321 ElementsKind elements_kind = has_fast_smi_only_elements | 8330 ElementsKind elements_kind = has_fast_smi_only_elements |
| 8322 ? FAST_SMI_ONLY_ELEMENTS | 8331 ? FAST_SMI_ONLY_ELEMENTS |
| 8323 : FAST_ELEMENTS; | 8332 : FAST_ELEMENTS; |
| 8324 MaybeObject* maybe = GetElementsTransitionMap(elements_kind); | 8333 MaybeObject* maybe = GetElementsTransitionMap(GetIsolate(), elements_kind); |
| 8325 if (!maybe->ToObject(&object)) return maybe; | 8334 if (!maybe->ToObject(&object)) return maybe; |
| 8326 new_map = Map::cast(object); | 8335 new_map = Map::cast(object); |
| 8327 } | 8336 } |
| 8328 | 8337 |
| 8329 FixedArrayBase* old_elements_raw = elements(); | 8338 FixedArrayBase* old_elements_raw = elements(); |
| 8330 ElementsKind elements_kind = GetElementsKind(); | 8339 ElementsKind elements_kind = GetElementsKind(); |
| 8331 switch (elements_kind) { | 8340 switch (elements_kind) { |
| 8332 case FAST_SMI_ONLY_ELEMENTS: | 8341 case FAST_SMI_ONLY_ELEMENTS: |
| 8333 case FAST_ELEMENTS: { | 8342 case FAST_ELEMENTS: { |
| 8334 AssertNoAllocation no_gc; | 8343 AssertNoAllocation no_gc; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8398 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 8407 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 8399 case EXTERNAL_FLOAT_ELEMENTS: | 8408 case EXTERNAL_FLOAT_ELEMENTS: |
| 8400 case EXTERNAL_DOUBLE_ELEMENTS: | 8409 case EXTERNAL_DOUBLE_ELEMENTS: |
| 8401 case EXTERNAL_PIXEL_ELEMENTS: | 8410 case EXTERNAL_PIXEL_ELEMENTS: |
| 8402 UNREACHABLE(); | 8411 UNREACHABLE(); |
| 8403 break; | 8412 break; |
| 8404 } | 8413 } |
| 8405 | 8414 |
| 8406 if (FLAG_trace_elements_transitions) { | 8415 if (FLAG_trace_elements_transitions) { |
| 8407 PrintElementsTransition(stdout, elements_kind, old_elements_raw, | 8416 PrintElementsTransition(stdout, elements_kind, old_elements_raw, |
| 8408 FAST_ELEMENTS, new_elements); | 8417 GetElementsKind(), new_elements); |
| 8409 } | 8418 } |
| 8410 | 8419 |
| 8411 // Update the length if necessary. | 8420 // Update the length if necessary. |
| 8412 if (IsJSArray()) { | 8421 if (IsJSArray()) { |
| 8413 JSArray::cast(this)->set_length(Smi::FromInt(length)); | 8422 JSArray::cast(this)->set_length(Smi::FromInt(length)); |
| 8414 } | 8423 } |
| 8415 | 8424 |
| 8416 return new_elements; | 8425 return new_elements; |
| 8417 } | 8426 } |
| 8418 | 8427 |
| 8419 | 8428 |
| 8420 MaybeObject* JSObject::SetFastDoubleElementsCapacityAndLength( | 8429 MaybeObject* JSObject::SetFastDoubleElementsCapacityAndLength( |
| 8421 int capacity, | 8430 int capacity, |
| 8422 int length) { | 8431 int length) { |
| 8423 Heap* heap = GetHeap(); | 8432 Heap* heap = GetHeap(); |
| 8424 // We should never end in here with a pixel or external array. | 8433 // We should never end in here with a pixel or external array. |
| 8425 ASSERT(!HasExternalArrayElements()); | 8434 ASSERT(!HasExternalArrayElements()); |
| 8426 | 8435 |
| 8427 Object* obj; | 8436 Object* obj; |
| 8428 { MaybeObject* maybe_obj = | 8437 { MaybeObject* maybe_obj = |
| 8429 heap->AllocateUninitializedFixedDoubleArray(capacity); | 8438 heap->AllocateUninitializedFixedDoubleArray(capacity); |
| 8430 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 8439 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 8431 } | 8440 } |
| 8432 FixedDoubleArray* elems = FixedDoubleArray::cast(obj); | 8441 FixedDoubleArray* elems = FixedDoubleArray::cast(obj); |
| 8433 | 8442 |
| 8434 { MaybeObject* maybe_obj = | 8443 { MaybeObject* maybe_obj = |
| 8435 GetElementsTransitionMap(FAST_DOUBLE_ELEMENTS); | 8444 GetElementsTransitionMap(heap->isolate(), FAST_DOUBLE_ELEMENTS); |
| 8436 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 8445 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 8437 } | 8446 } |
| 8438 Map* new_map = Map::cast(obj); | 8447 Map* new_map = Map::cast(obj); |
| 8439 | 8448 |
| 8440 FixedArrayBase* old_elements = elements(); | 8449 FixedArrayBase* old_elements = elements(); |
| 8441 ElementsKind elements_kind(GetElementsKind()); | 8450 ElementsKind elements_kind(GetElementsKind()); |
| 8442 AssertNoAllocation no_gc; | 8451 AssertNoAllocation no_gc; |
| 8443 switch (elements_kind) { | 8452 switch (elements_kind) { |
| 8444 case FAST_SMI_ONLY_ELEMENTS: | 8453 case FAST_SMI_ONLY_ELEMENTS: |
| 8445 case FAST_ELEMENTS: { | 8454 case FAST_ELEMENTS: { |
| (...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9235 // Convert to fast double elements if appropriate. | 9244 // Convert to fast double elements if appropriate. |
| 9236 if (HasFastSmiOnlyElements() && !value->IsSmi() && value->IsNumber()) { | 9245 if (HasFastSmiOnlyElements() && !value->IsSmi() && value->IsNumber()) { |
| 9237 MaybeObject* maybe = | 9246 MaybeObject* maybe = |
| 9238 SetFastDoubleElementsCapacityAndLength(new_capacity, array_length); | 9247 SetFastDoubleElementsCapacityAndLength(new_capacity, array_length); |
| 9239 if (maybe->IsFailure()) return maybe; | 9248 if (maybe->IsFailure()) return maybe; |
| 9240 FixedDoubleArray::cast(elements())->set(index, value->Number()); | 9249 FixedDoubleArray::cast(elements())->set(index, value->Number()); |
| 9241 return value; | 9250 return value; |
| 9242 } | 9251 } |
| 9243 // Change elements kind from SMI_ONLY to generic FAST if necessary. | 9252 // Change elements kind from SMI_ONLY to generic FAST if necessary. |
| 9244 if (HasFastSmiOnlyElements() && !value->IsSmi()) { | 9253 if (HasFastSmiOnlyElements() && !value->IsSmi()) { |
| 9245 MaybeObject* maybe_new_map = GetElementsTransitionMap(FAST_ELEMENTS); | 9254 MaybeObject* maybe_new_map = GetElementsTransitionMap(GetIsolate(), |
| 9255 FAST_ELEMENTS); |
| 9246 Map* new_map; | 9256 Map* new_map; |
| 9247 if (!maybe_new_map->To<Map>(&new_map)) return maybe_new_map; | 9257 if (!maybe_new_map->To<Map>(&new_map)) return maybe_new_map; |
| 9248 set_map(new_map); | 9258 set_map(new_map); |
| 9249 if (FLAG_trace_elements_transitions) { | 9259 if (FLAG_trace_elements_transitions) { |
| 9250 PrintElementsTransition(stdout, FAST_SMI_ONLY_ELEMENTS, elements(), | 9260 PrintElementsTransition(stdout, FAST_SMI_ONLY_ELEMENTS, elements(), |
| 9251 FAST_ELEMENTS, elements()); | 9261 FAST_ELEMENTS, elements()); |
| 9252 } | 9262 } |
| 9253 } | 9263 } |
| 9254 // Increase backing store capacity if that's been decided previously. | 9264 // Increase backing store capacity if that's been decided previously. |
| 9255 if (new_capacity != capacity) { | 9265 if (new_capacity != capacity) { |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9645 | 9655 |
| 9646 | 9656 |
| 9647 Handle<Object> JSObject::TransitionElementsKind(Handle<JSObject> object, | 9657 Handle<Object> JSObject::TransitionElementsKind(Handle<JSObject> object, |
| 9648 ElementsKind to_kind) { | 9658 ElementsKind to_kind) { |
| 9649 CALL_HEAP_FUNCTION(object->GetIsolate(), | 9659 CALL_HEAP_FUNCTION(object->GetIsolate(), |
| 9650 object->TransitionElementsKind(to_kind), | 9660 object->TransitionElementsKind(to_kind), |
| 9651 Object); | 9661 Object); |
| 9652 } | 9662 } |
| 9653 | 9663 |
| 9654 | 9664 |
| 9655 MUST_USE_RESULT MaybeObject* JSObject::TransitionElementsKind( | 9665 MaybeObject* JSObject::TransitionElementsKind(ElementsKind to_kind) { |
| 9656 ElementsKind to_kind) { | |
| 9657 ElementsKind from_kind = map()->elements_kind(); | 9666 ElementsKind from_kind = map()->elements_kind(); |
| 9667 |
| 9668 Isolate* isolate = GetIsolate(); |
| 9669 if (from_kind == FAST_SMI_ONLY_ELEMENTS && |
| 9670 (to_kind == FAST_ELEMENTS || |
| 9671 elements() == isolate->heap()->empty_fixed_array())) { |
| 9672 MaybeObject* maybe_new_map = GetElementsTransitionMap(isolate, to_kind); |
| 9673 Map* new_map; |
| 9674 if (!maybe_new_map->To(&new_map)) return maybe_new_map; |
| 9675 set_map(new_map); |
| 9676 if (FLAG_trace_elements_transitions) { |
| 9677 FixedArrayBase* elms = FixedArrayBase::cast(elements()); |
| 9678 PrintElementsTransition(stdout, from_kind, elms, to_kind, elms); |
| 9679 } |
| 9680 return this; |
| 9681 } |
| 9682 |
| 9658 FixedArrayBase* elms = FixedArrayBase::cast(elements()); | 9683 FixedArrayBase* elms = FixedArrayBase::cast(elements()); |
| 9659 uint32_t capacity = static_cast<uint32_t>(elms->length()); | 9684 uint32_t capacity = static_cast<uint32_t>(elms->length()); |
| 9660 uint32_t length = capacity; | 9685 uint32_t length = capacity; |
| 9661 | 9686 |
| 9662 if (IsJSArray()) { | 9687 if (IsJSArray()) { |
| 9663 Object* raw_length = JSArray::cast(this)->length(); | 9688 Object* raw_length = JSArray::cast(this)->length(); |
| 9664 if (raw_length->IsUndefined()) { | 9689 if (raw_length->IsUndefined()) { |
| 9665 // If length is undefined, then JSArray is being initialized and has no | 9690 // If length is undefined, then JSArray is being initialized and has no |
| 9666 // elements, assume a length of zero. | 9691 // elements, assume a length of zero. |
| 9667 length = 0; | 9692 length = 0; |
| 9668 } else { | 9693 } else { |
| 9669 CHECK(JSArray::cast(this)->length()->ToArrayIndex(&length)); | 9694 CHECK(JSArray::cast(this)->length()->ToArrayIndex(&length)); |
| 9670 } | 9695 } |
| 9671 } | 9696 } |
| 9672 | 9697 |
| 9673 if ((from_kind == FAST_SMI_ONLY_ELEMENTS && to_kind == FAST_ELEMENTS) || | |
| 9674 (length == 0)) { | |
| 9675 MaybeObject* maybe_new_map = GetElementsTransitionMap(to_kind); | |
| 9676 Map* new_map; | |
| 9677 if (!maybe_new_map->To(&new_map)) return maybe_new_map; | |
| 9678 if (FLAG_trace_elements_transitions) { | |
| 9679 PrintElementsTransition(stdout, from_kind, elms, to_kind, elms); | |
| 9680 } | |
| 9681 set_map(new_map); | |
| 9682 return this; | |
| 9683 } | |
| 9684 | |
| 9685 if (from_kind == FAST_SMI_ONLY_ELEMENTS && | 9698 if (from_kind == FAST_SMI_ONLY_ELEMENTS && |
| 9686 to_kind == FAST_DOUBLE_ELEMENTS) { | 9699 to_kind == FAST_DOUBLE_ELEMENTS) { |
| 9687 MaybeObject* maybe_result = | 9700 MaybeObject* maybe_result = |
| 9688 SetFastDoubleElementsCapacityAndLength(capacity, length); | 9701 SetFastDoubleElementsCapacityAndLength(capacity, length); |
| 9689 if (maybe_result->IsFailure()) return maybe_result; | 9702 if (maybe_result->IsFailure()) return maybe_result; |
| 9690 return this; | 9703 return this; |
| 9691 } | 9704 } |
| 9692 | 9705 |
| 9693 if (from_kind == FAST_DOUBLE_ELEMENTS && to_kind == FAST_ELEMENTS) { | 9706 if (from_kind == FAST_DOUBLE_ELEMENTS && to_kind == FAST_ELEMENTS) { |
| 9694 MaybeObject* maybe_result = SetFastElementsCapacityAndLength( | 9707 MaybeObject* maybe_result = SetFastElementsCapacityAndLength( |
| (...skipping 1546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11241 // Convert to fast elements containing only the existing properties. | 11254 // Convert to fast elements containing only the existing properties. |
| 11242 // Ordering is irrelevant, since we are going to sort anyway. | 11255 // Ordering is irrelevant, since we are going to sort anyway. |
| 11243 SeededNumberDictionary* dict = element_dictionary(); | 11256 SeededNumberDictionary* dict = element_dictionary(); |
| 11244 if (IsJSArray() || dict->requires_slow_elements() || | 11257 if (IsJSArray() || dict->requires_slow_elements() || |
| 11245 dict->max_number_key() >= limit) { | 11258 dict->max_number_key() >= limit) { |
| 11246 return PrepareSlowElementsForSort(limit); | 11259 return PrepareSlowElementsForSort(limit); |
| 11247 } | 11260 } |
| 11248 // Convert to fast elements. | 11261 // Convert to fast elements. |
| 11249 | 11262 |
| 11250 Object* obj; | 11263 Object* obj; |
| 11251 { MaybeObject* maybe_obj = GetElementsTransitionMap(FAST_ELEMENTS); | 11264 { MaybeObject* maybe_obj = GetElementsTransitionMap(GetIsolate(), |
| 11265 FAST_ELEMENTS); |
| 11252 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 11266 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 11253 } | 11267 } |
| 11254 Map* new_map = Map::cast(obj); | 11268 Map* new_map = Map::cast(obj); |
| 11255 | 11269 |
| 11256 PretenureFlag tenure = heap->InNewSpace(this) ? NOT_TENURED: TENURED; | 11270 PretenureFlag tenure = heap->InNewSpace(this) ? NOT_TENURED: TENURED; |
| 11257 Object* new_array; | 11271 Object* new_array; |
| 11258 { MaybeObject* maybe_new_array = | 11272 { MaybeObject* maybe_new_array = |
| 11259 heap->AllocateFixedArray(dict->NumberOfElements(), tenure); | 11273 heap->AllocateFixedArray(dict->NumberOfElements(), tenure); |
| 11260 if (!maybe_new_array->ToObject(&new_array)) return maybe_new_array; | 11274 if (!maybe_new_array->ToObject(&new_array)) return maybe_new_array; |
| 11261 } | 11275 } |
| (...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12809 if (break_point_objects()->IsUndefined()) return 0; | 12823 if (break_point_objects()->IsUndefined()) return 0; |
| 12810 // Single break point. | 12824 // Single break point. |
| 12811 if (!break_point_objects()->IsFixedArray()) return 1; | 12825 if (!break_point_objects()->IsFixedArray()) return 1; |
| 12812 // Multiple break points. | 12826 // Multiple break points. |
| 12813 return FixedArray::cast(break_point_objects())->length(); | 12827 return FixedArray::cast(break_point_objects())->length(); |
| 12814 } | 12828 } |
| 12815 #endif // ENABLE_DEBUGGER_SUPPORT | 12829 #endif // ENABLE_DEBUGGER_SUPPORT |
| 12816 | 12830 |
| 12817 | 12831 |
| 12818 } } // namespace v8::internal | 12832 } } // namespace v8::internal |
| OLD | NEW |