0d1ffe30f8
For background and reasoning, see https://docs.google.com/document/d/1jvSEvXFHRkxg4JX-j6ho3nRqAF8vZI2Ai7RI8AY54gM/edit This is the first step towards pulling the DefineNamedOwn operation out of StoreIC. Summary of the renamed identifiers: Bytecodes: - StaNamedProperty -> SetNamedProperty: calls StoreIC and emitted for normal named property sets like obj.x = 1. - StaNamedOwnProperty -> DefineNamedOwnProperty: calls DefineNamedOwnIC (previously StoreOwnIC), and emitted for initialization of named properties in object literals and named public class fields. - StaKeyedProperty -> SetKeyedProperty: calls KeyedStoreIC and emitted for keyed property sets like obj[x] = 1. - StaKeyedPropertyAsDefine -> DefineKeyedOwnProperty: calls DefineKeyedOwnIC (previously KeyedDefineOwnIC) and emitted for initialization of private class fields and computed public class fields. - StaDataPropertyInLiteral -> DefineKeyedOwnPropertyInLiteral: calls DefineKeyedOwnPropertyInLiteral runtime function (previously DefineDataPropertyInLiteral) and emitted for initialization of keyed properties in object literals and static class initializers. (note that previously the StoreDataPropertyInLiteral runtime function name was taken by object spreads and array literal creation instead) - LdaKeyedProperty -> GetKeyedProperty, LdaNamedProperty -> GetNamedProperty, LdaNamedPropertyFromSuper -> GetNamedPropertyFromSuper: we drop the Sta prefix for the property store operations since the accumulator use is implicit and to make the wording more natural, for symmetry the Lda prefix for the property load operations is also dropped. opcodes: - (JS)StoreNamed -> (JS)SetNamedProperty: implements set semantics for named properties, compiled from SetNamedProperty (previously StaNamedProperty) and lowers to StoreIC or Runtime::kSetNamedProperty - (JS)StoreNamedOwn -> (JS)DefineNamedOwnProperty: implements define semantics for initializing named own properties in object literal and public class fields, compiled from DefineNamedOwnProperty (previously StaNamedOwnProperty) and lowers to DefineNamedOwnIC (previously StoreOwnIC) - (JS)StoreProperty -> (JS)SetKeyedProperty: implements set semantics for keyed properties, only compiled from SetKeyedProperty(previously StaKeyedProperty) and lowers to KeyedStoreIC - (JS)DefineProperty -> (JS)DefineKeyedOwnProperty: implements define semantics for initialization of private class fields and computed public class fields, compiled from DefineKeyedOwnProperty (previously StaKeyedPropertyAsDefine) and calls DefineKeyedOwnIC (previously KeyedDefineOwnIC). - (JS)StoreDataPropertyInLiteral -> (JS)DefineKeyedOwnPropertyInLiteral: implements define semantics for initialization of keyed properties in object literals and static class initializers, compiled from DefineKeyedOwnPropertyInLiteral (previously StaDataPropertyInLiteral) and calls the DefineKeyedOwnPropertyInLiteral runtime function (previously DefineDataPropertyInLiteral). Runtime: - DefineDataPropertyInLiteral -> DefineKeyedOwnPropertyInLiteral: following the bytecode/opcodes change, this is used by DefineKeyedOwnPropertyInLiteral (previously StaDataPropertyInLiteral) for object and class literal initialization. - StoreDataPropertyInLiteral -> DefineKeyedOwnPropertyInLiteral_Simple: it's just a simplified version of DefineDataPropertyInLiteral that does not update feedback or perform function name configuration. This is used by object spread and array literal creation. Since we are renaming DefineDataPropertyInLiteral to DefineKeyedOwnPropertyInLiteral, rename this simplified version with a `_Simple` suffix. We can consider merging it into DefineKeyedOwnPropertyInLiteral in the future. See https://docs.google.com/document/d/1jvSEvXFHRkxg4JX-j6ho3nRqAF8vZI2Ai7RI8AY54gM/edit?disco=AAAAQQIz6mU - Other changes following the bytecode/IR changes IC: - StoreOwn -> DefineNamedOwn: used for initialization of named properties in object literals and named public class fields. - StoreOwnIC -> DefineNamedOwnIC - StoreMode::kStoreOwn -> StoreMode::kDefineNamedOwn - StoreICMode::kStoreOwn -> StoreICMode::kDefineNamedOwn - IsStoreOwn() -> IsDefineNamedOwn() - DefineOwn -> DefineKeyedOwn: IsDefineOwnIC() was already just IsDefineKeyedOwnIC(), and IsAnyDefineOwn() includes both named and keyed defines so we don't need an extra generic predicate. - StoreMode::kDefineOwn -> StoreMode::kDefineKeyedOwn - StoreICMode::kDefineOwn -> StoreICMode::kDefineKeyedOwn - IsDefineOwn() -> IsDefineKeyedOwn() - IsDefineOwnIC() -> IsDefineKeyedOwnIC() - Removing IsKeyedDefineOwnIC() as its now a duplicate of IsDefineKeyedOwnIC() - KeyedDefineOwnIC -> DefineKeyedOwnIC, KeyedDefineOwnGenericGenerator() -> DefineKeyedOwnGenericGenerator: make the ordering of terms more consistent - IsAnyStoreOwn() -> IsAnyDefineOwn(): this includes the renamed and DefineNamedOwn and DefineKeyedOwn. Also is_any_store_own() is removed since it's just a duplicate of this. - IsKeyedStoreOwn() -> IsDefineNamedOwn(): it's unclear where the "keyed" part came from, but it's only used when DefineNamedOwnIC (previously StoreOwnIC) reuses KeyedStoreIC, so rename it accordingly Interpreter & compiler: - BytecodeArrayBuilder: following bytecode changes - StoreNamedProperty -> SetNamedProperty - StoreNamedOwnProperty -> DefineNamedOwnProperty - StoreKeyedProperty -> SetKeyedProperty - DefineKeyedProperty -> DefineKeyedOwnProperty - StoreDataPropertyInLiteral -> DefineKeyedOwnPropertyInLiteral - FeedbackSlotKind: - kDefineOwnKeyed -> kDefineKeyedOwn: make the ordering of terms more consistent - kStoreOwnNamed -> kDefineNamedOwn: following the IC change - kStoreNamed{Sloppy|Strict} -> kSetNamed{Sloppy|Strict}: only used in StoreIC for set semantics - kStoreKeyed{Sloppy|Strict} -> kSetKeyed{Sloppy|Strict}: only used in KeyedStoreIC for set semantics - kStoreDataPropertyInLiteral -> kDefineKeyedOwnPropertyInLiteral: following the IC change - BytecodeGraphBuilder - StoreMode::kNormal, kOwn -> NamedStoreMode::kSet, kDefineOwn: this is only used by BytecodeGraphBuilder::BuildNamedStore() to tell the difference between SetNamedProperty and DefineNamedOwnProperty operations. Not changed: - StoreIC and KeyedStoreIC currently contain mixed logic for both Set and Define operations, and the paths are controlled by feedback. The plan is to refactor the hierarchy like this: ``` - StoreIC - DefineNamedOwnIC - SetNamedIC (there could also be a NamedStoreIC if that's helpful) - KeyedStoreIC - SetKeyedIC - DefineKeyedOwnIC - DefineKeyedOwnICLiteral (could be merged into DefineKeyedOwnIC) - StoreInArrayLiteralIC - ... ``` StoreIC and KeyedStoreIC would then contain helpers shared by their subclasses, therefore it still makes sense to keep the word "Store" in their names since they would be generic base classes for both set and define operations. - The Lda and Sta prefixes of bytecodes not involving object properties (e.g. Ldar, Star, LdaZero) are kept, since this patch focuses on property operations, and distinction between Set and Define might be less relevant or nonexistent for bytecodes not involving object properties. We could consider rename some of them in future patches if that's helpful though. Bug: v8:12548 Change-Id: Ia36997b02f59a87da3247f20e0560a7eb13077f3 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3481475 Reviewed-by: Leszek Swirski <leszeks@chromium.org> Reviewed-by: Tobias Tebbi <tebbi@chromium.org> Reviewed-by: Igor Sheludko <ishell@chromium.org> Reviewed-by: Dominik Inführ <dinfuehr@chromium.org> Reviewed-by: Shu-yu Guo <syg@chromium.org> Reviewed-by: Jakob Gruber <jgruber@chromium.org> Reviewed-by: Toon Verwaest <verwaest@chromium.org> Commit-Queue: Joyee Cheung <joyee@igalia.com> Cr-Commit-Position: refs/heads/main@{#79409}
280 lines
6.0 KiB
Plaintext
280 lines
6.0 KiB
Plaintext
#
|
|
# Autogenerated by generate-bytecode-expectations.
|
|
#
|
|
|
|
---
|
|
wrap: yes
|
|
|
|
---
|
|
snippet: "
|
|
var a = 1; return ++a;
|
|
"
|
|
frame size: 1
|
|
parameter count: 1
|
|
bytecode array length: 7
|
|
bytecodes: [
|
|
/* 42 S> */ B(LdaSmi), I8(1),
|
|
B(Star0),
|
|
/* 45 S> */ B(Inc), U8(0),
|
|
B(Star0),
|
|
/* 56 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
var a = 1; return a++;
|
|
"
|
|
frame size: 2
|
|
parameter count: 1
|
|
bytecode array length: 12
|
|
bytecodes: [
|
|
/* 42 S> */ B(LdaSmi), I8(1),
|
|
B(Star0),
|
|
/* 45 S> */ B(ToNumeric), U8(0),
|
|
B(Star1),
|
|
B(Inc), U8(0),
|
|
B(Star0),
|
|
B(Ldar), R(1),
|
|
/* 56 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
var a = 1; return --a;
|
|
"
|
|
frame size: 1
|
|
parameter count: 1
|
|
bytecode array length: 7
|
|
bytecodes: [
|
|
/* 42 S> */ B(LdaSmi), I8(1),
|
|
B(Star0),
|
|
/* 45 S> */ B(Dec), U8(0),
|
|
B(Star0),
|
|
/* 56 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
var a = 1; return a--;
|
|
"
|
|
frame size: 2
|
|
parameter count: 1
|
|
bytecode array length: 12
|
|
bytecodes: [
|
|
/* 42 S> */ B(LdaSmi), I8(1),
|
|
B(Star0),
|
|
/* 45 S> */ B(ToNumeric), U8(0),
|
|
B(Star1),
|
|
B(Dec), U8(0),
|
|
B(Star0),
|
|
B(Ldar), R(1),
|
|
/* 56 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
var a = { val: 1 }; return a.val++;
|
|
"
|
|
frame size: 4
|
|
parameter count: 1
|
|
bytecode array length: 22
|
|
bytecodes: [
|
|
/* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41),
|
|
B(Star0),
|
|
/* 54 S> */ B(GetNamedProperty), R(0), U8(1), U8(1),
|
|
B(ToNumeric), U8(3),
|
|
B(Star2),
|
|
B(Inc), U8(3),
|
|
B(Star3),
|
|
/* 66 E> */ B(SetNamedProperty), R(0), U8(1), U8(4),
|
|
B(Ldar), R(2),
|
|
/* 69 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
OBJECT_BOILERPLATE_DESCRIPTION_TYPE,
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE ["val"],
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
var a = { val: 1 }; return --a.val;
|
|
"
|
|
frame size: 3
|
|
parameter count: 1
|
|
bytecode array length: 19
|
|
bytecodes: [
|
|
/* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41),
|
|
B(Star0),
|
|
/* 54 S> */ B(GetNamedProperty), R(0), U8(1), U8(1),
|
|
B(Dec), U8(3),
|
|
B(Star2),
|
|
/* 65 E> */ B(SetNamedProperty), R(0), U8(1), U8(4),
|
|
B(Ldar), R(2),
|
|
/* 69 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
OBJECT_BOILERPLATE_DESCRIPTION_TYPE,
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE ["val"],
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
var name = 'var'; var a = { val: 1 }; return a[name]--;
|
|
"
|
|
frame size: 6
|
|
parameter count: 1
|
|
bytecode array length: 26
|
|
bytecodes: [
|
|
/* 45 S> */ B(LdaConstant), U8(0),
|
|
B(Star0),
|
|
/* 60 S> */ B(CreateObjectLiteral), U8(1), U8(0), U8(41),
|
|
B(Star1),
|
|
/* 72 S> */ B(Ldar), R(0),
|
|
/* 81 E> */ B(GetKeyedProperty), R(1), U8(1),
|
|
B(ToNumeric), U8(3),
|
|
B(Star4),
|
|
B(Dec), U8(3),
|
|
B(Star5),
|
|
/* 86 E> */ B(SetKeyedProperty), R(1), R(0), U8(4),
|
|
B(Ldar), R(4),
|
|
/* 89 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE ["var"],
|
|
OBJECT_BOILERPLATE_DESCRIPTION_TYPE,
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
var name = 'var'; var a = { val: 1 }; return ++a[name];
|
|
"
|
|
frame size: 5
|
|
parameter count: 1
|
|
bytecode array length: 23
|
|
bytecodes: [
|
|
/* 45 S> */ B(LdaConstant), U8(0),
|
|
B(Star0),
|
|
/* 60 S> */ B(CreateObjectLiteral), U8(1), U8(0), U8(41),
|
|
B(Star1),
|
|
/* 72 S> */ B(Ldar), R(0),
|
|
/* 83 E> */ B(GetKeyedProperty), R(1), U8(1),
|
|
B(Inc), U8(3),
|
|
B(Star4),
|
|
/* 87 E> */ B(SetKeyedProperty), R(1), R(0), U8(4),
|
|
B(Ldar), R(4),
|
|
/* 89 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE ["var"],
|
|
OBJECT_BOILERPLATE_DESCRIPTION_TYPE,
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
var a = 1; var b = function() { return a }; return ++a;
|
|
"
|
|
frame size: 2
|
|
parameter count: 1
|
|
bytecode array length: 21
|
|
bytecodes: [
|
|
/* 30 E> */ B(CreateFunctionContext), U8(0), U8(1),
|
|
B(PushContext), R(1),
|
|
/* 42 S> */ B(LdaSmi), I8(1),
|
|
/* 42 E> */ B(StaCurrentContextSlot), U8(2),
|
|
/* 53 S> */ B(CreateClosure), U8(1), U8(0), U8(2),
|
|
B(Star0),
|
|
/* 78 S> */ B(LdaCurrentContextSlot), U8(2),
|
|
B(Inc), U8(0),
|
|
/* 87 E> */ B(StaCurrentContextSlot), U8(2),
|
|
/* 89 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
SCOPE_INFO_TYPE,
|
|
SHARED_FUNCTION_INFO_TYPE,
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
var a = 1; var b = function() { return a }; return a--;
|
|
"
|
|
frame size: 3
|
|
parameter count: 1
|
|
bytecode array length: 26
|
|
bytecodes: [
|
|
/* 30 E> */ B(CreateFunctionContext), U8(0), U8(1),
|
|
B(PushContext), R(1),
|
|
/* 42 S> */ B(LdaSmi), I8(1),
|
|
/* 42 E> */ B(StaCurrentContextSlot), U8(2),
|
|
/* 53 S> */ B(CreateClosure), U8(1), U8(0), U8(2),
|
|
B(Star0),
|
|
/* 78 S> */ B(LdaCurrentContextSlot), U8(2),
|
|
B(ToNumeric), U8(0),
|
|
B(Star2),
|
|
B(Dec), U8(0),
|
|
/* 86 E> */ B(StaCurrentContextSlot), U8(2),
|
|
B(Ldar), R(2),
|
|
/* 89 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
SCOPE_INFO_TYPE,
|
|
SHARED_FUNCTION_INFO_TYPE,
|
|
]
|
|
handlers: [
|
|
]
|
|
|
|
---
|
|
snippet: "
|
|
var idx = 1; var a = [1, 2]; return a[idx++] = 2;
|
|
"
|
|
frame size: 5
|
|
parameter count: 1
|
|
bytecode array length: 26
|
|
bytecodes: [
|
|
/* 44 S> */ B(LdaSmi), I8(1),
|
|
B(Star0),
|
|
/* 55 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37),
|
|
B(Star1),
|
|
/* 63 S> */ B(Ldar), R(0),
|
|
B(ToNumeric), U8(1),
|
|
B(Star3),
|
|
B(Inc), U8(1),
|
|
B(Star0),
|
|
B(LdaSmi), I8(2),
|
|
B(Star4),
|
|
/* 79 E> */ B(SetKeyedProperty), R(1), R(3), U8(2),
|
|
B(Ldar), R(4),
|
|
/* 83 S> */ B(Return),
|
|
]
|
|
constant pool: [
|
|
ARRAY_BOILERPLATE_DESCRIPTION_TYPE,
|
|
]
|
|
handlers: [
|
|
]
|
|
|