Commit d389e49b authored by bmeurer's avatar bmeurer Committed by Commit bot

[turbofan] Recognize a couple of collection.js intrinsics.

Right now running the Map and Set builtins with I+TF would tank
seriously because these builtins are still built on top of a
couple of classic intrinsics that TurboFan doesn't understand.
Middle-term the idea is to replace the Map and Set builtins with
a CodeStubAssembler based solution, but for that might not be
ready in time, so adding support for a couple of the critical
intrinsics to mitigate the tankage a bit, namely

 - %_JSCollectionGetTable,
 - %_TheHole, and
 - %_StringGetRawHashField.

Together these double the score on most of the existing performance
tests for collections.

R=yangguo@chromium.org
BUG=v8:5267

Review-Url: https://codereview.chromium.org/2647733002
Cr-Commit-Position: refs/heads/master@{#42521}
parent 89f5efb7
......@@ -103,6 +103,15 @@ FieldAccess AccessBuilder::ForJSObjectOffset(
return access;
}
// static
FieldAccess AccessBuilder::ForJSCollectionTable() {
FieldAccess access = {kTaggedBase, JSCollection::kTableOffset,
MaybeHandle<Name>(), MaybeHandle<Map>(),
Type::OtherInternal(), MachineType::TaggedPointer(),
kPointerWriteBarrier};
return access;
}
// static
FieldAccess AccessBuilder::ForJSFunctionPrototypeOrInitialMap() {
FieldAccess access = {
......@@ -483,9 +492,9 @@ FieldAccess AccessBuilder::ForModuleRegularImports() {
// static
FieldAccess AccessBuilder::ForNameHashField() {
FieldAccess access = {kTaggedBase, Name::kHashFieldOffset,
Handle<Name>(), MaybeHandle<Map>(),
Type::Internal(), MachineType::Uint32(),
FieldAccess access = {kTaggedBase, Name::kHashFieldOffset,
Handle<Name>(), MaybeHandle<Map>(),
Type::Unsigned32(), MachineType::Uint32(),
kNoWriteBarrier};
return access;
}
......
......@@ -52,6 +52,9 @@ class V8_EXPORT_PRIVATE AccessBuilder final
static FieldAccess ForJSObjectOffset(
int offset, WriteBarrierKind write_barrier_kind = kFullWriteBarrier);
// Provides access to JSCollecton::table() field.
static FieldAccess ForJSCollectionTable();
// Provides access to JSFunction::prototype_or_initial_map() field.
static FieldAccess ForJSFunctionPrototypeOrInitialMap();
......
......@@ -48,6 +48,8 @@ Reduction JSIntrinsicLowering::Reduce(Node* node) {
return ReduceIsInstanceType(node, JS_ARRAY_TYPE);
case Runtime::kInlineIsTypedArray:
return ReduceIsInstanceType(node, JS_TYPED_ARRAY_TYPE);
case Runtime::kInlineIsJSProxy:
return ReduceIsInstanceType(node, JS_PROXY_TYPE);
case Runtime::kInlineIsJSReceiver:
return ReduceIsJSReceiver(node);
case Runtime::kInlineIsSmi:
......@@ -74,6 +76,12 @@ Reduction JSIntrinsicLowering::Reduce(Node* node) {
return ReduceCall(node);
case Runtime::kInlineGetSuperConstructor:
return ReduceGetSuperConstructor(node);
case Runtime::kInlineJSCollectionGetTable:
return ReduceJSCollectionGetTable(node);
case Runtime::kInlineStringGetRawHashField:
return ReduceStringGetRawHashField(node);
case Runtime::kInlineTheHole:
return ReduceTheHole(node);
default:
break;
}
......@@ -307,6 +315,30 @@ Reduction JSIntrinsicLowering::ReduceGetSuperConstructor(Node* node) {
active_function_map, effect, control);
}
Reduction JSIntrinsicLowering::ReduceJSCollectionGetTable(Node* node) {
Node* collection = NodeProperties::GetValueInput(node, 0);
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
return Change(node,
simplified()->LoadField(AccessBuilder::ForJSCollectionTable()),
collection, effect, control);
}
Reduction JSIntrinsicLowering::ReduceStringGetRawHashField(Node* node) {
Node* string = NodeProperties::GetValueInput(node, 0);
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
return Change(node,
simplified()->LoadField(AccessBuilder::ForNameHashField()),
string, effect, control);
}
Reduction JSIntrinsicLowering::ReduceTheHole(Node* node) {
Node* value = jsgraph()->TheHoleConstant();
ReplaceWithValue(node, value);
return Replace(value);
}
Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a,
Node* b) {
RelaxControls(node);
......
......@@ -61,6 +61,12 @@ class V8_EXPORT_PRIVATE JSIntrinsicLowering final
Reduction ReduceCall(Node* node);
Reduction ReduceGetSuperConstructor(Node* node);
// TODO(turbofan): collection.js support; drop once Maps and Sets are
// converted to proper CodeStubAssembler based builtins.
Reduction ReduceJSCollectionGetTable(Node* node);
Reduction ReduceStringGetRawHashField(Node* node);
Reduction ReduceTheHole(Node* node);
Reduction Change(Node* node, const Operator* op);
Reduction Change(Node* node, const Operator* op, Node* a, Node* b);
Reduction Change(Node* node, const Operator* op, Node* a, Node* b, Node* c);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment