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

Unified Diff: src/code-stub-assembler.h

Issue 2321643002: [stubs] Introduce CSA::OptimalParameterMode(), TagParameter() and UntagParameter(). (Closed)
Patch Set: Created 4 years, 3 months 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-internal.cc ('k') | src/code-stub-assembler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « src/builtins/builtins-internal.cc ('k') | src/code-stub-assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698