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

Unified Diff: src/elements.cc

Issue 1409123003: [runtime] Avoid @@isConcatSpreadable lookup for fast path Array.prototype.concat (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: merging with master Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/elements.h ('k') | src/heap/heap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/elements.cc
diff --git a/src/elements.cc b/src/elements.cc
index 947310ae4d2ab59c5a786b12fafcee69af6ef344..6c257ac63f3424b4dd531d1c936e0ff12e38bebd 100644
--- a/src/elements.cc
+++ b/src/elements.cc
@@ -2976,31 +2976,17 @@ void ElementsAccessor::TearDown() {
elements_accessors_ = NULL;
}
-
Handle<JSArray> ElementsAccessor::Concat(Isolate* isolate, Arguments* args,
- uint32_t concat_size) {
- const int kHalfOfMaxInt = 1 << (kBitsPerInt - 2);
- STATIC_ASSERT(FixedDoubleArray::kMaxLength < kHalfOfMaxInt);
- USE(kHalfOfMaxInt);
- uint32_t result_len = 0;
- bool has_raw_doubles = false;
+ uint32_t concat_size,
+ uint32_t result_len) {
ElementsKind result_elements_kind = GetInitialFastElementsKind();
+ bool has_raw_doubles = false;
{
DisallowHeapAllocation no_gc;
bool is_holey = false;
- // Iterate through all the arguments performing checks
- // and calculating total length.
for (uint32_t i = 0; i < concat_size; i++) {
- JSArray* array = JSArray::cast((*args)[i]);
- uint32_t len = 0;
- array->length()->ToArrayLength(&len);
-
- // We shouldn't overflow when adding another len.
- result_len += len;
- DCHECK(0 <= result_len);
- DCHECK(result_len <= FixedDoubleArray::kMaxLength);
-
- ElementsKind arg_kind = array->GetElementsKind();
+ Object* arg = (*args)[i];
+ ElementsKind arg_kind = JSArray::cast(arg)->GetElementsKind();
has_raw_doubles = has_raw_doubles || IsFastDoubleElementsKind(arg_kind);
is_holey = is_holey || IsFastHoleyElementsKind(arg_kind);
result_elements_kind =
« no previous file with comments | « src/elements.h ('k') | src/heap/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698