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/graph-inl.h" | 5 #include "src/compiler/graph-inl.h" |
6 #include "src/compiler/js-operator.h" | 6 #include "src/compiler/js-operator.h" |
7 #include "src/compiler/node.h" | 7 #include "src/compiler/node.h" |
8 #include "src/compiler/node-properties-inl.h" | 8 #include "src/compiler/node-properties-inl.h" |
9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
10 #include "src/compiler/simplified-operator.h" | 10 #include "src/compiler/simplified-operator.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 Type* object = Type::Object(); | 45 Type* object = Type::Object(); |
46 Type* undefined = Type::Undefined(); | 46 Type* undefined = Type::Undefined(); |
47 Type* weakint = Type::Union( | 47 Type* weakint = Type::Union( |
48 integer, Type::Union(Type::NaN(), Type::MinusZero(), zone), zone); | 48 integer, Type::Union(Type::NaN(), Type::MinusZero(), zone), zone); |
49 | 49 |
50 number_fun0_ = Type::Function(number, zone); | 50 number_fun0_ = Type::Function(number, zone); |
51 number_fun1_ = Type::Function(number, number, zone); | 51 number_fun1_ = Type::Function(number, number, zone); |
52 number_fun2_ = Type::Function(number, number, number, zone); | 52 number_fun2_ = Type::Function(number, number, number, zone); |
53 weakint_fun1_ = Type::Function(weakint, number, zone); | 53 weakint_fun1_ = Type::Function(weakint, number, zone); |
54 imul_fun_ = Type::Function(signed32, integral32, integral32, zone); | 54 imul_fun_ = Type::Function(signed32, integral32, integral32, zone); |
55 clz32_fun_ = Type::Function( | |
56 Type::Range(zero, f->NewNumber(32), zone), number, zone); | |
55 random_fun_ = Type::Function(Type::Union( | 57 random_fun_ = Type::Function(Type::Union( |
56 Type::UnsignedSmall(), Type::OtherNumber(), zone), zone); | 58 Type::UnsignedSmall(), Type::OtherNumber(), zone), zone); |
57 | 59 |
58 Type* int8 = Type::Intersect( | 60 Type* int8 = Type::Intersect( |
59 Type::Range(f->NewNumber(-0x7F), f->NewNumber(0x7F-1), zone), | 61 Type::Range(f->NewNumber(-0x7F), f->NewNumber(0x7F-1), zone), |
60 Type::UntaggedInt8(), zone); | 62 Type::UntaggedInt8(), zone); |
61 Type* int16 = Type::Intersect( | 63 Type* int16 = Type::Intersect( |
62 Type::Range(f->NewNumber(-0x7FFF), f->NewNumber(0x7FFF-1), zone), | 64 Type::Range(f->NewNumber(-0x7FFF), f->NewNumber(0x7FFF-1), zone), |
63 Type::UntaggedInt16(), zone); | 65 Type::UntaggedInt16(), zone); |
64 Type* uint8 = Type::Intersect( | 66 Type* uint8 = Type::Intersect( |
(...skipping 1462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1527 } | 1529 } |
1528 | 1530 |
1529 | 1531 |
1530 // Heap constants. | 1532 // Heap constants. |
1531 | 1533 |
1532 | 1534 |
1533 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { | 1535 Type* Typer::Visitor::TypeConstant(Handle<Object> value) { |
1534 if (value->IsJSFunction()) { | 1536 if (value->IsJSFunction()) { |
1535 if (JSFunction::cast(*value)->shared()->HasBuiltinFunctionId()) { | 1537 if (JSFunction::cast(*value)->shared()->HasBuiltinFunctionId()) { |
1536 switch (JSFunction::cast(*value)->shared()->builtin_function_id()) { | 1538 switch (JSFunction::cast(*value)->shared()->builtin_function_id()) { |
1537 // TODO(rossberg): can't express overloading | 1539 // TODO(rossberg): can't express overloading |
rossberg
2014/10/15 12:32:08
This comment should stay with MathAbs
| |
1540 case kMathRandom: | |
1541 return typer_->random_fun_; | |
1542 case kMathFloor: | |
1543 return typer_->weakint_fun1_; | |
1544 case kMathRound: | |
1545 return typer_->weakint_fun1_; | |
1546 case kMathCeil: | |
1547 return typer_->weakint_fun1_; | |
1538 case kMathAbs: | 1548 case kMathAbs: |
1539 return typer_->number_fun1_; | 1549 return typer_->number_fun1_; |
1550 case kMathLog: | |
1551 return typer_->number_fun1_; | |
1552 case kMathExp: | |
1553 return typer_->number_fun1_; | |
1554 case kMathSqrt: | |
1555 return typer_->number_fun1_; | |
1556 case kMathPow: | |
1557 return typer_->number_fun2_; | |
1558 case kMathMax: | |
1559 return typer_->number_fun2_; | |
1560 case kMathMin: | |
1561 return typer_->number_fun2_; | |
1562 case kMathCos: | |
1563 return typer_->number_fun1_; | |
1564 case kMathSin: | |
1565 return typer_->number_fun1_; | |
1566 case kMathTan: | |
1567 return typer_->number_fun1_; | |
1540 case kMathAcos: | 1568 case kMathAcos: |
1541 return typer_->number_fun1_; | 1569 return typer_->number_fun1_; |
1542 case kMathAsin: | 1570 case kMathAsin: |
1543 return typer_->number_fun1_; | 1571 return typer_->number_fun1_; |
1544 case kMathAtan: | 1572 case kMathAtan: |
1545 return typer_->number_fun1_; | 1573 return typer_->number_fun1_; |
1546 case kMathAtan2: | 1574 case kMathAtan2: |
1547 return typer_->number_fun2_; | 1575 return typer_->number_fun2_; |
1548 case kMathCeil: | |
1549 return typer_->weakint_fun1_; | |
1550 case kMathCos: | |
1551 return typer_->number_fun1_; | |
1552 case kMathExp: | |
1553 return typer_->number_fun1_; | |
1554 case kMathFloor: | |
1555 return typer_->weakint_fun1_; | |
1556 case kMathImul: | 1576 case kMathImul: |
1557 return typer_->imul_fun_; | 1577 return typer_->imul_fun_; |
1558 case kMathLog: | 1578 case kMathClz32: |
1559 return typer_->number_fun1_; | 1579 return typer_->clz32_fun_; |
1560 case kMathPow: | 1580 case kMathFround: |
1561 return typer_->number_fun2_; | |
1562 case kMathRandom: | |
1563 return typer_->random_fun_; | |
1564 case kMathRound: | |
1565 return typer_->weakint_fun1_; | |
1566 case kMathSin: | |
1567 return typer_->number_fun1_; | |
1568 case kMathSqrt: | |
1569 return typer_->number_fun1_; | |
1570 case kMathTan: | |
1571 return typer_->number_fun1_; | 1581 return typer_->number_fun1_; |
1572 default: | 1582 default: |
1573 break; | 1583 break; |
1574 } | 1584 } |
1575 } else if (JSFunction::cast(*value)->IsBuiltin() && !context().is_null()) { | 1585 } else if (JSFunction::cast(*value)->IsBuiltin() && !context().is_null()) { |
1576 Handle<Context> native = | 1586 Handle<Context> native = |
1577 handle(context().ToHandleChecked()->native_context(), isolate()); | 1587 handle(context().ToHandleChecked()->native_context(), isolate()); |
1578 if (*value == native->array_buffer_fun()) { | 1588 if (*value == native->array_buffer_fun()) { |
1579 return typer_->array_buffer_fun_; | 1589 return typer_->array_buffer_fun_; |
1580 } else if (*value == native->int8_array_fun()) { | 1590 } else if (*value == native->int8_array_fun()) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1614 } | 1624 } |
1615 | 1625 |
1616 | 1626 |
1617 void Typer::DecorateGraph(Graph* graph) { | 1627 void Typer::DecorateGraph(Graph* graph) { |
1618 graph->AddDecorator(new (zone()) TyperDecorator(this)); | 1628 graph->AddDecorator(new (zone()) TyperDecorator(this)); |
1619 } | 1629 } |
1620 | 1630 |
1621 } | 1631 } |
1622 } | 1632 } |
1623 } // namespace v8::internal::compiler | 1633 } // namespace v8::internal::compiler |
OLD | NEW |