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

Side by Side Diff: src/compiler/js-typed-lowering.cc

Issue 2646743002: [turbofan] Improve constant-folding for typeof. (Closed)
Patch Set: Created 3 years, 11 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/types.h » ('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-typed-lowering.h" 5 #include "src/compiler/js-typed-lowering.h"
6 6
7 #include "src/ast/modules.h" 7 #include "src/ast/modules.h"
8 #include "src/builtins/builtins-utils.h" 8 #include "src/builtins/builtins-utils.h"
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/compilation-dependencies.h" 10 #include "src/compilation-dependencies.h"
(...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 Type* type = NodeProperties::GetType(input); 847 Type* type = NodeProperties::GetType(input);
848 Factory* const f = factory(); 848 Factory* const f = factory();
849 if (type->Is(Type::Boolean())) { 849 if (type->Is(Type::Boolean())) {
850 return Replace(jsgraph()->Constant(f->boolean_string())); 850 return Replace(jsgraph()->Constant(f->boolean_string()));
851 } else if (type->Is(Type::Number())) { 851 } else if (type->Is(Type::Number())) {
852 return Replace(jsgraph()->Constant(f->number_string())); 852 return Replace(jsgraph()->Constant(f->number_string()));
853 } else if (type->Is(Type::String())) { 853 } else if (type->Is(Type::String())) {
854 return Replace(jsgraph()->Constant(f->string_string())); 854 return Replace(jsgraph()->Constant(f->string_string()));
855 } else if (type->Is(Type::Symbol())) { 855 } else if (type->Is(Type::Symbol())) {
856 return Replace(jsgraph()->Constant(f->symbol_string())); 856 return Replace(jsgraph()->Constant(f->symbol_string()));
857 } else if (type->Is(Type::Union(Type::Undefined(), Type::OtherUndetectable(), 857 } else if (type->Is(Type::OtherUndetectableOrUndefined())) {
858 graph()->zone()))) {
859 return Replace(jsgraph()->Constant(f->undefined_string())); 858 return Replace(jsgraph()->Constant(f->undefined_string()));
860 } else if (type->Is(Type::Null())) { 859 } else if (type->Is(Type::NonCallableOrNull())) {
861 return Replace(jsgraph()->Constant(f->object_string())); 860 return Replace(jsgraph()->Constant(f->object_string()));
862 } else if (type->Is(Type::Function())) { 861 } else if (type->Is(Type::Function())) {
863 return Replace(jsgraph()->Constant(f->function_string())); 862 return Replace(jsgraph()->Constant(f->function_string()));
864 } else if (type->IsHeapConstant()) { 863 } else if (type->IsHeapConstant()) {
865 return Replace(jsgraph()->Constant( 864 return Replace(jsgraph()->Constant(
866 Object::TypeOf(isolate(), type->AsHeapConstant()->Value()))); 865 Object::TypeOf(isolate(), type->AsHeapConstant()->Value())));
867 } else if (type->IsOtherNumberConstant()) {
868 return Replace(jsgraph()->Constant(f->number_string()));
869 } 866 }
870 867
871 return NoChange(); 868 return NoChange();
872 } 869 }
873 870
874 Reduction JSTypedLowering::ReduceJSEqualTypeOf(Node* node, bool invert) { 871 Reduction JSTypedLowering::ReduceJSEqualTypeOf(Node* node, bool invert) {
875 Node* input; 872 Node* input;
876 Handle<String> type; 873 Handle<String> type;
877 HeapObjectBinopMatcher m(node); 874 HeapObjectBinopMatcher m(node);
878 if (m.left().IsJSTypeOf() && m.right().HasValue() && 875 if (m.left().IsJSTypeOf() && m.right().HasValue() &&
(...skipping 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after
2419 } 2416 }
2420 2417
2421 2418
2422 CompilationDependencies* JSTypedLowering::dependencies() const { 2419 CompilationDependencies* JSTypedLowering::dependencies() const {
2423 return dependencies_; 2420 return dependencies_;
2424 } 2421 }
2425 2422
2426 } // namespace compiler 2423 } // namespace compiler
2427 } // namespace internal 2424 } // namespace internal
2428 } // namespace v8 2425 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698