[builtins] Speed up TypedArrayInitialize in CodeStubAssembler
On those architectures that do support unaligned memory access there is no need to emit heap alignment code in TypedArrayInitialize. BUG=chromium:708545 Review-Url: https://codereview.chromium.org/2802003003 Cr-Commit-Position: refs/heads/master@{#44501}
This commit is contained in:
parent
03e260cb2a
commit
d9691952c1
@ -214,7 +214,17 @@ void TypedArrayBuiltinsAssembler::DoInitialize(Node* const holder, Node* length,
|
||||
// Allocate a FixedTypedArray and set the length, base pointer and external
|
||||
// pointer.
|
||||
CSA_ASSERT(this, IsRegularHeapObjectSize(total_size.value()));
|
||||
Node* elements = AllocateInNewSpace(total_size.value(), kDoubleAlignment);
|
||||
|
||||
Node* elements;
|
||||
int heap_alignment =
|
||||
ElementSizeLog2Of(MachineType::PointerRepresentation());
|
||||
|
||||
if (UnalignedLoadSupported(MachineType::Float64(), heap_alignment) &&
|
||||
UnalignedStoreSupported(MachineType::Float64(), heap_alignment)) {
|
||||
elements = AllocateInNewSpace(total_size.value());
|
||||
} else {
|
||||
elements = AllocateInNewSpace(total_size.value(), kDoubleAlignment);
|
||||
}
|
||||
|
||||
StoreMapNoWriteBarrier(elements, fixed_typed_map.value());
|
||||
StoreObjectFieldNoWriteBarrier(elements, FixedArray::kLengthOffset, length);
|
||||
|
@ -758,6 +758,17 @@ void CodeAssembler::Switch(Node* index, Label* default_label,
|
||||
labels, case_count);
|
||||
}
|
||||
|
||||
bool CodeAssembler::UnalignedLoadSupported(const MachineType& machineType,
|
||||
uint8_t alignment) const {
|
||||
return raw_assembler()->machine()->UnalignedLoadSupported(machineType,
|
||||
alignment);
|
||||
}
|
||||
bool CodeAssembler::UnalignedStoreSupported(const MachineType& machineType,
|
||||
uint8_t alignment) const {
|
||||
return raw_assembler()->machine()->UnalignedStoreSupported(machineType,
|
||||
alignment);
|
||||
}
|
||||
|
||||
// RawMachineAssembler delegate helpers:
|
||||
Isolate* CodeAssembler::isolate() const { return raw_assembler()->isolate(); }
|
||||
|
||||
|
@ -420,6 +420,11 @@ class V8_EXPORT_PRIVATE CodeAssembler {
|
||||
|
||||
void BreakOnNode(int node_id);
|
||||
|
||||
bool UnalignedLoadSupported(const MachineType& machineType,
|
||||
uint8_t alignment) const;
|
||||
bool UnalignedStoreSupported(const MachineType& machineType,
|
||||
uint8_t alignment) const;
|
||||
|
||||
protected:
|
||||
void RegisterCallGenerationCallbacks(
|
||||
const CodeAssemblerCallback& call_prologue,
|
||||
|
Loading…
Reference in New Issue
Block a user