Index: src/code-stub-assembler.h |
diff --git a/src/code-stub-assembler.h b/src/code-stub-assembler.h |
index 378dc4d56e57fc1d7ca2f0129815f3f2edfe293b..52373e6f7eb080ee737b8ae8d5a864c807ac8cc2 100644 |
--- a/src/code-stub-assembler.h |
+++ b/src/code-stub-assembler.h |
@@ -46,8 +46,30 @@ class CodeStubAssembler : public compiler::CodeAssembler { |
typedef base::Flags<AllocationFlag> AllocationFlags; |
+ // TODO(ishell): Fix all loads/stores from arrays by int32 offsets/indices |
+ // and eventually remove INTEGER_PARAMETERS in favour of INTPTR_PARAMETERS. |
enum ParameterMode { INTEGER_PARAMETERS, SMI_PARAMETERS, INTPTR_PARAMETERS }; |
+ // On 32-bit platforms, there is a slight performance advantage to doing all |
+ // of the array offset/index arithmetic with SMIs, since it's possible |
+ // to save a few tag/untag operations without paying an extra expense when |
+ // calculating array offset (the smi math can be folded away) and there are |
+ // fewer live ranges. Thus only convert indices to untagged value on 64-bit |
+ // platforms. |
+ ParameterMode OptimalParameterMode() const { |
+ return Is64() ? INTPTR_PARAMETERS : SMI_PARAMETERS; |
+ } |
+ |
+ compiler::Node* UntagParameter(compiler::Node* value, ParameterMode mode) { |
+ if (mode != SMI_PARAMETERS) value = SmiUntag(value); |
+ return value; |
+ } |
+ |
+ compiler::Node* TagParameter(compiler::Node* value, ParameterMode mode) { |
+ if (mode != SMI_PARAMETERS) value = SmiTag(value); |
+ return value; |
+ } |
+ |
compiler::Node* BooleanMapConstant(); |
compiler::Node* EmptyStringConstant(); |
compiler::Node* HeapNumberMapConstant(); |
@@ -226,8 +248,6 @@ class CodeStubAssembler : public compiler::CodeAssembler { |
compiler::Node* LoadWeakCellValue(compiler::Node* weak_cell, |
Label* if_cleared = nullptr); |
- compiler::Node* AllocateUninitializedFixedArray(compiler::Node* length); |
- |
// Load an array element from a FixedArray. |
compiler::Node* LoadFixedArrayElement( |
compiler::Node* object, compiler::Node* int32_index, |