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

Unified Diff: src/compiler/js-intrinsic-lowering.cc

Issue 1137703002: Add a MathFloor stub generated with TurboFan (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix comment Created 5 years, 7 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
Index: src/compiler/js-intrinsic-lowering.cc
diff --git a/src/compiler/js-intrinsic-lowering.cc b/src/compiler/js-intrinsic-lowering.cc
index b299e8bb0e40d91b19469f21f33731fb2b49e115..b60d2ed9af1f8af01aaea6bb28a4515c57195691 100644
--- a/src/compiler/js-intrinsic-lowering.cc
+++ b/src/compiler/js-intrinsic-lowering.cc
@@ -24,7 +24,9 @@ Reduction JSIntrinsicLowering::Reduce(Node* node) {
if (node->opcode() != IrOpcode::kJSCallRuntime) return NoChange();
const Runtime::Function* const f =
Runtime::FunctionForId(CallRuntimeParametersOf(node->op()).id());
- if (f->intrinsic_type != Runtime::IntrinsicType::INLINE) return NoChange();
+ if (f->intrinsic_type != Runtime::IntrinsicType::INLINE) {
+ return NoChange();
+ }
switch (f->function_id) {
case Runtime::kInlineConstructDouble:
return ReduceConstructDouble(node);
@@ -38,6 +40,8 @@ Reduction JSIntrinsicLowering::Reduce(Node* node) {
return ReduceHeapObjectGetMap(node);
case Runtime::kInlineIncrementStatsCounter:
return ReduceIncrementStatsCounter(node);
+ case Runtime::kInlineIsMinusZero:
+ return ReduceIsMinusZero(node);
case Runtime::kInlineIsArray:
return ReduceIsInstanceType(node, JS_ARRAY_TYPE);
case Runtime::kInlineIsFunction:
@@ -74,6 +78,10 @@ Reduction JSIntrinsicLowering::Reduce(Node* node) {
return ReduceUnLikely(node, BranchHint::kFalse);
case Runtime::kInlineValueOf:
return ReduceValueOf(node);
+ case Runtime::kInlineFixedArraySet:
+ return ReduceFixedArraySet(node);
+ case Runtime::kInlineGetTypeFeedbackVector:
+ return ReduceGetTypeFeedbackVector(node);
default:
break;
}
@@ -170,6 +178,33 @@ Reduction JSIntrinsicLowering::ReduceIncrementStatsCounter(Node* node) {
}
+Reduction JSIntrinsicLowering::ReduceIsMinusZero(Node* node) {
+ Node* value = NodeProperties::GetValueInput(node, 0);
+ Node* effect = NodeProperties::GetEffectInput(node);
+
+ Node* double_lo =
+ graph()->NewNode(machine()->Float64ExtractLowWord32(), value);
+ Node* check1 = graph()->NewNode(machine()->Word32Equal(), double_lo,
+ jsgraph()->ZeroConstant());
+
+ Node* double_hi =
+ graph()->NewNode(machine()->Float64ExtractHighWord32(), value);
+ Node* check2 = graph()->NewNode(
+ machine()->Word32Equal(), double_hi,
+ jsgraph()->Int32Constant(static_cast<int32_t>(0x80000000)));
+
+ NodeProperties::ReplaceWithValue(node, node, effect);
+
+ Node* and_result = graph()->NewNode(machine()->Word32And(), check1, check2);
+
+ node->set_op(machine()->Word32Equal());
Benedikt Meurer 2015/05/08 12:17:07 How about return Change(node, machine()->Word32E
danno 2015/05/08 15:28:01 Done.
+ node->ReplaceInput(0, and_result);
+ node->ReplaceInput(1, jsgraph()->OneConstant());
+ node->TrimInputCount(2);
+ return Changed(node);
+}
+
+
Reduction JSIntrinsicLowering::ReduceIsInstanceType(
Node* node, InstanceType instance_type) {
// if (%_IsSmi(value)) {
@@ -398,6 +433,32 @@ Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op) {
}
+Reduction JSIntrinsicLowering::ReduceFixedArraySet(Node* node) {
+ Node* base = node->InputAt(0);
+ Node* index = node->InputAt(1);
+ Node* value = node->InputAt(2);
+ Node* effect = NodeProperties::GetEffectInput(node);
+ Node* control = NodeProperties::GetControlInput(node);
+ Node* store = (graph()->NewNode(
+ simplified()->StoreElement(AccessBuilder::ForFixedArrayElement()), base,
+ index, value, effect, control));
+ NodeProperties::ReplaceWithValue(node, value, store);
+ return Changed(store);
+}
+
+
+Reduction JSIntrinsicLowering::ReduceGetTypeFeedbackVector(Node* node) {
+ Node* func = node->InputAt(0);
+ Node* effect = NodeProperties::GetEffectInput(node);
+ Node* control = NodeProperties::GetControlInput(node);
+ FieldAccess access = AccessBuilder::ForSharedFunctionInfo();
+ Node* load =
+ graph()->NewNode(simplified()->LoadField(access), func, effect, control);
+ access = AccessBuilder::ForTypeFeedbackVector();
+ return Change(node, simplified()->LoadField(access), load, load, control);
+}
+
+
Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a,
Node* b, Node* c) {
node->set_op(op);
@@ -410,6 +471,20 @@ Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a,
}
+Reduction JSIntrinsicLowering::Change(Node* node, const Operator* op, Node* a,
Benedikt Meurer 2015/05/08 12:17:07 We don't need this helper?
danno 2015/05/08 15:28:01 Done.
+ Node* b, Node* c, Node* d, Node* e) {
+ node->set_op(op);
+ node->ReplaceInput(0, a);
+ node->ReplaceInput(1, b);
+ node->ReplaceInput(2, c);
+ node->ReplaceInput(3, d);
+ node->ReplaceInput(4, e);
+ node->TrimInputCount(5);
+ NodeProperties::ReplaceWithValue(node, node, node);
+ return Changed(node);
+}
+
+
Reduction JSIntrinsicLowering::ChangeToUndefined(Node* node, Node* effect) {
NodeProperties::ReplaceWithValue(node, jsgraph()->UndefinedConstant(),
effect);

Powered by Google App Engine
This is Rietveld 408576698