Index: src/code-stub-assembler.h |
diff --git a/src/code-stub-assembler.h b/src/code-stub-assembler.h |
index e2b15df4aa529841a035f83e1295725c90418514..63fce28bd17c96e14d46dce3935137a4c87bea4e 100644 |
--- a/src/code-stub-assembler.h |
+++ b/src/code-stub-assembler.h |
@@ -64,9 +64,7 @@ class V8_EXPORT_PRIVATE 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 }; |
+ enum ParameterMode { 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 |
@@ -104,28 +102,23 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { |
return value; |
} |
-#define PARAMETER_BINOP(OpName, IntPtrOpName, SmiOpName, Int32OpName) \ |
- Node* OpName(Node* a, Node* b, ParameterMode mode) { \ |
- if (mode == SMI_PARAMETERS) { \ |
- return SmiOpName(a, b); \ |
- } else if (mode == INTPTR_PARAMETERS) { \ |
- return IntPtrOpName(a, b); \ |
- } else { \ |
- DCHECK_EQ(INTEGER_PARAMETERS, mode); \ |
- return Int32OpName(a, b); \ |
- } \ |
+#define PARAMETER_BINOP(OpName, IntPtrOpName, SmiOpName) \ |
+ Node* OpName(Node* a, Node* b, ParameterMode mode) { \ |
+ if (mode == SMI_PARAMETERS) { \ |
+ return SmiOpName(a, b); \ |
+ } else { \ |
+ DCHECK_EQ(INTPTR_PARAMETERS, mode); \ |
+ return IntPtrOpName(a, b); \ |
+ } \ |
} |
- PARAMETER_BINOP(IntPtrOrSmiAdd, IntPtrAdd, SmiAdd, Int32Add) |
- PARAMETER_BINOP(IntPtrOrSmiLessThan, IntPtrLessThan, SmiLessThan, |
- Int32LessThan) |
- PARAMETER_BINOP(IntPtrOrSmiGreaterThan, IntPtrGreaterThan, SmiGreaterThan, |
- Int32GreaterThan) |
+ PARAMETER_BINOP(IntPtrOrSmiAdd, IntPtrAdd, SmiAdd) |
+ PARAMETER_BINOP(IntPtrOrSmiLessThan, IntPtrLessThan, SmiLessThan) |
+ PARAMETER_BINOP(IntPtrOrSmiGreaterThan, IntPtrGreaterThan, SmiGreaterThan) |
PARAMETER_BINOP(IntPtrOrSmiGreaterThanOrEqual, IntPtrGreaterThanOrEqual, |
- SmiGreaterThanOrEqual, Int32GreaterThanOrEqual) |
- PARAMETER_BINOP(UintPtrOrSmiLessThan, UintPtrLessThan, SmiBelow, |
- Uint32LessThan) |
+ SmiGreaterThanOrEqual) |
+ PARAMETER_BINOP(UintPtrOrSmiLessThan, UintPtrLessThan, SmiBelow) |
PARAMETER_BINOP(UintPtrOrSmiGreaterThanOrEqual, UintPtrGreaterThanOrEqual, |
- SmiAboveOrEqual, Uint32GreaterThanOrEqual) |
+ SmiAboveOrEqual) |
#undef PARAMETER_BINOP |
Node* NoContextConstant(); |
@@ -372,23 +365,23 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { |
Node* LoadWeakCellValue(Node* weak_cell, Label* if_cleared = nullptr); |
// Load an array element from a FixedArray. |
- Node* LoadFixedArrayElement( |
- Node* object, Node* index, int additional_offset = 0, |
- ParameterMode parameter_mode = INTEGER_PARAMETERS); |
+ Node* LoadFixedArrayElement(Node* object, Node* index, |
+ int additional_offset = 0, |
+ ParameterMode parameter_mode = INTPTR_PARAMETERS); |
Node* LoadFixedArrayElement(Node* object, int index, |
int additional_offset = 0) { |
return LoadFixedArrayElement(object, IntPtrConstant(index), |
- additional_offset, INTPTR_PARAMETERS); |
+ additional_offset); |
} |
// Load an array element from a FixedArray, untag it and return it as Word32. |
Node* LoadAndUntagToWord32FixedArrayElement( |
Node* object, Node* index, int additional_offset = 0, |
- ParameterMode parameter_mode = INTEGER_PARAMETERS); |
+ ParameterMode parameter_mode = INTPTR_PARAMETERS); |
// Load an array element from a FixedDoubleArray. |
Node* LoadFixedDoubleArrayElement( |
Node* object, Node* index, MachineType machine_type, |
int additional_offset = 0, |
- ParameterMode parameter_mode = INTEGER_PARAMETERS, |
+ ParameterMode parameter_mode = INTPTR_PARAMETERS, |
Label* if_hole = nullptr); |
// Load Float64 value by |base| + |offset| address. If the value is a double |
@@ -399,7 +392,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { |
MachineType machine_type = MachineType::Float64()); |
Node* LoadFixedTypedArrayElement( |
Node* data_pointer, Node* index_node, ElementsKind elements_kind, |
- ParameterMode parameter_mode = INTEGER_PARAMETERS); |
+ ParameterMode parameter_mode = INTPTR_PARAMETERS); |
// Context manipulation |
Node* LoadContextElement(Node* context, int slot_index); |
@@ -433,18 +426,18 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { |
Node* object, int index, Node* value, |
WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER) { |
return StoreFixedArrayElement(object, IntPtrConstant(index), value, |
- barrier_mode, 0, INTPTR_PARAMETERS); |
+ barrier_mode); |
} |
Node* StoreFixedArrayElement( |
Node* object, Node* index, Node* value, |
WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER, |
int additional_offset = 0, |
- ParameterMode parameter_mode = INTEGER_PARAMETERS); |
+ ParameterMode parameter_mode = INTPTR_PARAMETERS); |
Node* StoreFixedDoubleArrayElement( |
Node* object, Node* index, Node* value, |
- ParameterMode parameter_mode = INTEGER_PARAMETERS); |
+ ParameterMode parameter_mode = INTPTR_PARAMETERS); |
Node* BuildAppendJSArray(ElementsKind kind, Node* context, Node* array, |
CodeStubArguments& args, Variable& arg_index, |
@@ -521,15 +514,15 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { |
// The ParameterMode argument is only used for the capacity parameter. |
std::pair<Node*, Node*> AllocateUninitializedJSArrayWithElements( |
ElementsKind kind, Node* array_map, Node* length, Node* allocation_site, |
- Node* capacity, ParameterMode capacity_mode = INTEGER_PARAMETERS); |
+ Node* capacity, ParameterMode capacity_mode = INTPTR_PARAMETERS); |
// Allocate a JSArray and fill elements with the hole. |
// The ParameterMode argument is only used for the capacity parameter. |
Node* AllocateJSArray(ElementsKind kind, Node* array_map, Node* capacity, |
Node* length, Node* allocation_site = nullptr, |
- ParameterMode capacity_mode = INTEGER_PARAMETERS); |
+ ParameterMode capacity_mode = INTPTR_PARAMETERS); |
Node* AllocateFixedArray(ElementsKind kind, Node* capacity, |
- ParameterMode mode = INTEGER_PARAMETERS, |
+ ParameterMode mode = INTPTR_PARAMETERS, |
AllocationFlags flags = kNone); |
// Perform CreateArrayIterator (ES6 #sec-createarrayiterator). |
@@ -541,14 +534,14 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { |
void FillFixedArrayWithValue(ElementsKind kind, Node* array, Node* from_index, |
Node* to_index, |
Heap::RootListIndex value_root_index, |
- ParameterMode mode = INTEGER_PARAMETERS); |
+ ParameterMode mode = INTPTR_PARAMETERS); |
// Copies all elements from |from_array| of |length| size to |
// |to_array| of the same size respecting the elements kind. |
void CopyFixedArrayElements( |
ElementsKind kind, Node* from_array, Node* to_array, Node* length, |
WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER, |
- ParameterMode mode = INTEGER_PARAMETERS) { |
+ ParameterMode mode = INTPTR_PARAMETERS) { |
CopyFixedArrayElements(kind, from_array, kind, to_array, length, length, |
barrier_mode, mode); |
} |
@@ -559,7 +552,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { |
ElementsKind from_kind, Node* from_array, ElementsKind to_kind, |
Node* to_array, Node* element_count, Node* capacity, |
WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER, |
- ParameterMode mode = INTEGER_PARAMETERS); |
+ ParameterMode mode = INTPTR_PARAMETERS); |
// Copies |character_count| elements from |from_string| to |to_string| |
// starting at the |from_index|'th character. |from_string| and |to_string| |
@@ -584,7 +577,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { |
ElementsKind to_kind, Label* if_hole); |
Node* CalculateNewElementsCapacity(Node* old_capacity, |
- ParameterMode mode = INTEGER_PARAMETERS); |
+ ParameterMode mode = INTPTR_PARAMETERS); |
// Tries to grow the |elements| array of given |object| to store the |key| |
// or bails out if the growing gap is too big. Returns new elements. |