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/change-lowering.h" | 5 #include "src/compiler/change-lowering.h" |
6 #include "src/compiler/js-graph.h" | 6 #include "src/compiler/js-graph.h" |
7 #include "src/compiler/node-properties-inl.h" | 7 #include "src/compiler/node-properties-inl.h" |
8 #include "src/compiler/simplified-operator.h" | 8 #include "src/compiler/simplified-operator.h" |
9 #include "src/compiler/typer.h" | 9 #include "src/compiler/typer.h" |
10 #include "test/compiler-unittests/graph-unittest.h" | 10 #include "test/compiler-unittests/graph-unittest.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 } | 52 } |
53 UNREACHABLE(); | 53 UNREACHABLE(); |
54 return 0; | 54 return 0; |
55 } | 55 } |
56 int SmiMaxValue() const { return -(SmiMinValue() + 1); } | 56 int SmiMaxValue() const { return -(SmiMinValue() + 1); } |
57 int SmiMinValue() const { | 57 int SmiMinValue() const { |
58 return static_cast<int>(0xffffffffu << (SmiValueSize() - 1)); | 58 return static_cast<int>(0xffffffffu << (SmiValueSize() - 1)); |
59 } | 59 } |
60 int SmiShiftAmount() const { return kSmiTagSize + SmiShiftSize(); } | 60 int SmiShiftAmount() const { return kSmiTagSize + SmiShiftSize(); } |
61 int SmiShiftSize() const { | 61 int SmiShiftSize() const { |
62 // TODO(turbofan): Work-around for weird GCC 4.6 linker issue: | 62 return Is32() ? static_cast<int>(SmiTagging<4>::kSmiShiftSize) |
63 // src/compiler/change-lowering.cc:46: undefined reference to | 63 : static_cast<int>(SmiTagging<8>::kSmiShiftSize); |
64 // `v8::internal::SmiTagging<4u>::kSmiShiftSize' | |
65 // src/compiler/change-lowering.cc:46: undefined reference to | |
66 // `v8::internal::SmiTagging<8u>::kSmiShiftSize' | |
67 STATIC_ASSERT(SmiTagging<4>::kSmiShiftSize == 0); | |
68 STATIC_ASSERT(SmiTagging<8>::kSmiShiftSize == 31); | |
69 return Is32() ? 0 : 31; | |
70 } | 64 } |
71 int SmiValueSize() const { | 65 int SmiValueSize() const { |
72 // TODO(turbofan): Work-around for weird GCC 4.6 linker issue: | 66 return Is32() ? static_cast<int>(SmiTagging<4>::kSmiValueSize) |
73 // src/compiler/change-lowering.cc:46: undefined reference to | 67 : static_cast<int>(SmiTagging<8>::kSmiValueSize); |
74 // `v8::internal::SmiTagging<4u>::kSmiValueSize' | |
75 // src/compiler/change-lowering.cc:46: undefined reference to | |
76 // `v8::internal::SmiTagging<8u>::kSmiValueSize' | |
77 STATIC_ASSERT(SmiTagging<4>::kSmiValueSize == 31); | |
78 STATIC_ASSERT(SmiTagging<8>::kSmiValueSize == 32); | |
79 return Is32() ? 31 : 32; | |
80 } | 68 } |
81 | 69 |
82 Node* Parameter(int32_t index = 0) { | 70 Node* Parameter(int32_t index = 0) { |
83 return graph()->NewNode(common()->Parameter(index), graph()->start()); | 71 return graph()->NewNode(common()->Parameter(index), graph()->start()); |
84 } | 72 } |
85 | 73 |
86 Reduction Reduce(Node* node) { | 74 Reduction Reduce(Node* node) { |
87 Typer typer(zone()); | 75 Typer typer(zone()); |
88 JSGraph jsgraph(graph(), common(), &typer); | 76 JSGraph jsgraph(graph(), common(), &typer); |
89 CompilationInfo info(isolate(), zone()); | 77 CompilationInfo info(isolate(), zone()); |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 IsIfTrue(AllOf(CaptureEq(&branch), | 457 IsIfTrue(AllOf(CaptureEq(&branch), |
470 IsBranch(IsUint32LessThanOrEqual( | 458 IsBranch(IsUint32LessThanOrEqual( |
471 val, IsInt32Constant(SmiMaxValue())), | 459 val, IsInt32Constant(SmiMaxValue())), |
472 graph()->start()))), | 460 graph()->start()))), |
473 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); | 461 AllOf(CaptureEq(&if_false), IsIfFalse(CaptureEq(&branch)))))); |
474 } | 462 } |
475 | 463 |
476 } // namespace compiler | 464 } // namespace compiler |
477 } // namespace internal | 465 } // namespace internal |
478 } // namespace v8 | 466 } // namespace v8 |
OLD | NEW |