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

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

Issue 2714173002: Remove SMI length check from Builtins::Generate_ArrayIndexOf (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 2003 matching lines...) Expand 10 before | Expand all | Expand 10 after
2014 len_var.Bind(intptr_zero); 2014 len_var.Bind(intptr_zero);
2015 2015
2016 // Take slow path if not a JSArray, if retrieving elements requires 2016 // Take slow path if not a JSArray, if retrieving elements requires
2017 // traversing prototype, or if access checks are required. 2017 // traversing prototype, or if access checks are required.
2018 assembler.BranchIfFastJSArray( 2018 assembler.BranchIfFastJSArray(
2019 array, context, CodeStubAssembler::FastJSArrayAccessMode::INBOUNDS_READ, 2019 array, context, CodeStubAssembler::FastJSArrayAccessMode::INBOUNDS_READ,
2020 &init_len, &call_runtime); 2020 &init_len, &call_runtime);
2021 2021
2022 assembler.Bind(&init_len); 2022 assembler.Bind(&init_len);
2023 { 2023 {
2024 // Handle case where JSArray length is not an Smi in the runtime 2024 // JSArray length is always an Smi for fast arrays.
2025 Node* len = assembler.LoadObjectField(array, JSArray::kLengthOffset); 2025 CSA_ASSERT(&assembler, assembler.TaggedIsSmi(assembler.LoadObjectField(
2026 assembler.GotoIfNot(assembler.TaggedIsSmi(len), &call_runtime); 2026 array, JSArray::kLengthOffset)));
2027 Node* len =
2028 assembler.LoadAndUntagObjectField(array, JSArray::kLengthOffset);
2027 2029
2028 len_var.Bind(assembler.SmiToWord(len)); 2030 len_var.Bind(len);
2029 assembler.Branch(assembler.WordEqual(len_var.value(), intptr_zero), 2031 assembler.Branch(assembler.WordEqual(len_var.value(), intptr_zero),
2030 &return_not_found, &init_k); 2032 &return_not_found, &init_k);
2031 } 2033 }
2032 2034
2033 assembler.Bind(&init_k); 2035 assembler.Bind(&init_k);
2034 { 2036 {
2035 Label done(&assembler), init_k_smi(&assembler), init_k_heap_num(&assembler), 2037 Label done(&assembler), init_k_smi(&assembler), init_k_heap_num(&assembler),
2036 init_k_zero(&assembler), init_k_n(&assembler); 2038 init_k_zero(&assembler), init_k_n(&assembler);
2037 Node* tagged_n = assembler.ToInteger(context, start_from); 2039 Node* tagged_n = assembler.ToInteger(context, start_from);
2038 2040
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after
2849 { 2851 {
2850 Node* message = assembler.SmiConstant(MessageTemplate::kDetachedOperation); 2852 Node* message = assembler.SmiConstant(MessageTemplate::kDetachedOperation);
2851 assembler.CallRuntime(Runtime::kThrowTypeError, context, message, 2853 assembler.CallRuntime(Runtime::kThrowTypeError, context, message,
2852 assembler.HeapConstant(operation)); 2854 assembler.HeapConstant(operation));
2853 assembler.Unreachable(); 2855 assembler.Unreachable();
2854 } 2856 }
2855 } 2857 }
2856 2858
2857 } // namespace internal 2859 } // namespace internal
2858 } // namespace v8 2860 } // 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