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

Side by Side Diff: src/builtins.cc

Issue 1344493004: Preserve the ElementsKind in builtin.cc Slice early return (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 | 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 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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 // ECMAScript 232, 3rd Edition, Section 15.4.4.10, step 6. 520 // ECMAScript 232, 3rd Edition, Section 15.4.4.10, step 6.
521 uint32_t actual_start = (relative_start < 0) ? Max(len + relative_start, 0) 521 uint32_t actual_start = (relative_start < 0) ? Max(len + relative_start, 0)
522 : Min(relative_start, len); 522 : Min(relative_start, len);
523 523
524 // ECMAScript 232, 3rd Edition, Section 15.4.4.10, step 8. 524 // ECMAScript 232, 3rd Edition, Section 15.4.4.10, step 8.
525 uint32_t actual_end = 525 uint32_t actual_end =
526 (relative_end < 0) ? Max(len + relative_end, 0) : Min(relative_end, len); 526 (relative_end < 0) ? Max(len + relative_end, 0) : Min(relative_end, len);
527 527
528 if (actual_end <= actual_start) { 528 if (actual_end <= actual_start) {
529 Handle<JSArray> result_array = 529 Handle<JSArray> result_array =
530 isolate->factory()->NewJSArray(GetInitialFastElementsKind(), 0, 0); 530 isolate->factory()->NewJSArray(object->GetElementsKind(), 0, 0);
531 return *result_array; 531 return *result_array;
532 } 532 }
533 533
534 ElementsAccessor* accessor = object->GetElementsAccessor(); 534 ElementsAccessor* accessor = object->GetElementsAccessor();
535 if (is_sloppy_arguments && 535 if (is_sloppy_arguments &&
536 !accessor->IsPacked(object, elms_obj, actual_start, actual_end)) { 536 !accessor->IsPacked(object, elms_obj, actual_start, actual_end)) {
537 // Don't deal with arguments with holes in C++ 537 // Don't deal with arguments with holes in C++
538 AllowHeapAllocation allow_allocation; 538 AllowHeapAllocation allow_allocation;
539 return CallJsIntrinsic(isolate, isolate->array_slice(), args); 539 return CallJsIntrinsic(isolate, isolate->array_slice(), args);
540 } 540 }
(...skipping 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after
2074 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) 2074 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C)
2075 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) 2075 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A)
2076 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) 2076 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H)
2077 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 2077 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
2078 #undef DEFINE_BUILTIN_ACCESSOR_C 2078 #undef DEFINE_BUILTIN_ACCESSOR_C
2079 #undef DEFINE_BUILTIN_ACCESSOR_A 2079 #undef DEFINE_BUILTIN_ACCESSOR_A
2080 2080
2081 2081
2082 } // namespace internal 2082 } // namespace internal
2083 } // namespace v8 2083 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698