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 8503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8514 } | 8514 } |
8515 | 8515 |
8516 | 8516 |
8517 MaybeObject* JSObject::SetFastDoubleElementsCapacityAndLength( | 8517 MaybeObject* JSObject::SetFastDoubleElementsCapacityAndLength( |
8518 int capacity, | 8518 int capacity, |
8519 int length) { | 8519 int length) { |
8520 Heap* heap = GetHeap(); | 8520 Heap* heap = GetHeap(); |
8521 // We should never end in here with a pixel or external array. | 8521 // We should never end in here with a pixel or external array. |
8522 ASSERT(!HasExternalArrayElements()); | 8522 ASSERT(!HasExternalArrayElements()); |
8523 | 8523 |
8524 FixedDoubleArray* elems; | 8524 FixedArrayBase* elems; |
8525 { MaybeObject* maybe_obj = | 8525 { MaybeObject* maybe_obj = |
8526 heap->AllocateUninitializedFixedDoubleArray(capacity); | 8526 heap->AllocateUninitializedFixedDoubleArray(capacity); |
8527 if (!maybe_obj->To(&elems)) return maybe_obj; | 8527 if (!maybe_obj->To(&elems)) return maybe_obj; |
8528 } | 8528 } |
8529 | 8529 |
8530 Map* new_map; | 8530 Map* new_map; |
8531 { MaybeObject* maybe_obj = | 8531 { MaybeObject* maybe_obj = |
8532 GetElementsTransitionMap(heap->isolate(), FAST_DOUBLE_ELEMENTS); | 8532 GetElementsTransitionMap(heap->isolate(), FAST_DOUBLE_ELEMENTS); |
8533 if (!maybe_obj->To(&new_map)) return maybe_obj; | 8533 if (!maybe_obj->To(&new_map)) return maybe_obj; |
8534 } | 8534 } |
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9665 CALL_HEAP_FUNCTION(object->GetIsolate(), | 9665 CALL_HEAP_FUNCTION(object->GetIsolate(), |
9666 object->TransitionElementsKind(to_kind), | 9666 object->TransitionElementsKind(to_kind), |
9667 Object); | 9667 Object); |
9668 } | 9668 } |
9669 | 9669 |
9670 | 9670 |
9671 MaybeObject* JSObject::TransitionElementsKind(ElementsKind to_kind) { | 9671 MaybeObject* JSObject::TransitionElementsKind(ElementsKind to_kind) { |
9672 ElementsKind from_kind = map()->elements_kind(); | 9672 ElementsKind from_kind = map()->elements_kind(); |
9673 | 9673 |
9674 Isolate* isolate = GetIsolate(); | 9674 Isolate* isolate = GetIsolate(); |
9675 if (from_kind == FAST_SMI_ONLY_ELEMENTS && | 9675 if ((from_kind == FAST_SMI_ONLY_ELEMENTS || |
9676 (to_kind == FAST_ELEMENTS || | 9676 elements() == isolate->heap()->empty_fixed_array()) && |
9677 elements() == isolate->heap()->empty_fixed_array())) { | 9677 to_kind == FAST_ELEMENTS) { |
| 9678 ASSERT(from_kind != FAST_ELEMENTS); |
9678 MaybeObject* maybe_new_map = GetElementsTransitionMap(isolate, to_kind); | 9679 MaybeObject* maybe_new_map = GetElementsTransitionMap(isolate, to_kind); |
9679 Map* new_map; | 9680 Map* new_map; |
9680 if (!maybe_new_map->To(&new_map)) return maybe_new_map; | 9681 if (!maybe_new_map->To(&new_map)) return maybe_new_map; |
9681 set_map(new_map); | 9682 set_map(new_map); |
9682 if (FLAG_trace_elements_transitions) { | 9683 if (FLAG_trace_elements_transitions) { |
9683 FixedArrayBase* elms = FixedArrayBase::cast(elements()); | 9684 FixedArrayBase* elms = FixedArrayBase::cast(elements()); |
9684 PrintElementsTransition(stdout, from_kind, elms, to_kind, elms); | 9685 PrintElementsTransition(stdout, from_kind, elms, to_kind, elms); |
9685 } | 9686 } |
9686 return this; | 9687 return this; |
9687 } | 9688 } |
(...skipping 3287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12975 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 12976 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
12976 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 12977 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
12977 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 12978 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
12978 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 12979 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
12979 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 12980 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
12980 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 12981 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
12981 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 12982 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
12982 } | 12983 } |
12983 | 12984 |
12984 } } // namespace v8::internal | 12985 } } // namespace v8::internal |
OLD | NEW |