From f68267aa276753b046439bd9f6e84dbe7d752b20 Mon Sep 17 00:00:00 2001 From: bmeurer Date: Thu, 9 Feb 2017 07:24:25 -0800 Subject: [PATCH] [turbofan] Add support for %_MaxSmi and %_TypedArrayMaxSizeInHeap. These intrinsics are heavily used in typedarray.js and are part of the reason why the typed array constructors are more than twice as slow in TurboFan compared to Crankshaft. R=jarin@chromium.org Review-Url: https://codereview.chromium.org/2684193003 Cr-Commit-Position: refs/heads/master@{#43063} --- src/compiler/js-intrinsic-lowering.cc | 16 ++++++++++++++++ src/compiler/js-intrinsic-lowering.h | 5 +++++ 2 files changed, 21 insertions(+) diff --git a/src/compiler/js-intrinsic-lowering.cc b/src/compiler/js-intrinsic-lowering.cc index 04f978f77c..31cfe1116d 100644 --- a/src/compiler/js-intrinsic-lowering.cc +++ b/src/compiler/js-intrinsic-lowering.cc @@ -76,6 +76,10 @@ Reduction JSIntrinsicLowering::Reduce(Node* node) { return ReduceCall(node); case Runtime::kInlineGetSuperConstructor: return ReduceGetSuperConstructor(node); + case Runtime::kInlineMaxSmi: + return ReduceMaxSmi(node); + case Runtime::kInlineTypedArrayMaxSizeInHeap: + return ReduceTypedArrayMaxSizeInHeap(node); case Runtime::kInlineJSCollectionGetTable: return ReduceJSCollectionGetTable(node); case Runtime::kInlineStringGetRawHashField: @@ -317,6 +321,18 @@ Reduction JSIntrinsicLowering::ReduceGetSuperConstructor(Node* node) { active_function_map, effect, control); } +Reduction JSIntrinsicLowering::ReduceMaxSmi(Node* node) { + Node* value = jsgraph()->Constant(Smi::kMaxValue); + ReplaceWithValue(node, value); + return Replace(value); +} + +Reduction JSIntrinsicLowering::ReduceTypedArrayMaxSizeInHeap(Node* node) { + Node* value = jsgraph()->Constant(FLAG_typed_array_max_size_in_heap); + ReplaceWithValue(node, value); + return Replace(value); +} + Reduction JSIntrinsicLowering::ReduceJSCollectionGetTable(Node* node) { Node* collection = NodeProperties::GetValueInput(node, 0); Node* effect = NodeProperties::GetEffectInput(node); diff --git a/src/compiler/js-intrinsic-lowering.h b/src/compiler/js-intrinsic-lowering.h index 50fcd8ce2b..d139e674ff 100644 --- a/src/compiler/js-intrinsic-lowering.h +++ b/src/compiler/js-intrinsic-lowering.h @@ -61,6 +61,11 @@ class V8_EXPORT_PRIVATE JSIntrinsicLowering final Reduction ReduceCall(Node* node); Reduction ReduceGetSuperConstructor(Node* node); + // TODO(turbofan): typedarray.js support; drop once TypedArrays are + // converted to proper CodeStubAssembler based builtins. + Reduction ReduceMaxSmi(Node* node); + Reduction ReduceTypedArrayMaxSizeInHeap(Node* node); + // TODO(turbofan): collection.js support; drop once Maps and Sets are // converted to proper CodeStubAssembler based builtins. Reduction ReduceJSCollectionGetTable(Node* node);