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

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

Issue 2511223003: [turbofan] Properly optimize instanceof (even in the presence of @@hasInstance). (Closed)
Patch Set: Created 4 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
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 <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 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1235 1235
1236 1236
1237 Type* Typer::Visitor::TypeJSDeleteProperty(Node* node) { 1237 Type* Typer::Visitor::TypeJSDeleteProperty(Node* node) {
1238 return Type::Boolean(); 1238 return Type::Boolean();
1239 } 1239 }
1240 1240
1241 Type* Typer::Visitor::TypeJSHasProperty(Node* node) { return Type::Boolean(); } 1241 Type* Typer::Visitor::TypeJSHasProperty(Node* node) { return Type::Boolean(); }
1242 1242
1243 Type* Typer::Visitor::TypeJSInstanceOf(Node* node) { return Type::Boolean(); } 1243 Type* Typer::Visitor::TypeJSInstanceOf(Node* node) { return Type::Boolean(); }
1244 1244
1245 Type* Typer::Visitor::TypeJSOrdinaryHasInstance(Node* node) {
1246 return Type::Boolean();
1247 }
1248
1245 // JS context operators. 1249 // JS context operators.
1246 1250
1247 1251
1248 Type* Typer::Visitor::TypeJSLoadContext(Node* node) { 1252 Type* Typer::Visitor::TypeJSLoadContext(Node* node) {
1249 ContextAccess const& access = ContextAccessOf(node->op()); 1253 ContextAccess const& access = ContextAccessOf(node->op());
1250 switch (access.index()) { 1254 switch (access.index()) {
1251 case Context::PREVIOUS_INDEX: 1255 case Context::PREVIOUS_INDEX:
1252 case Context::NATIVE_CONTEXT_INDEX: 1256 case Context::NATIVE_CONTEXT_INDEX:
1253 return Type::OtherInternal(); 1257 return Type::OtherInternal();
1254 case Context::CLOSURE_INDEX: 1258 case Context::CLOSURE_INDEX:
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1395 case kTypedArrayValues: 1399 case kTypedArrayValues:
1396 case kArrayIteratorNext: 1400 case kArrayIteratorNext:
1397 return Type::OtherObject(); 1401 return Type::OtherObject();
1398 1402
1399 // Array functions. 1403 // Array functions.
1400 case kArrayIndexOf: 1404 case kArrayIndexOf:
1401 case kArrayLastIndexOf: 1405 case kArrayLastIndexOf:
1402 return Type::Range(-1, kMaxSafeInteger, t->zone()); 1406 return Type::Range(-1, kMaxSafeInteger, t->zone());
1403 case kArrayPush: 1407 case kArrayPush:
1404 return t->cache_.kPositiveSafeInteger; 1408 return t->cache_.kPositiveSafeInteger;
1409
1405 // Object functions. 1410 // Object functions.
1406 case kObjectHasOwnProperty: 1411 case kObjectHasOwnProperty:
1407 return Type::Boolean(); 1412 return Type::Boolean();
1413
1414 // Function functions.
1415 case kFunctionHasInstance:
1416 return Type::Boolean();
1417
1408 // Global functions. 1418 // Global functions.
1409 case kGlobalDecodeURI: 1419 case kGlobalDecodeURI:
1410 case kGlobalDecodeURIComponent: 1420 case kGlobalDecodeURIComponent:
1411 case kGlobalEncodeURI: 1421 case kGlobalEncodeURI:
1412 case kGlobalEncodeURIComponent: 1422 case kGlobalEncodeURIComponent:
1413 case kGlobalEscape: 1423 case kGlobalEscape:
1414 case kGlobalUnescape: 1424 case kGlobalUnescape:
1415 return Type::String(); 1425 return Type::String();
1416 case kGlobalIsFinite: 1426 case kGlobalIsFinite:
1417 case kGlobalIsNaN: 1427 case kGlobalIsNaN:
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
1751 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { 1761 Type* Typer::Visitor::TypeConstant(Handle<Object> value) {
1752 if (Type::IsInteger(*value)) { 1762 if (Type::IsInteger(*value)) {
1753 return Type::Range(value->Number(), value->Number(), zone()); 1763 return Type::Range(value->Number(), value->Number(), zone());
1754 } 1764 }
1755 return Type::NewConstant(value, zone()); 1765 return Type::NewConstant(value, zone());
1756 } 1766 }
1757 1767
1758 } // namespace compiler 1768 } // namespace compiler
1759 } // namespace internal 1769 } // namespace internal
1760 } // namespace v8 1770 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698