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

Side by Side Diff: src/builtins/builtins-array.cc

Issue 2714193002: Remove SMI length check from TF_BUILTIN(ArrayIncludes, CodeStubAssembler) (Closed)
Patch Set: No 'ToWord32' Created 3 years, 10 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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/builtins.h" 5 #include "src/builtins/builtins.h"
6 #include "src/builtins/builtins-utils.h" 6 #include "src/builtins/builtins-utils.h"
7 7
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/code-stub-assembler.h" 9 #include "src/code-stub-assembler.h"
10 #include "src/contexts.h" 10 #include "src/contexts.h"
(...skipping 1684 matching lines...) Expand 10 before | Expand all | Expand 10 after
1695 len_var.Bind(IntPtrConstant(0)); 1695 len_var.Bind(IntPtrConstant(0));
1696 1696
1697 // Take slow path if not a JSArray, if retrieving elements requires 1697 // Take slow path if not a JSArray, if retrieving elements requires
1698 // traversing prototype, or if access checks are required. 1698 // traversing prototype, or if access checks are required.
1699 BranchIfFastJSArray(array, context, 1699 BranchIfFastJSArray(array, context,
1700 CodeStubAssembler::FastJSArrayAccessMode::INBOUNDS_READ, 1700 CodeStubAssembler::FastJSArrayAccessMode::INBOUNDS_READ,
1701 &init_len, &call_runtime); 1701 &init_len, &call_runtime);
1702 1702
1703 Bind(&init_len); 1703 Bind(&init_len);
1704 { 1704 {
1705 // Handle case where JSArray length is not an Smi in the runtime 1705 // JSArray length is always an Smi for fast arrays.
1706 Node* len = LoadObjectField(array, JSArray::kLengthOffset); 1706 CSA_ASSERT(this,
1707 GotoIfNot(TaggedIsSmi(len), &call_runtime); 1707 TaggedIsSmi(LoadObjectField(array, JSArray::kLengthOffset)));
1708 Node* len = LoadAndUntagObjectField(array, JSArray::kLengthOffset);
1708 1709
1709 len_var.Bind(SmiToWord(len)); 1710 len_var.Bind(len);
caitp 2017/02/25 18:03:06 Do we still need `len_var`? It never changes at an
vabr (Chromium) 2017/02/25 18:35:48 So that I learn more: (1) Changing would mean that
caitp 2017/02/25 18:40:12 There's another Bind() call before this line, but
1710 1711
1711 GotoIf(IsUndefined(start_from), &select_loop); 1712 GotoIf(IsUndefined(start_from), &select_loop);
1712 1713
1713 // Bailout to slow path if startIndex is not an Smi. 1714 // Bailout to slow path if startIndex is not an Smi.
1714 Branch(TaggedIsSmi(start_from), &init_k, &call_runtime); 1715 Branch(TaggedIsSmi(start_from), &init_k, &call_runtime);
1715 } 1716 }
1716 1717
1717 Bind(&init_k); 1718 Bind(&init_k);
1718 CSA_ASSERT(this, TaggedIsSmi(start_from)); 1719 CSA_ASSERT(this, TaggedIsSmi(start_from));
1719 Node* const untagged_start_from = SmiToWord(start_from); 1720 Node* const untagged_start_from = SmiToWord(start_from);
(...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after
2849 { 2850 {
2850 Node* message = assembler.SmiConstant(MessageTemplate::kDetachedOperation); 2851 Node* message = assembler.SmiConstant(MessageTemplate::kDetachedOperation);
2851 assembler.CallRuntime(Runtime::kThrowTypeError, context, message, 2852 assembler.CallRuntime(Runtime::kThrowTypeError, context, message,
2852 assembler.HeapConstant(operation)); 2853 assembler.HeapConstant(operation));
2853 assembler.Unreachable(); 2854 assembler.Unreachable();
2854 } 2855 }
2855 } 2856 }
2856 2857
2857 } // namespace internal 2858 } // namespace internal
2858 } // namespace v8 2859 } // 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