Introduce 'kLengthString' in torque code
This CL replaces occurrences of "length" with the CSA macro LengthStringConstant(). R=jgruber@chromium.org Bug: v8:8015 Change-Id: Idf095587940f859e4c634865560abae325cd9fb4 Reviewed-on: https://chromium-review.googlesource.com/1201782 Reviewed-by: Jakob Gruber <jgruber@chromium.org> Commit-Queue: Simon Zünd <szuend@google.com> Cr-Commit-Position: refs/heads/master@{#55578}
This commit is contained in:
parent
669bfe4679
commit
b50fa92a2d
@ -20,7 +20,7 @@ module array {
|
||||
return a.length_fast;
|
||||
} else
|
||||
deferred {
|
||||
return ToLength_Inline(context, GetProperty(context, o, 'length'));
|
||||
return ToLength_Inline(context, GetProperty(context, o, kLengthString));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -149,12 +149,14 @@ extern macro TrueConstant(): Boolean;
|
||||
extern macro FalseConstant(): Boolean;
|
||||
extern macro Int32TrueConstant(): bool;
|
||||
extern macro Int32FalseConstant(): bool;
|
||||
extern macro LengthStringConstant(): String;
|
||||
|
||||
const Hole: Oddball = TheHoleConstant();
|
||||
const Null: Oddball = NullConstant();
|
||||
const Undefined: Oddball = UndefinedConstant();
|
||||
const True: Boolean = TrueConstant();
|
||||
const False: Boolean = FalseConstant();
|
||||
const kLengthString: String = LengthStringConstant();
|
||||
|
||||
const true: constexpr bool generates 'true';
|
||||
const false: constexpr bool generates 'false';
|
||||
|
5
third_party/v8/builtins/array-sort.tq
vendored
5
third_party/v8/builtins/array-sort.tq
vendored
@ -554,7 +554,7 @@ module array {
|
||||
if (IsJSArray(receiver)) return unsafe_cast<JSArray>(receiver).length_fast;
|
||||
|
||||
const len: Number =
|
||||
ToLength_Inline(context, GetProperty(context, receiver, 'length'));
|
||||
ToLength_Inline(context, GetProperty(context, receiver, kLengthString));
|
||||
return unsafe_cast<Smi>(len);
|
||||
}
|
||||
|
||||
@ -1782,8 +1782,7 @@ module array {
|
||||
}
|
||||
label slow {
|
||||
// 3. Let len be ? ToLength(? Get(obj, "length")).
|
||||
const len: Number =
|
||||
ToLength_Inline(context, GetProperty(context, obj, 'length'));
|
||||
const len: Number = GetLengthProperty(context, obj);
|
||||
|
||||
if (len < 2) return receiver;
|
||||
const nofNonUndefined: Smi = PrepareElementsForSort(context, obj, len);
|
||||
|
Loading…
Reference in New Issue
Block a user