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

Side by Side Diff: src/compiler/typer.cc

Issue 1422623013: [turbofan] Extend typer support for typeof operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Reduce to obvious cases. REBASE. Created 5 years, 1 month 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 | no next file » | 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/typer.h" 5 #include "src/compiler/typer.h"
6 6
7 #include "src/base/flags.h" 7 #include "src/base/flags.h"
8 #include "src/bootstrapper.h" 8 #include "src/bootstrapper.h"
9 #include "src/compilation-dependencies.h" 9 #include "src/compilation-dependencies.h"
10 #include "src/compiler/common-operator.h" 10 #include "src/compiler/common-operator.h"
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 return TypeUnaryOp(node, JSUnaryNotTyper); 1095 return TypeUnaryOp(node, JSUnaryNotTyper);
1096 } 1096 }
1097 1097
1098 1098
1099 Type* Typer::Visitor::JSTypeOfTyper(Type* type, Typer* t) { 1099 Type* Typer::Visitor::JSTypeOfTyper(Type* type, Typer* t) {
1100 Factory* const f = t->isolate()->factory(); 1100 Factory* const f = t->isolate()->factory();
1101 if (type->Is(Type::Boolean())) { 1101 if (type->Is(Type::Boolean())) {
1102 return Type::Constant(f->boolean_string(), t->zone()); 1102 return Type::Constant(f->boolean_string(), t->zone());
1103 } else if (type->Is(Type::Number())) { 1103 } else if (type->Is(Type::Number())) {
1104 return Type::Constant(f->number_string(), t->zone()); 1104 return Type::Constant(f->number_string(), t->zone());
1105 } else if (type->Is(Type::String())) {
1106 return Type::Constant(f->string_string(), t->zone());
1105 } else if (type->Is(Type::Symbol())) { 1107 } else if (type->Is(Type::Symbol())) {
1106 return Type::Constant(f->symbol_string(), t->zone()); 1108 return Type::Constant(f->symbol_string(), t->zone());
1107 } else if (type->Is(Type::Union(Type::Undefined(), Type::Undetectable(), 1109 } else if (type->Is(Type::Union(Type::Undefined(), Type::Undetectable(),
1108 t->zone()))) { 1110 t->zone()))) {
1109 return Type::Constant(f->undefined_string(), t->zone()); 1111 return Type::Constant(f->undefined_string(), t->zone());
1110 } else if (type->Is(Type::Null())) { 1112 } else if (type->Is(Type::Null())) {
1111 return Type::Constant(f->object_string(), t->zone()); 1113 return Type::Constant(f->object_string(), t->zone());
1114 } else if (type->IsConstant()) {
1115 return Type::Constant(
1116 Object::TypeOf(t->isolate(), type->AsConstant()->Value()), t->zone());
1112 } 1117 }
1113 return Type::InternalizedString(); 1118 return Type::InternalizedString();
1114 } 1119 }
1115 1120
1116 1121
1117 Type* Typer::Visitor::TypeJSTypeOf(Node* node) { 1122 Type* Typer::Visitor::TypeJSTypeOf(Node* node) {
1118 return TypeUnaryOp(node, JSTypeOfTyper); 1123 return TypeUnaryOp(node, JSTypeOfTyper);
1119 } 1124 }
1120 1125
1121 1126
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after
2197 } 2202 }
2198 if (Type::IsInteger(*value)) { 2203 if (Type::IsInteger(*value)) {
2199 return Type::Range(value->Number(), value->Number(), zone()); 2204 return Type::Range(value->Number(), value->Number(), zone());
2200 } 2205 }
2201 return Type::Constant(value, zone()); 2206 return Type::Constant(value, zone());
2202 } 2207 }
2203 2208
2204 } // namespace compiler 2209 } // namespace compiler
2205 } // namespace internal 2210 } // namespace internal
2206 } // namespace v8 2211 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698