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

Side by Side Diff: src/builtins.cc

Issue 1938213002: [Atomics] Make Atomics.store a builtin using TF (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: merge again Created 4 years, 7 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.h ('k') | src/compiler/arm/code-generator-arm.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 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-arguments.h" 7 #include "src/api-arguments.h"
8 #include "src/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/api.h" 9 #include "src/api.h"
10 #include "src/base/once.h" 10 #include "src/base/once.h"
(...skipping 5494 matching lines...) Expand 10 before | Expand all | Expand 10 after
5505 5505
5506 a->Bind(&u32); 5506 a->Bind(&u32);
5507 a->Return(a->ChangeUint32ToTagged(a->AtomicLoad( 5507 a->Return(a->ChangeUint32ToTagged(a->AtomicLoad(
5508 MachineType::Uint32(), backing_store, a->WordShl(index_word, 2)))); 5508 MachineType::Uint32(), backing_store, a->WordShl(index_word, 2))));
5509 5509
5510 // This shouldn't happen, we've already validated the type. 5510 // This shouldn't happen, we've already validated the type.
5511 a->Bind(&other); 5511 a->Bind(&other);
5512 a->Return(a->Int32Constant(0)); 5512 a->Return(a->Int32Constant(0));
5513 } 5513 }
5514 5514
5515 void Builtins::Generate_AtomicsStore(CodeStubAssembler* a) {
5516 using namespace compiler;
5517 Node* array = a->Parameter(1);
5518 Node* index = a->Parameter(2);
5519 Node* value = a->Parameter(3);
5520 Node* context = a->Parameter(4 + 2);
5521
5522 Node* instance_type;
5523 Node* backing_store;
5524 ValidateSharedTypedArray(a, array, context, &instance_type, &backing_store);
5525
5526 Node* index_word32 = ConvertTaggedAtomicIndexToWord32(a, index, context);
5527 Node* array_length_word32 = a->TruncateTaggedToWord32(
5528 context, a->LoadObjectField(array, JSTypedArray::kLengthOffset));
5529 ValidateAtomicIndex(a, index_word32, array_length_word32, context);
5530 Node* index_word = a->ChangeUint32ToWord(index_word32);
5531
5532 Callable to_integer = CodeFactory::ToInteger(a->isolate());
5533 Node* value_integer = a->CallStub(to_integer, context, value);
5534 Node* value_word32 = a->TruncateTaggedToWord32(context, value_integer);
5535
5536 CodeStubAssembler::Label u8(a), u16(a), u32(a), other(a);
5537 int32_t case_values[] = {
5538 FIXED_INT8_ARRAY_TYPE, FIXED_UINT8_ARRAY_TYPE, FIXED_INT16_ARRAY_TYPE,
5539 FIXED_UINT16_ARRAY_TYPE, FIXED_INT32_ARRAY_TYPE, FIXED_UINT32_ARRAY_TYPE,
5540 };
5541 CodeStubAssembler::Label* case_labels[] = {
5542 &u8, &u8, &u16, &u16, &u32, &u32,
5543 };
5544 a->Switch(instance_type, &other, case_values, case_labels,
5545 arraysize(case_labels));
5546
5547 a->Bind(&u8);
5548 a->AtomicStore(MachineRepresentation::kWord8, backing_store, index_word,
5549 value_word32);
5550 a->Return(value_integer);
5551
5552 a->Bind(&u16);
5553 a->SmiTag(a->AtomicStore(MachineRepresentation::kWord16, backing_store,
5554 a->WordShl(index_word, 1), value_word32));
5555 a->Return(value_integer);
5556
5557 a->Bind(&u32);
5558 a->AtomicStore(MachineRepresentation::kWord32, backing_store,
5559 a->WordShl(index_word, 2), value_word32);
5560 a->Return(value_integer);
5561
5562 // This shouldn't happen, we've already validated the type.
5563 a->Bind(&other);
5564 a->Return(a->Int32Constant(0));
5565 }
5566
5515 #define DEFINE_BUILTIN_ACCESSOR_C(name, ignore) \ 5567 #define DEFINE_BUILTIN_ACCESSOR_C(name, ignore) \
5516 Handle<Code> Builtins::name() { \ 5568 Handle<Code> Builtins::name() { \
5517 Code** code_address = \ 5569 Code** code_address = \
5518 reinterpret_cast<Code**>(builtin_address(k##name)); \ 5570 reinterpret_cast<Code**>(builtin_address(k##name)); \
5519 return Handle<Code>(code_address); \ 5571 return Handle<Code>(code_address); \
5520 } 5572 }
5521 #define DEFINE_BUILTIN_ACCESSOR_A(name, kind, state, extra) \ 5573 #define DEFINE_BUILTIN_ACCESSOR_A(name, kind, state, extra) \
5522 Handle<Code> Builtins::name() { \ 5574 Handle<Code> Builtins::name() { \
5523 Code** code_address = \ 5575 Code** code_address = \
5524 reinterpret_cast<Code**>(builtin_address(k##name)); \ 5576 reinterpret_cast<Code**>(builtin_address(k##name)); \
(...skipping 15 matching lines...) Expand all
5540 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T) 5592 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T)
5541 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) 5593 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H)
5542 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 5594 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
5543 #undef DEFINE_BUILTIN_ACCESSOR_C 5595 #undef DEFINE_BUILTIN_ACCESSOR_C
5544 #undef DEFINE_BUILTIN_ACCESSOR_A 5596 #undef DEFINE_BUILTIN_ACCESSOR_A
5545 #undef DEFINE_BUILTIN_ACCESSOR_T 5597 #undef DEFINE_BUILTIN_ACCESSOR_T
5546 #undef DEFINE_BUILTIN_ACCESSOR_H 5598 #undef DEFINE_BUILTIN_ACCESSOR_H
5547 5599
5548 } // namespace internal 5600 } // namespace internal
5549 } // namespace v8 5601 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins.h ('k') | src/compiler/arm/code-generator-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698