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

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

Issue 2364473006: [stubs] Extract ToInteger to CodeStubAssembler (Closed)
Patch Set: Created 4 years, 2 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 | « src/builtins/builtins-array.cc ('k') | src/builtins/builtins-string.cc » ('j') | 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 9
10 namespace v8 { 10 namespace v8 {
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 Node* instance_type; 221 Node* instance_type;
222 Node* backing_store; 222 Node* backing_store;
223 ValidateSharedTypedArray(a, array, context, &instance_type, &backing_store); 223 ValidateSharedTypedArray(a, array, context, &instance_type, &backing_store);
224 224
225 Node* index_word32 = ConvertTaggedAtomicIndexToWord32(a, index, context); 225 Node* index_word32 = ConvertTaggedAtomicIndexToWord32(a, index, context);
226 Node* array_length_word32 = a->TruncateTaggedToWord32( 226 Node* array_length_word32 = a->TruncateTaggedToWord32(
227 context, a->LoadObjectField(array, JSTypedArray::kLengthOffset)); 227 context, a->LoadObjectField(array, JSTypedArray::kLengthOffset));
228 ValidateAtomicIndex(a, index_word32, array_length_word32, context); 228 ValidateAtomicIndex(a, index_word32, array_length_word32, context);
229 Node* index_word = a->ChangeUint32ToWord(index_word32); 229 Node* index_word = a->ChangeUint32ToWord(index_word32);
230 230
231 Callable to_integer = CodeFactory::ToInteger(a->isolate()); 231 Node* value_integer = a->ToInteger(context, value);
232 Node* value_integer = a->CallStub(to_integer, context, value);
233 Node* value_word32 = a->TruncateTaggedToWord32(context, value_integer); 232 Node* value_word32 = a->TruncateTaggedToWord32(context, value_integer);
234 233
235 CodeStubAssembler::Label u8(a), u16(a), u32(a), other(a); 234 CodeStubAssembler::Label u8(a), u16(a), u32(a), other(a);
236 int32_t case_values[] = { 235 int32_t case_values[] = {
237 FIXED_INT8_ARRAY_TYPE, FIXED_UINT8_ARRAY_TYPE, FIXED_INT16_ARRAY_TYPE, 236 FIXED_INT8_ARRAY_TYPE, FIXED_UINT8_ARRAY_TYPE, FIXED_INT16_ARRAY_TYPE,
238 FIXED_UINT16_ARRAY_TYPE, FIXED_INT32_ARRAY_TYPE, FIXED_UINT32_ARRAY_TYPE, 237 FIXED_UINT16_ARRAY_TYPE, FIXED_INT32_ARRAY_TYPE, FIXED_UINT32_ARRAY_TYPE,
239 }; 238 };
240 CodeStubAssembler::Label* case_labels[] = { 239 CodeStubAssembler::Label* case_labels[] = {
241 &u8, &u8, &u16, &u16, &u32, &u32, 240 &u8, &u8, &u16, &u16, &u32, &u32,
242 }; 241 };
(...skipping 15 matching lines...) Expand all
258 a->WordShl(index_word, 2), value_word32); 257 a->WordShl(index_word, 2), value_word32);
259 a->Return(value_integer); 258 a->Return(value_integer);
260 259
261 // This shouldn't happen, we've already validated the type. 260 // This shouldn't happen, we've already validated the type.
262 a->Bind(&other); 261 a->Bind(&other);
263 a->Return(a->Int32Constant(0)); 262 a->Return(a->Int32Constant(0));
264 } 263 }
265 264
266 } // namespace internal 265 } // namespace internal
267 } // namespace v8 266 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins/builtins-array.cc ('k') | src/builtins/builtins-string.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698