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

Side by Side Diff: src/objects.cc

Issue 1340033002: builtins.cc return PackedElementsKind where applicable (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fullstop Created 5 years, 3 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
« no previous file with comments | « src/elements.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/objects.h" 5 #include "src/objects.h"
6 6
7 #include <iomanip> 7 #include <iomanip>
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 4028 matching lines...) Expand 10 before | Expand all | Expand 10 after
4039 } 4039 }
4040 } else if (from_kind == SLOW_SLOPPY_ARGUMENTS_ELEMENTS) { 4040 } else if (from_kind == SLOW_SLOPPY_ARGUMENTS_ELEMENTS) {
4041 if (*map == native_context->slow_aliased_arguments_map()) { 4041 if (*map == native_context->slow_aliased_arguments_map()) {
4042 DCHECK_EQ(FAST_SLOPPY_ARGUMENTS_ELEMENTS, to_kind); 4042 DCHECK_EQ(FAST_SLOPPY_ARGUMENTS_ELEMENTS, to_kind);
4043 return handle(native_context->fast_aliased_arguments_map()); 4043 return handle(native_context->fast_aliased_arguments_map());
4044 } 4044 }
4045 } else { 4045 } else {
4046 Object* maybe_array_maps = map->is_strong() 4046 Object* maybe_array_maps = map->is_strong()
4047 ? native_context->js_array_strong_maps() 4047 ? native_context->js_array_strong_maps()
4048 : native_context->js_array_maps(); 4048 : native_context->js_array_maps();
4049 // Reuse map transitions for JSArrays.
4049 if (maybe_array_maps->IsFixedArray()) { 4050 if (maybe_array_maps->IsFixedArray()) {
4050 DisallowHeapAllocation no_gc; 4051 DisallowHeapAllocation no_gc;
4051 FixedArray* array_maps = FixedArray::cast(maybe_array_maps); 4052 FixedArray* array_maps = FixedArray::cast(maybe_array_maps);
4052 if (array_maps->get(from_kind) == *map) { 4053 if (array_maps->get(from_kind) == *map) {
4053 Object* maybe_transitioned_map = array_maps->get(to_kind); 4054 Object* maybe_transitioned_map = array_maps->get(to_kind);
4054 if (maybe_transitioned_map->IsMap()) { 4055 if (maybe_transitioned_map->IsMap()) {
4055 return handle(Map::cast(maybe_transitioned_map)); 4056 return handle(Map::cast(maybe_transitioned_map));
4056 } 4057 }
4057 } 4058 }
4058 } 4059 }
4059 } 4060 }
4060 4061
4061 DCHECK(!map->IsUndefined()); 4062 DCHECK(!map->IsUndefined());
4063 // Check if we can go back in the elements kind transition chain.
4064 if (IsHoleyElementsKind(from_kind) &&
4065 to_kind == GetPackedElementsKind(from_kind) &&
4066 map->GetBackPointer()->IsMap() &&
4067 Map::cast(map->GetBackPointer())->elements_kind() == to_kind) {
4068 return handle(Map::cast(map->GetBackPointer()));
4069 }
4070
4062 bool allow_store_transition = IsTransitionElementsKind(from_kind); 4071 bool allow_store_transition = IsTransitionElementsKind(from_kind);
4063 // Only store fast element maps in ascending generality. 4072 // Only store fast element maps in ascending generality.
4064 if (IsFastElementsKind(to_kind)) { 4073 if (IsFastElementsKind(to_kind)) {
4065 allow_store_transition = 4074 allow_store_transition =
4066 allow_store_transition && IsTransitionableFastElementsKind(from_kind) && 4075 allow_store_transition && IsTransitionableFastElementsKind(from_kind) &&
4067 IsMoreGeneralElementsKindTransition(from_kind, to_kind); 4076 IsMoreGeneralElementsKindTransition(from_kind, to_kind);
4068 } 4077 }
4069 4078
4070 if (!allow_store_transition) { 4079 if (!allow_store_transition) {
4071 return Map::CopyAsElementsKind(map, to_kind, OMIT_TRANSITION); 4080 return Map::CopyAsElementsKind(map, to_kind, OMIT_TRANSITION);
(...skipping 12280 matching lines...) Expand 10 before | Expand all | Expand 10 after
16352 if (cell->value() != *new_value) { 16361 if (cell->value() != *new_value) {
16353 cell->set_value(*new_value); 16362 cell->set_value(*new_value);
16354 Isolate* isolate = cell->GetIsolate(); 16363 Isolate* isolate = cell->GetIsolate();
16355 cell->dependent_code()->DeoptimizeDependentCodeGroup( 16364 cell->dependent_code()->DeoptimizeDependentCodeGroup(
16356 isolate, DependentCode::kPropertyCellChangedGroup); 16365 isolate, DependentCode::kPropertyCellChangedGroup);
16357 } 16366 }
16358 } 16367 }
16359 16368
16360 } // namespace internal 16369 } // namespace internal
16361 } // namespace v8 16370 } // namespace v8
OLDNEW
« no previous file with comments | « src/elements.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698