| 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/code-factory.h" | 5 #include "src/code-factory.h" | 
| 6 #include "src/compiler/access-builder.h" | 6 #include "src/compiler/access-builder.h" | 
| 7 #include "src/compiler/js-graph.h" | 7 #include "src/compiler/js-graph.h" | 
| 8 #include "src/compiler/js-typed-lowering.h" | 8 #include "src/compiler/js-typed-lowering.h" | 
| 9 #include "src/compiler/linkage.h" | 9 #include "src/compiler/linkage.h" | 
| 10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" | 
| (...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 790   Handle<Object> constant_value = factory()->GlobalConstantFor(name); | 790   Handle<Object> constant_value = factory()->GlobalConstantFor(name); | 
| 791   if (!constant_value.is_null()) { | 791   if (!constant_value.is_null()) { | 
| 792     Node* constant = jsgraph()->Constant(constant_value); | 792     Node* constant = jsgraph()->Constant(constant_value); | 
| 793     ReplaceWithValue(node, constant); | 793     ReplaceWithValue(node, constant); | 
| 794     return Replace(constant); | 794     return Replace(constant); | 
| 795   } | 795   } | 
| 796   return NoChange(); | 796   return NoChange(); | 
| 797 } | 797 } | 
| 798 | 798 | 
| 799 | 799 | 
|  | 800 Reduction JSTypedLowering::ReduceJSLoadNamed(Node* node) { | 
|  | 801   DCHECK_EQ(IrOpcode::kJSLoadNamed, node->opcode()); | 
|  | 802   Node* receiver = NodeProperties::GetValueInput(node, 0); | 
|  | 803   Type* receiver_type = NodeProperties::GetBounds(receiver).upper; | 
|  | 804   Node* effect = NodeProperties::GetEffectInput(node); | 
|  | 805   Node* control = NodeProperties::GetControlInput(node); | 
|  | 806   Handle<Name> name = LoadNamedParametersOf(node->op()).name().handle(); | 
|  | 807   // Optimize "length" property of strings. | 
|  | 808   if (name.is_identical_to(factory()->length_string()) && | 
|  | 809       receiver_type->Is(Type::String())) { | 
|  | 810     Node* value = effect = | 
|  | 811         graph()->NewNode(simplified()->LoadField( | 
|  | 812                              AccessBuilder::ForStringLength(graph()->zone())), | 
|  | 813                          receiver, effect, control); | 
|  | 814     ReplaceWithValue(node, value, effect); | 
|  | 815     return Replace(value); | 
|  | 816   } | 
|  | 817   return NoChange(); | 
|  | 818 } | 
|  | 819 | 
|  | 820 | 
| 800 Reduction JSTypedLowering::ReduceJSLoadProperty(Node* node) { | 821 Reduction JSTypedLowering::ReduceJSLoadProperty(Node* node) { | 
| 801   Node* key = NodeProperties::GetValueInput(node, 1); | 822   Node* key = NodeProperties::GetValueInput(node, 1); | 
| 802   Node* base = NodeProperties::GetValueInput(node, 0); | 823   Node* base = NodeProperties::GetValueInput(node, 0); | 
| 803   Type* key_type = NodeProperties::GetBounds(key).upper; | 824   Type* key_type = NodeProperties::GetBounds(key).upper; | 
| 804   HeapObjectMatcher mbase(base); | 825   HeapObjectMatcher mbase(base); | 
| 805   if (mbase.HasValue() && mbase.Value().handle()->IsJSTypedArray()) { | 826   if (mbase.HasValue() && mbase.Value().handle()->IsJSTypedArray()) { | 
| 806     Handle<JSTypedArray> const array = | 827     Handle<JSTypedArray> const array = | 
| 807         Handle<JSTypedArray>::cast(mbase.Value().handle()); | 828         Handle<JSTypedArray>::cast(mbase.Value().handle()); | 
| 808     if (!array->GetBuffer()->was_neutered()) { | 829     if (!array->GetBuffer()->was_neutered()) { | 
| 809       array->GetBuffer()->set_is_neuterable(false); | 830       array->GetBuffer()->set_is_neuterable(false); | 
| (...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1614     case IrOpcode::kJSUnaryNot: | 1635     case IrOpcode::kJSUnaryNot: | 
| 1615       return ReduceJSUnaryNot(node); | 1636       return ReduceJSUnaryNot(node); | 
| 1616     case IrOpcode::kJSToBoolean: | 1637     case IrOpcode::kJSToBoolean: | 
| 1617       return ReduceJSToBoolean(node); | 1638       return ReduceJSToBoolean(node); | 
| 1618     case IrOpcode::kJSToNumber: | 1639     case IrOpcode::kJSToNumber: | 
| 1619       return ReduceJSToNumber(node); | 1640       return ReduceJSToNumber(node); | 
| 1620     case IrOpcode::kJSToString: | 1641     case IrOpcode::kJSToString: | 
| 1621       return ReduceJSToString(node); | 1642       return ReduceJSToString(node); | 
| 1622     case IrOpcode::kJSLoadGlobal: | 1643     case IrOpcode::kJSLoadGlobal: | 
| 1623       return ReduceJSLoadGlobal(node); | 1644       return ReduceJSLoadGlobal(node); | 
|  | 1645     case IrOpcode::kJSLoadNamed: | 
|  | 1646       return ReduceJSLoadNamed(node); | 
| 1624     case IrOpcode::kJSLoadProperty: | 1647     case IrOpcode::kJSLoadProperty: | 
| 1625       return ReduceJSLoadProperty(node); | 1648       return ReduceJSLoadProperty(node); | 
| 1626     case IrOpcode::kJSStoreProperty: | 1649     case IrOpcode::kJSStoreProperty: | 
| 1627       return ReduceJSStoreProperty(node); | 1650       return ReduceJSStoreProperty(node); | 
| 1628     case IrOpcode::kJSLoadContext: | 1651     case IrOpcode::kJSLoadContext: | 
| 1629       return ReduceJSLoadContext(node); | 1652       return ReduceJSLoadContext(node); | 
| 1630     case IrOpcode::kJSStoreContext: | 1653     case IrOpcode::kJSStoreContext: | 
| 1631       return ReduceJSStoreContext(node); | 1654       return ReduceJSStoreContext(node); | 
| 1632     case IrOpcode::kJSLoadDynamicGlobal: | 1655     case IrOpcode::kJSLoadDynamicGlobal: | 
| 1633       return ReduceJSLoadDynamicGlobal(node); | 1656       return ReduceJSLoadDynamicGlobal(node); | 
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1686 } | 1709 } | 
| 1687 | 1710 | 
| 1688 | 1711 | 
| 1689 MachineOperatorBuilder* JSTypedLowering::machine() const { | 1712 MachineOperatorBuilder* JSTypedLowering::machine() const { | 
| 1690   return jsgraph()->machine(); | 1713   return jsgraph()->machine(); | 
| 1691 } | 1714 } | 
| 1692 | 1715 | 
| 1693 }  // namespace compiler | 1716 }  // namespace compiler | 
| 1694 }  // namespace internal | 1717 }  // namespace internal | 
| 1695 }  // namespace v8 | 1718 }  // namespace v8 | 
| OLD | NEW | 
|---|