Index: src/builtins/builtins-typedarray.cc |
diff --git a/src/builtins/builtins-typedarray.cc b/src/builtins/builtins-typedarray.cc |
index 94173fa6131d8a6fa648a610f11110725ee40def..7efb5469b4b0fdd6973db19d876b476ac397247a 100644 |
--- a/src/builtins/builtins-typedarray.cc |
+++ b/src/builtins/builtins-typedarray.cc |
@@ -20,48 +20,48 @@ BUILTIN(TypedArrayPrototypeBuffer) { |
namespace { |
-void Generate_TypedArrayProtoypeGetter(CodeStubAssembler* assembler, |
+void Generate_TypedArrayProtoypeGetter(compiler::CodeAssemblerState* state, |
const char* method_name, |
int object_offset) { |
typedef CodeStubAssembler::Label Label; |
typedef compiler::Node Node; |
+ CodeStubAssembler assembler(state); |
- Node* receiver = assembler->Parameter(0); |
- Node* context = assembler->Parameter(3); |
+ Node* receiver = assembler.Parameter(0); |
+ Node* context = assembler.Parameter(3); |
// Check if the {receiver} is actually a JSTypedArray. |
- Label if_receiverisincompatible(assembler, Label::kDeferred); |
- assembler->GotoIf(assembler->TaggedIsSmi(receiver), |
- &if_receiverisincompatible); |
- Node* receiver_instance_type = assembler->LoadInstanceType(receiver); |
- assembler->GotoUnless( |
- assembler->Word32Equal(receiver_instance_type, |
- assembler->Int32Constant(JS_TYPED_ARRAY_TYPE)), |
+ Label if_receiverisincompatible(&assembler, Label::kDeferred); |
+ assembler.GotoIf(assembler.TaggedIsSmi(receiver), &if_receiverisincompatible); |
+ Node* receiver_instance_type = assembler.LoadInstanceType(receiver); |
+ assembler.GotoUnless( |
+ assembler.Word32Equal(receiver_instance_type, |
+ assembler.Int32Constant(JS_TYPED_ARRAY_TYPE)), |
&if_receiverisincompatible); |
// Check if the {receiver}'s JSArrayBuffer was neutered. |
Node* receiver_buffer = |
- assembler->LoadObjectField(receiver, JSTypedArray::kBufferOffset); |
- Label if_receiverisneutered(assembler, Label::kDeferred); |
- assembler->GotoIf(assembler->IsDetachedBuffer(receiver_buffer), |
- &if_receiverisneutered); |
- assembler->Return(assembler->LoadObjectField(receiver, object_offset)); |
+ assembler.LoadObjectField(receiver, JSTypedArray::kBufferOffset); |
+ Label if_receiverisneutered(&assembler, Label::kDeferred); |
+ assembler.GotoIf(assembler.IsDetachedBuffer(receiver_buffer), |
+ &if_receiverisneutered); |
+ assembler.Return(assembler.LoadObjectField(receiver, object_offset)); |
- assembler->Bind(&if_receiverisneutered); |
+ assembler.Bind(&if_receiverisneutered); |
{ |
// The {receiver}s buffer was neutered, default to zero. |
- assembler->Return(assembler->SmiConstant(0)); |
+ assembler.Return(assembler.SmiConstant(0)); |
} |
- assembler->Bind(&if_receiverisincompatible); |
+ assembler.Bind(&if_receiverisincompatible); |
{ |
// The {receiver} is not a valid JSGeneratorObject. |
- Node* result = assembler->CallRuntime( |
+ Node* result = assembler.CallRuntime( |
Runtime::kThrowIncompatibleMethodReceiver, context, |
- assembler->HeapConstant(assembler->factory()->NewStringFromAsciiChecked( |
+ assembler.HeapConstant(assembler.factory()->NewStringFromAsciiChecked( |
method_name, TENURED)), |
receiver); |
- assembler->Return(result); // Never reached. |
+ assembler.Return(result); // Never reached. |
} |
} |
@@ -69,100 +69,101 @@ void Generate_TypedArrayProtoypeGetter(CodeStubAssembler* assembler, |
// ES6 section 22.2.3.2 get %TypedArray%.prototype.byteLength |
void Builtins::Generate_TypedArrayPrototypeByteLength( |
- CodeStubAssembler* assembler) { |
- Generate_TypedArrayProtoypeGetter(assembler, |
+ compiler::CodeAssemblerState* state) { |
+ Generate_TypedArrayProtoypeGetter(state, |
"get TypedArray.prototype.byteLength", |
JSTypedArray::kByteLengthOffset); |
} |
// ES6 section 22.2.3.3 get %TypedArray%.prototype.byteOffset |
void Builtins::Generate_TypedArrayPrototypeByteOffset( |
- CodeStubAssembler* assembler) { |
- Generate_TypedArrayProtoypeGetter(assembler, |
+ compiler::CodeAssemblerState* state) { |
+ Generate_TypedArrayProtoypeGetter(state, |
"get TypedArray.prototype.byteOffset", |
JSTypedArray::kByteOffsetOffset); |
} |
// ES6 section 22.2.3.18 get %TypedArray%.prototype.length |
void Builtins::Generate_TypedArrayPrototypeLength( |
- CodeStubAssembler* assembler) { |
- Generate_TypedArrayProtoypeGetter(assembler, |
- "get TypedArray.prototype.length", |
+ compiler::CodeAssemblerState* state) { |
+ Generate_TypedArrayProtoypeGetter(state, "get TypedArray.prototype.length", |
JSTypedArray::kLengthOffset); |
} |
namespace { |
template <IterationKind kIterationKind> |
-void Generate_TypedArrayPrototypeIterationMethod(CodeStubAssembler* assembler, |
- const char* method_name) { |
+void Generate_TypedArrayPrototypeIterationMethod( |
+ compiler::CodeAssemblerState* state, const char* method_name) { |
typedef compiler::Node Node; |
typedef CodeStubAssembler::Label Label; |
typedef CodeStubAssembler::Variable Variable; |
+ CodeStubAssembler assembler(state); |
- Node* receiver = assembler->Parameter(0); |
- Node* context = assembler->Parameter(3); |
+ Node* receiver = assembler.Parameter(0); |
+ Node* context = assembler.Parameter(3); |
- Label throw_bad_receiver(assembler, Label::kDeferred); |
- Label throw_typeerror(assembler, Label::kDeferred); |
+ Label throw_bad_receiver(&assembler, Label::kDeferred); |
+ Label throw_typeerror(&assembler, Label::kDeferred); |
- assembler->GotoIf(assembler->TaggedIsSmi(receiver), &throw_bad_receiver); |
+ assembler.GotoIf(assembler.TaggedIsSmi(receiver), &throw_bad_receiver); |
- Node* map = assembler->LoadMap(receiver); |
- Node* instance_type = assembler->LoadMapInstanceType(map); |
- assembler->GotoIf( |
- assembler->Word32NotEqual(instance_type, |
- assembler->Int32Constant(JS_TYPED_ARRAY_TYPE)), |
+ Node* map = assembler.LoadMap(receiver); |
+ Node* instance_type = assembler.LoadMapInstanceType(map); |
+ assembler.GotoIf( |
+ assembler.Word32NotEqual(instance_type, |
+ assembler.Int32Constant(JS_TYPED_ARRAY_TYPE)), |
&throw_bad_receiver); |
// Check if the {receiver}'s JSArrayBuffer was neutered. |
Node* receiver_buffer = |
- assembler->LoadObjectField(receiver, JSTypedArray::kBufferOffset); |
- Label if_receiverisneutered(assembler, Label::kDeferred); |
- assembler->GotoIf(assembler->IsDetachedBuffer(receiver_buffer), |
- &if_receiverisneutered); |
+ assembler.LoadObjectField(receiver, JSTypedArray::kBufferOffset); |
+ Label if_receiverisneutered(&assembler, Label::kDeferred); |
+ assembler.GotoIf(assembler.IsDetachedBuffer(receiver_buffer), |
+ &if_receiverisneutered); |
- assembler->Return(assembler->CreateArrayIterator(receiver, map, instance_type, |
- context, kIterationKind)); |
+ assembler.Return(assembler.CreateArrayIterator(receiver, map, instance_type, |
+ context, kIterationKind)); |
- Variable var_message(assembler, MachineRepresentation::kTagged); |
- assembler->Bind(&throw_bad_receiver); |
+ Variable var_message(&assembler, MachineRepresentation::kTagged); |
+ assembler.Bind(&throw_bad_receiver); |
var_message.Bind( |
- assembler->SmiConstant(Smi::FromInt(MessageTemplate::kNotTypedArray))); |
- assembler->Goto(&throw_typeerror); |
+ assembler.SmiConstant(Smi::FromInt(MessageTemplate::kNotTypedArray))); |
+ assembler.Goto(&throw_typeerror); |
- assembler->Bind(&if_receiverisneutered); |
- var_message.Bind(assembler->SmiConstant( |
- Smi::FromInt(MessageTemplate::kDetachedOperation))); |
- assembler->Goto(&throw_typeerror); |
+ assembler.Bind(&if_receiverisneutered); |
+ var_message.Bind( |
+ assembler.SmiConstant(Smi::FromInt(MessageTemplate::kDetachedOperation))); |
+ assembler.Goto(&throw_typeerror); |
- assembler->Bind(&throw_typeerror); |
+ assembler.Bind(&throw_typeerror); |
{ |
- Node* arg1 = assembler->HeapConstant( |
- assembler->isolate()->factory()->NewStringFromAsciiChecked(method_name, |
- TENURED)); |
- Node* result = assembler->CallRuntime(Runtime::kThrowTypeError, context, |
- var_message.value(), arg1); |
- assembler->Return(result); |
+ Node* arg1 = assembler.HeapConstant( |
+ assembler.isolate()->factory()->NewStringFromAsciiChecked(method_name, |
+ TENURED)); |
+ Node* result = assembler.CallRuntime(Runtime::kThrowTypeError, context, |
+ var_message.value(), arg1); |
+ assembler.Return(result); |
} |
} |
} // namespace |
void Builtins::Generate_TypedArrayPrototypeValues( |
- CodeStubAssembler* assembler) { |
+ compiler::CodeAssemblerState* state) { |
Generate_TypedArrayPrototypeIterationMethod<IterationKind::kValues>( |
- assembler, "%TypedArray%.prototype.values()"); |
+ state, "%TypedArray%.prototype.values()"); |
} |
void Builtins::Generate_TypedArrayPrototypeEntries( |
- CodeStubAssembler* assembler) { |
+ compiler::CodeAssemblerState* state) { |
Generate_TypedArrayPrototypeIterationMethod<IterationKind::kEntries>( |
- assembler, "%TypedArray%.prototype.entries()"); |
+ state, "%TypedArray%.prototype.entries()"); |
} |
-void Builtins::Generate_TypedArrayPrototypeKeys(CodeStubAssembler* assembler) { |
+void Builtins::Generate_TypedArrayPrototypeKeys( |
+ compiler::CodeAssemblerState* state) { |
Generate_TypedArrayPrototypeIterationMethod<IterationKind::kKeys>( |
- assembler, "%TypedArray%.prototype.keys()"); |
+ state, "%TypedArray%.prototype.keys()"); |
} |
} // namespace internal |