OLD | NEW |
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 <iomanip> | 7 #include <iomanip> |
8 | 8 |
9 #include "src/base/flags.h" | 9 #include "src/base/flags.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1112 // JS object operators. | 1112 // JS object operators. |
1113 | 1113 |
1114 | 1114 |
1115 Type* Typer::Visitor::TypeJSCreate(Node* node) { return Type::Object(); } | 1115 Type* Typer::Visitor::TypeJSCreate(Node* node) { return Type::Object(); } |
1116 | 1116 |
1117 | 1117 |
1118 Type* Typer::Visitor::TypeJSCreateArguments(Node* node) { | 1118 Type* Typer::Visitor::TypeJSCreateArguments(Node* node) { |
1119 return Type::OtherObject(); | 1119 return Type::OtherObject(); |
1120 } | 1120 } |
1121 | 1121 |
1122 | 1122 Type* Typer::Visitor::TypeJSCreateArray(Node* node) { return Type::Array(); } |
1123 Type* Typer::Visitor::TypeJSCreateArray(Node* node) { | |
1124 return Type::OtherObject(); | |
1125 } | |
1126 | |
1127 | 1123 |
1128 Type* Typer::Visitor::TypeJSCreateClosure(Node* node) { | 1124 Type* Typer::Visitor::TypeJSCreateClosure(Node* node) { |
1129 return Type::Function(); | 1125 return Type::Function(); |
1130 } | 1126 } |
1131 | 1127 |
1132 | 1128 |
1133 Type* Typer::Visitor::TypeJSCreateIterResultObject(Node* node) { | 1129 Type* Typer::Visitor::TypeJSCreateIterResultObject(Node* node) { |
1134 return Type::OtherObject(); | 1130 return Type::OtherObject(); |
1135 } | 1131 } |
1136 | 1132 |
1137 Type* Typer::Visitor::TypeJSCreateKeyValueArray(Node* node) { | 1133 Type* Typer::Visitor::TypeJSCreateKeyValueArray(Node* node) { |
1138 return Type::OtherObject(); | 1134 return Type::OtherObject(); |
1139 } | 1135 } |
1140 | 1136 |
1141 Type* Typer::Visitor::TypeJSCreateLiteralArray(Node* node) { | 1137 Type* Typer::Visitor::TypeJSCreateLiteralArray(Node* node) { |
1142 return Type::OtherObject(); | 1138 return Type::Array(); |
1143 } | 1139 } |
1144 | 1140 |
1145 | 1141 |
1146 Type* Typer::Visitor::TypeJSCreateLiteralObject(Node* node) { | 1142 Type* Typer::Visitor::TypeJSCreateLiteralObject(Node* node) { |
1147 return Type::OtherObject(); | 1143 return Type::OtherObject(); |
1148 } | 1144 } |
1149 | 1145 |
1150 | 1146 |
1151 Type* Typer::Visitor::TypeJSCreateLiteralRegExp(Node* node) { | 1147 Type* Typer::Visitor::TypeJSCreateLiteralRegExp(Node* node) { |
1152 return Type::OtherObject(); | 1148 return Type::OtherObject(); |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1509 return Type::Receiver(); | 1505 return Type::Receiver(); |
1510 case kArraySome: | 1506 case kArraySome: |
1511 return Type::Boolean(); | 1507 return Type::Boolean(); |
1512 case kArraySplice: | 1508 case kArraySplice: |
1513 return Type::Receiver(); | 1509 return Type::Receiver(); |
1514 case kArrayUnshift: | 1510 case kArrayUnshift: |
1515 return t->cache_.kPositiveSafeInteger; | 1511 return t->cache_.kPositiveSafeInteger; |
1516 | 1512 |
1517 // Object functions. | 1513 // Object functions. |
1518 case kObjectAssign: | 1514 case kObjectAssign: |
| 1515 return Type::Receiver(); |
1519 case kObjectCreate: | 1516 case kObjectCreate: |
1520 return Type::OtherObject(); | 1517 return Type::OtherObject(); |
1521 case kObjectHasOwnProperty: | 1518 case kObjectHasOwnProperty: |
1522 return Type::Boolean(); | 1519 return Type::Boolean(); |
1523 case kObjectToString: | 1520 case kObjectToString: |
1524 return Type::String(); | 1521 return Type::String(); |
1525 | 1522 |
1526 // RegExp functions. | 1523 // RegExp functions. |
1527 case kRegExpCompile: | 1524 case kRegExpCompile: |
1528 return Type::OtherObject(); | 1525 return Type::OtherObject(); |
1529 case kRegExpExec: | 1526 case kRegExpExec: |
1530 return Type::Union(Type::OtherObject(), Type::Null(), t->zone()); | 1527 return Type::Union(Type::Array(), Type::Null(), t->zone()); |
1531 case kRegExpTest: | 1528 case kRegExpTest: |
1532 return Type::Boolean(); | 1529 return Type::Boolean(); |
1533 case kRegExpToString: | 1530 case kRegExpToString: |
1534 return Type::String(); | 1531 return Type::String(); |
1535 | 1532 |
1536 // Function functions. | 1533 // Function functions. |
1537 case kFunctionHasInstance: | 1534 case kFunctionHasInstance: |
1538 return Type::Boolean(); | 1535 return Type::Boolean(); |
1539 | 1536 |
1540 // Global functions. | 1537 // Global functions. |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1998 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { | 1995 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { |
1999 if (Type::IsInteger(*value)) { | 1996 if (Type::IsInteger(*value)) { |
2000 return Type::Range(value->Number(), value->Number(), zone()); | 1997 return Type::Range(value->Number(), value->Number(), zone()); |
2001 } | 1998 } |
2002 return Type::NewConstant(value, zone()); | 1999 return Type::NewConstant(value, zone()); |
2003 } | 2000 } |
2004 | 2001 |
2005 } // namespace compiler | 2002 } // namespace compiler |
2006 } // namespace internal | 2003 } // namespace internal |
2007 } // namespace v8 | 2004 } // namespace v8 |
OLD | NEW |