Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/objects.cc

Issue 10386045: Properly set ElementsKind of empty FAST_DOUBLE_ELEMENTS arrays when transitioning. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/builtins.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 8635 matching lines...) Expand 10 before | Expand all | Expand 10 after
8646 } 8646 }
8647 8647
8648 8648
8649 MaybeObject* JSObject::SetFastDoubleElementsCapacityAndLength( 8649 MaybeObject* JSObject::SetFastDoubleElementsCapacityAndLength(
8650 int capacity, 8650 int capacity,
8651 int length) { 8651 int length) {
8652 Heap* heap = GetHeap(); 8652 Heap* heap = GetHeap();
8653 // We should never end in here with a pixel or external array. 8653 // We should never end in here with a pixel or external array.
8654 ASSERT(!HasExternalArrayElements()); 8654 ASSERT(!HasExternalArrayElements());
8655 8655
8656 FixedDoubleArray* elems; 8656 FixedArrayBase* elems;
8657 { MaybeObject* maybe_obj = 8657 { MaybeObject* maybe_obj =
8658 heap->AllocateUninitializedFixedDoubleArray(capacity); 8658 heap->AllocateUninitializedFixedDoubleArray(capacity);
8659 if (!maybe_obj->To(&elems)) return maybe_obj; 8659 if (!maybe_obj->To(&elems)) return maybe_obj;
8660 } 8660 }
8661 8661
8662 Map* new_map; 8662 Map* new_map;
8663 { MaybeObject* maybe_obj = 8663 { MaybeObject* maybe_obj =
8664 GetElementsTransitionMap(heap->isolate(), FAST_DOUBLE_ELEMENTS); 8664 GetElementsTransitionMap(heap->isolate(), FAST_DOUBLE_ELEMENTS);
8665 if (!maybe_obj->To(&new_map)) return maybe_obj; 8665 if (!maybe_obj->To(&new_map)) return maybe_obj;
8666 } 8666 }
(...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after
9800 CALL_HEAP_FUNCTION(object->GetIsolate(), 9800 CALL_HEAP_FUNCTION(object->GetIsolate(),
9801 object->TransitionElementsKind(to_kind), 9801 object->TransitionElementsKind(to_kind),
9802 Object); 9802 Object);
9803 } 9803 }
9804 9804
9805 9805
9806 MaybeObject* JSObject::TransitionElementsKind(ElementsKind to_kind) { 9806 MaybeObject* JSObject::TransitionElementsKind(ElementsKind to_kind) {
9807 ElementsKind from_kind = map()->elements_kind(); 9807 ElementsKind from_kind = map()->elements_kind();
9808 9808
9809 Isolate* isolate = GetIsolate(); 9809 Isolate* isolate = GetIsolate();
9810 if (from_kind == FAST_SMI_ONLY_ELEMENTS && 9810 if ((from_kind == FAST_SMI_ONLY_ELEMENTS ||
9811 (to_kind == FAST_ELEMENTS || 9811 elements() == isolate->heap()->empty_fixed_array()) &&
9812 elements() == isolate->heap()->empty_fixed_array())) { 9812 to_kind == FAST_ELEMENTS) {
9813 ASSERT(from_kind != FAST_ELEMENTS);
9813 MaybeObject* maybe_new_map = GetElementsTransitionMap(isolate, to_kind); 9814 MaybeObject* maybe_new_map = GetElementsTransitionMap(isolate, to_kind);
9814 Map* new_map; 9815 Map* new_map;
9815 if (!maybe_new_map->To(&new_map)) return maybe_new_map; 9816 if (!maybe_new_map->To(&new_map)) return maybe_new_map;
9816 set_map(new_map); 9817 set_map(new_map);
9817 if (FLAG_trace_elements_transitions) { 9818 if (FLAG_trace_elements_transitions) {
9818 FixedArrayBase* elms = FixedArrayBase::cast(elements()); 9819 FixedArrayBase* elms = FixedArrayBase::cast(elements());
9819 PrintElementsTransition(stdout, from_kind, elms, to_kind, elms); 9820 PrintElementsTransition(stdout, from_kind, elms, to_kind, elms);
9820 } 9821 }
9821 return this; 9822 return this;
9822 } 9823 }
(...skipping 3287 matching lines...) Expand 10 before | Expand all | Expand 10 after
13110 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 13111 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
13111 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 13112 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
13112 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 13113 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
13113 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 13114 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
13114 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 13115 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
13115 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 13116 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
13116 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 13117 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
13117 } 13118 }
13118 13119
13119 } } // namespace v8::internal 13120 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/builtins.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698