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

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: adding more tests Created 4 years, 8 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') | src/isolate.cc » ('J')
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 76105599a81bd4bd732d403b671ddfe911ae851c..8bf05f48f306a5f67ca5e06f4f482056e54b5abf 100644
--- a/src/elements.cc
+++ b/src/elements.cc
@@ -2942,31 +2942,17 @@ void ElementsAccessor::TearDown() {
elements_accessors_ = NULL;
}
-
Handle<JSArray> ElementsAccessor::Concat(Isolate* isolate, Arguments* args,
- uint32_t concat_size) {
- 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.
- const int kHalfOfMaxInt = 1 << (kBitsPerInt - 2);
- STATIC_ASSERT(FixedArray::kMaxLength < kHalfOfMaxInt);
- USE(kHalfOfMaxInt);
- 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') | src/isolate.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698