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

Side by Side Diff: src/builtins.cc

Issue 1338983003: Using GetMoreGeneralElementsKind in more places (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « no previous file | src/elements.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 // 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/builtins.h" 5 #include "src/builtins.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/arguments.h" 9 #include "src/arguments.h"
10 #include "src/base/once.h" 10 #include "src/base/once.h"
(...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 HandleScope loop_scope(isolate); 1221 HandleScope loop_scope(isolate);
1222 Handle<Object> obj((*args)[i], isolate); 1222 Handle<Object> obj((*args)[i], isolate);
1223 uint32_t length_estimate; 1223 uint32_t length_estimate;
1224 uint32_t element_estimate; 1224 uint32_t element_estimate;
1225 if (obj->IsJSArray()) { 1225 if (obj->IsJSArray()) {
1226 Handle<JSArray> array(Handle<JSArray>::cast(obj)); 1226 Handle<JSArray> array(Handle<JSArray>::cast(obj));
1227 length_estimate = static_cast<uint32_t>(array->length()->Number()); 1227 length_estimate = static_cast<uint32_t>(array->length()->Number());
1228 if (length_estimate != 0) { 1228 if (length_estimate != 0) {
1229 ElementsKind array_kind = 1229 ElementsKind array_kind =
1230 GetPackedElementsKind(array->map()->elements_kind()); 1230 GetPackedElementsKind(array->map()->elements_kind());
1231 if (IsMoreGeneralElementsKindTransition(kind, array_kind)) { 1231 kind = GetMoreGeneralElementsKind(kind, array_kind);
1232 kind = array_kind;
1233 }
1234 } 1232 }
1235 element_estimate = EstimateElementCount(array); 1233 element_estimate = EstimateElementCount(array);
1236 } else { 1234 } else {
1237 if (obj->IsHeapObject()) { 1235 if (obj->IsHeapObject()) {
1238 if (obj->IsNumber()) { 1236 if (obj->IsNumber()) {
1239 if (IsMoreGeneralElementsKindTransition(kind, FAST_DOUBLE_ELEMENTS)) { 1237 kind = GetMoreGeneralElementsKind(kind, FAST_DOUBLE_ELEMENTS);
1240 kind = FAST_DOUBLE_ELEMENTS; 1238 } else {
1241 } 1239 kind = GetMoreGeneralElementsKind(kind, FAST_ELEMENTS);
1242 } else if (IsMoreGeneralElementsKindTransition(kind, FAST_ELEMENTS)) {
1243 kind = FAST_ELEMENTS;
1244 } 1240 }
1245 } 1241 }
1246 length_estimate = 1; 1242 length_estimate = 1;
1247 element_estimate = 1; 1243 element_estimate = 1;
1248 } 1244 }
1249 // Avoid overflows by capping at kMaxElementCount. 1245 // Avoid overflows by capping at kMaxElementCount.
1250 if (JSObject::kMaxElementCount - estimate_result_length < length_estimate) { 1246 if (JSObject::kMaxElementCount - estimate_result_length < length_estimate) {
1251 estimate_result_length = JSObject::kMaxElementCount; 1247 estimate_result_length = JSObject::kMaxElementCount;
1252 } else { 1248 } else {
1253 estimate_result_length += length_estimate; 1249 estimate_result_length += length_estimate;
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
2074 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) 2070 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C)
2075 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) 2071 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A)
2076 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) 2072 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H)
2077 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 2073 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
2078 #undef DEFINE_BUILTIN_ACCESSOR_C 2074 #undef DEFINE_BUILTIN_ACCESSOR_C
2079 #undef DEFINE_BUILTIN_ACCESSOR_A 2075 #undef DEFINE_BUILTIN_ACCESSOR_A
2080 2076
2081 2077
2082 } // namespace internal 2078 } // namespace internal
2083 } // namespace v8 2079 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/elements.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698