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

Side by Side Diff: src/compiler/js-builtin-reducer.cc

Issue 2819583002: [turbofan] Introduce a dedicated Array type. (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/compiler/js-create-lowering.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/js-builtin-reducer.h" 5 #include "src/compiler/js-builtin-reducer.h"
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/code-factory.h" 8 #include "src/code-factory.h"
9 #include "src/compilation-dependencies.h" 9 #include "src/compilation-dependencies.h"
10 #include "src/compiler/access-builder.h" 10 #include "src/compiler/access-builder.h"
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 726
727 // ES6 section 22.1.2.2 Array.isArray ( arg ) 727 // ES6 section 22.1.2.2 Array.isArray ( arg )
728 Reduction JSBuiltinReducer::ReduceArrayIsArray(Node* node) { 728 Reduction JSBuiltinReducer::ReduceArrayIsArray(Node* node) {
729 // We certainly know that undefined is not an array. 729 // We certainly know that undefined is not an array.
730 if (node->op()->ValueInputCount() < 3) { 730 if (node->op()->ValueInputCount() < 3) {
731 Node* value = jsgraph()->FalseConstant(); 731 Node* value = jsgraph()->FalseConstant();
732 ReplaceWithValue(node, value); 732 ReplaceWithValue(node, value);
733 return Replace(value); 733 return Replace(value);
734 } 734 }
735 Node* value = NodeProperties::GetValueInput(node, 2); 735 Node* value = NodeProperties::GetValueInput(node, 2);
736 Type* value_type = NodeProperties::GetType(value);
736 Node* context = NodeProperties::GetContextInput(node); 737 Node* context = NodeProperties::GetContextInput(node);
737 Node* frame_state = NodeProperties::GetFrameStateInput(node); 738 Node* frame_state = NodeProperties::GetFrameStateInput(node);
738 Node* effect = NodeProperties::GetEffectInput(node); 739 Node* effect = NodeProperties::GetEffectInput(node);
739 Node* control = NodeProperties::GetControlInput(node); 740 Node* control = NodeProperties::GetControlInput(node);
740 741
742 // Constant-fold based on {value} type.
743 if (value_type->Is(Type::Array())) {
744 Node* value = jsgraph()->TrueConstant();
745 ReplaceWithValue(node, value);
746 return Replace(value);
747 } else if (!value_type->Maybe(Type::ArrayOrProxy())) {
748 Node* value = jsgraph()->FalseConstant();
749 ReplaceWithValue(node, value);
750 return Replace(value);
751 }
752
741 int count = 0; 753 int count = 0;
742 Node* values[5]; 754 Node* values[5];
743 Node* effects[5]; 755 Node* effects[5];
744 Node* controls[4]; 756 Node* controls[4];
745 757
746 // Check if the {value} is a Smi. 758 // Check if the {value} is a Smi.
747 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), value); 759 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), value);
748 control = 760 control =
749 graph()->NewNode(common()->Branch(BranchHint::kFalse), check, control); 761 graph()->NewNode(common()->Branch(BranchHint::kFalse), check, control);
750 762
(...skipping 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after
2332 return jsgraph()->simplified(); 2344 return jsgraph()->simplified();
2333 } 2345 }
2334 2346
2335 JSOperatorBuilder* JSBuiltinReducer::javascript() const { 2347 JSOperatorBuilder* JSBuiltinReducer::javascript() const {
2336 return jsgraph()->javascript(); 2348 return jsgraph()->javascript();
2337 } 2349 }
2338 2350
2339 } // namespace compiler 2351 } // namespace compiler
2340 } // namespace internal 2352 } // namespace internal
2341 } // namespace v8 2353 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/js-create-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698