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

Unified Diff: src/builtins/builtins-sharedarraybuffer.cc

Issue 2498073002: [refactoring] Split CodeAssemblerState out of CodeAssembler (Closed)
Patch Set: one more attempt Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/builtins/builtins-regexp.cc ('k') | src/builtins/builtins-string.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/builtins-sharedarraybuffer.cc
diff --git a/src/builtins/builtins-sharedarraybuffer.cc b/src/builtins/builtins-sharedarraybuffer.cc
index 2b5bf498a51316ea80b43b856814a49d801defed..7e0a1c38956aa688e9e3295ce5841c1cc692b502 100644
--- a/src/builtins/builtins-sharedarraybuffer.cc
+++ b/src/builtins/builtins-sharedarraybuffer.cc
@@ -31,7 +31,7 @@ void ValidateSharedTypedArray(CodeStubAssembler* a, compiler::Node* tagged,
compiler::Node* context,
compiler::Node** out_instance_type,
compiler::Node** out_backing_store) {
- using namespace compiler;
+ using compiler::Node;
CodeStubAssembler::Label is_smi(a), not_smi(a), is_typed_array(a),
not_typed_array(a), is_shared(a), not_shared(a), is_float_or_clamped(a),
not_float_or_clamped(a), invalid(a);
@@ -95,7 +95,7 @@ void ValidateSharedTypedArray(CodeStubAssembler* a, compiler::Node* tagged,
compiler::Node* ConvertTaggedAtomicIndexToWord32(CodeStubAssembler* a,
compiler::Node* tagged,
compiler::Node* context) {
- using namespace compiler;
+ using compiler::Node;
CodeStubAssembler::Variable var_result(a, MachineRepresentation::kWord32);
Callable to_number = CodeFactory::ToNumber(a->isolate());
@@ -139,7 +139,7 @@ compiler::Node* ConvertTaggedAtomicIndexToWord32(CodeStubAssembler* a,
void ValidateAtomicIndex(CodeStubAssembler* a, compiler::Node* index_word,
compiler::Node* array_length_word,
compiler::Node* context) {
- using namespace compiler;
+ using compiler::Node;
// Check if the index is in bounds. If not, throw RangeError.
CodeStubAssembler::Label if_inbounds(a), if_notinbounds(a);
// TODO(jkummerow): Use unsigned comparison instead of "i<0 || i>length".
@@ -155,24 +155,25 @@ void ValidateAtomicIndex(CodeStubAssembler* a, compiler::Node* index_word,
} // anonymous namespace
-void Builtins::Generate_AtomicsLoad(CodeStubAssembler* a) {
- using namespace compiler;
- Node* array = a->Parameter(1);
- Node* index = a->Parameter(2);
- Node* context = a->Parameter(3 + 2);
+void Builtins::Generate_AtomicsLoad(compiler::CodeAssemblerState* state) {
+ using compiler::Node;
+ CodeStubAssembler a(state);
+ Node* array = a.Parameter(1);
+ Node* index = a.Parameter(2);
+ Node* context = a.Parameter(3 + 2);
Node* instance_type;
Node* backing_store;
- ValidateSharedTypedArray(a, array, context, &instance_type, &backing_store);
+ ValidateSharedTypedArray(&a, array, context, &instance_type, &backing_store);
- Node* index_word32 = ConvertTaggedAtomicIndexToWord32(a, index, context);
- Node* array_length_word32 = a->TruncateTaggedToWord32(
- context, a->LoadObjectField(array, JSTypedArray::kLengthOffset));
- ValidateAtomicIndex(a, index_word32, array_length_word32, context);
- Node* index_word = a->ChangeUint32ToWord(index_word32);
+ Node* index_word32 = ConvertTaggedAtomicIndexToWord32(&a, index, context);
+ Node* array_length_word32 = a.TruncateTaggedToWord32(
+ context, a.LoadObjectField(array, JSTypedArray::kLengthOffset));
+ ValidateAtomicIndex(&a, index_word32, array_length_word32, context);
+ Node* index_word = a.ChangeUint32ToWord(index_word32);
- CodeStubAssembler::Label i8(a), u8(a), i16(a), u16(a), i32(a), u32(a),
- other(a);
+ CodeStubAssembler::Label i8(&a), u8(&a), i16(&a), u16(&a), i32(&a), u32(&a),
+ other(&a);
int32_t case_values[] = {
FIXED_INT8_ARRAY_TYPE, FIXED_UINT8_ARRAY_TYPE, FIXED_INT16_ARRAY_TYPE,
FIXED_UINT16_ARRAY_TYPE, FIXED_INT32_ARRAY_TYPE, FIXED_UINT32_ARRAY_TYPE,
@@ -180,59 +181,60 @@ void Builtins::Generate_AtomicsLoad(CodeStubAssembler* a) {
CodeStubAssembler::Label* case_labels[] = {
&i8, &u8, &i16, &u16, &i32, &u32,
};
- a->Switch(instance_type, &other, case_values, case_labels,
- arraysize(case_labels));
+ a.Switch(instance_type, &other, case_values, case_labels,
+ arraysize(case_labels));
- a->Bind(&i8);
- a->Return(
- a->SmiTag(a->AtomicLoad(MachineType::Int8(), backing_store, index_word)));
+ a.Bind(&i8);
+ a.Return(
+ a.SmiTag(a.AtomicLoad(MachineType::Int8(), backing_store, index_word)));
- a->Bind(&u8);
- a->Return(a->SmiTag(
- a->AtomicLoad(MachineType::Uint8(), backing_store, index_word)));
+ a.Bind(&u8);
+ a.Return(
+ a.SmiTag(a.AtomicLoad(MachineType::Uint8(), backing_store, index_word)));
- a->Bind(&i16);
- a->Return(a->SmiTag(a->AtomicLoad(MachineType::Int16(), backing_store,
- a->WordShl(index_word, 1))));
+ a.Bind(&i16);
+ a.Return(a.SmiTag(a.AtomicLoad(MachineType::Int16(), backing_store,
+ a.WordShl(index_word, 1))));
- a->Bind(&u16);
- a->Return(a->SmiTag(a->AtomicLoad(MachineType::Uint16(), backing_store,
- a->WordShl(index_word, 1))));
+ a.Bind(&u16);
+ a.Return(a.SmiTag(a.AtomicLoad(MachineType::Uint16(), backing_store,
+ a.WordShl(index_word, 1))));
- a->Bind(&i32);
- a->Return(a->ChangeInt32ToTagged(a->AtomicLoad(
- MachineType::Int32(), backing_store, a->WordShl(index_word, 2))));
+ a.Bind(&i32);
+ a.Return(a.ChangeInt32ToTagged(a.AtomicLoad(
+ MachineType::Int32(), backing_store, a.WordShl(index_word, 2))));
- a->Bind(&u32);
- a->Return(a->ChangeUint32ToTagged(a->AtomicLoad(
- MachineType::Uint32(), backing_store, a->WordShl(index_word, 2))));
+ a.Bind(&u32);
+ a.Return(a.ChangeUint32ToTagged(a.AtomicLoad(
+ MachineType::Uint32(), backing_store, a.WordShl(index_word, 2))));
// This shouldn't happen, we've already validated the type.
- a->Bind(&other);
- a->Return(a->Int32Constant(0));
+ a.Bind(&other);
+ a.Return(a.Int32Constant(0));
}
-void Builtins::Generate_AtomicsStore(CodeStubAssembler* a) {
- using namespace compiler;
- Node* array = a->Parameter(1);
- Node* index = a->Parameter(2);
- Node* value = a->Parameter(3);
- Node* context = a->Parameter(4 + 2);
+void Builtins::Generate_AtomicsStore(compiler::CodeAssemblerState* state) {
+ using compiler::Node;
+ CodeStubAssembler a(state);
+ Node* array = a.Parameter(1);
+ Node* index = a.Parameter(2);
+ Node* value = a.Parameter(3);
+ Node* context = a.Parameter(4 + 2);
Node* instance_type;
Node* backing_store;
- ValidateSharedTypedArray(a, array, context, &instance_type, &backing_store);
+ ValidateSharedTypedArray(&a, array, context, &instance_type, &backing_store);
- Node* index_word32 = ConvertTaggedAtomicIndexToWord32(a, index, context);
- Node* array_length_word32 = a->TruncateTaggedToWord32(
- context, a->LoadObjectField(array, JSTypedArray::kLengthOffset));
- ValidateAtomicIndex(a, index_word32, array_length_word32, context);
- Node* index_word = a->ChangeUint32ToWord(index_word32);
+ Node* index_word32 = ConvertTaggedAtomicIndexToWord32(&a, index, context);
+ Node* array_length_word32 = a.TruncateTaggedToWord32(
+ context, a.LoadObjectField(array, JSTypedArray::kLengthOffset));
+ ValidateAtomicIndex(&a, index_word32, array_length_word32, context);
+ Node* index_word = a.ChangeUint32ToWord(index_word32);
- Node* value_integer = a->ToInteger(context, value);
- Node* value_word32 = a->TruncateTaggedToWord32(context, value_integer);
+ Node* value_integer = a.ToInteger(context, value);
+ Node* value_word32 = a.TruncateTaggedToWord32(context, value_integer);
- CodeStubAssembler::Label u8(a), u16(a), u32(a), other(a);
+ CodeStubAssembler::Label u8(&a), u16(&a), u32(&a), other(&a);
int32_t case_values[] = {
FIXED_INT8_ARRAY_TYPE, FIXED_UINT8_ARRAY_TYPE, FIXED_INT16_ARRAY_TYPE,
FIXED_UINT16_ARRAY_TYPE, FIXED_INT32_ARRAY_TYPE, FIXED_UINT32_ARRAY_TYPE,
@@ -240,27 +242,27 @@ void Builtins::Generate_AtomicsStore(CodeStubAssembler* a) {
CodeStubAssembler::Label* case_labels[] = {
&u8, &u8, &u16, &u16, &u32, &u32,
};
- a->Switch(instance_type, &other, case_values, case_labels,
- arraysize(case_labels));
+ a.Switch(instance_type, &other, case_values, case_labels,
+ arraysize(case_labels));
- a->Bind(&u8);
- a->AtomicStore(MachineRepresentation::kWord8, backing_store, index_word,
- value_word32);
- a->Return(value_integer);
+ a.Bind(&u8);
+ a.AtomicStore(MachineRepresentation::kWord8, backing_store, index_word,
+ value_word32);
+ a.Return(value_integer);
- a->Bind(&u16);
- a->AtomicStore(MachineRepresentation::kWord16, backing_store,
- a->WordShl(index_word, 1), value_word32);
- a->Return(value_integer);
+ a.Bind(&u16);
+ a.AtomicStore(MachineRepresentation::kWord16, backing_store,
+ a.WordShl(index_word, 1), value_word32);
+ a.Return(value_integer);
- a->Bind(&u32);
- a->AtomicStore(MachineRepresentation::kWord32, backing_store,
- a->WordShl(index_word, 2), value_word32);
- a->Return(value_integer);
+ a.Bind(&u32);
+ a.AtomicStore(MachineRepresentation::kWord32, backing_store,
+ a.WordShl(index_word, 2), value_word32);
+ a.Return(value_integer);
// This shouldn't happen, we've already validated the type.
- a->Bind(&other);
- a->Return(a->Int32Constant(0));
+ a.Bind(&other);
+ a.Return(a.Int32Constant(0));
}
} // namespace internal
« no previous file with comments | « src/builtins/builtins-regexp.cc ('k') | src/builtins/builtins-string.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698