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/machine-operator.h" | 6 #include "src/compiler/machine-operator.h" |
7 | 7 |
8 #include "src/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 | 43 |
44 Node* ChangeLowering::HeapNumberValueIndexConstant() { | 44 Node* ChangeLowering::HeapNumberValueIndexConstant() { |
45 STATIC_ASSERT(HeapNumber::kValueOffset % kPointerSize == 0); | 45 STATIC_ASSERT(HeapNumber::kValueOffset % kPointerSize == 0); |
46 const int heap_number_value_offset = | 46 const int heap_number_value_offset = |
47 ((HeapNumber::kValueOffset / kPointerSize) * (machine()->is64() ? 8 : 4)); | 47 ((HeapNumber::kValueOffset / kPointerSize) * (machine()->is64() ? 8 : 4)); |
48 return jsgraph()->Int32Constant(heap_number_value_offset - kHeapObjectTag); | 48 return jsgraph()->Int32Constant(heap_number_value_offset - kHeapObjectTag); |
49 } | 49 } |
50 | 50 |
51 | 51 |
52 Node* ChangeLowering::SmiMaxValueConstant() { | 52 Node* ChangeLowering::SmiMaxValueConstant() { |
53 // TODO(turbofan): Work-around for weird GCC 4.6 linker issue: | 53 const int smi_value_size = |
54 // src/compiler/change-lowering.cc:46: undefined reference to | 54 machine()->is32() ? static_cast<int>(SmiTagging<4>::kSmiValueSize) |
Jarin
2014/09/01 06:20:21
You might want to define a static method GetSmiVal
rossberg
2014/09/01 09:51:48
+1
| |
55 // `v8::internal::SmiTagging<4u>::kSmiValueSize' | 55 : static_cast<int>(SmiTagging<8>::kSmiValueSize); |
56 // src/compiler/change-lowering.cc:46: undefined reference to | |
57 // `v8::internal::SmiTagging<8u>::kSmiValueSize' | |
58 STATIC_ASSERT(SmiTagging<4>::kSmiValueSize == 31); | |
59 STATIC_ASSERT(SmiTagging<8>::kSmiValueSize == 32); | |
60 const int smi_value_size = machine()->is64() ? 32 : 31; | |
61 return jsgraph()->Int32Constant( | 56 return jsgraph()->Int32Constant( |
62 -(static_cast<int>(0xffffffffu << (smi_value_size - 1)) + 1)); | 57 -(static_cast<int>(0xffffffffu << (smi_value_size - 1)) + 1)); |
63 } | 58 } |
64 | 59 |
65 | 60 |
66 Node* ChangeLowering::SmiShiftBitsConstant() { | 61 Node* ChangeLowering::SmiShiftBitsConstant() { |
67 // TODO(turbofan): Work-around for weird GCC 4.6 linker issue: | 62 const int smi_shift_size = |
68 // src/compiler/change-lowering.cc:46: undefined reference to | 63 machine()->is32() ? static_cast<int>(SmiTagging<4>::kSmiShiftSize) |
69 // `v8::internal::SmiTagging<4u>::kSmiShiftSize' | 64 : static_cast<int>(SmiTagging<8>::kSmiShiftSize); |
70 // src/compiler/change-lowering.cc:46: undefined reference to | |
71 // `v8::internal::SmiTagging<8u>::kSmiShiftSize' | |
72 STATIC_ASSERT(SmiTagging<4>::kSmiShiftSize == 0); | |
73 STATIC_ASSERT(SmiTagging<8>::kSmiShiftSize == 31); | |
74 const int smi_shift_size = machine()->is64() ? 31 : 0; | |
75 return jsgraph()->Int32Constant(smi_shift_size + kSmiTagSize); | 65 return jsgraph()->Int32Constant(smi_shift_size + kSmiTagSize); |
76 } | 66 } |
77 | 67 |
78 | 68 |
79 Node* ChangeLowering::AllocateHeapNumberWithValue(Node* value, Node* control) { | 69 Node* ChangeLowering::AllocateHeapNumberWithValue(Node* value, Node* control) { |
80 // The AllocateHeapNumber() runtime function does not use the context, so we | 70 // The AllocateHeapNumber() runtime function does not use the context, so we |
81 // can safely pass in Smi zero here. | 71 // can safely pass in Smi zero here. |
82 Node* context = jsgraph()->ZeroConstant(); | 72 Node* context = jsgraph()->ZeroConstant(); |
83 Node* effect = graph()->NewNode(common()->ValueEffect(1), value); | 73 Node* effect = graph()->NewNode(common()->ValueEffect(1), value); |
84 const Runtime::Function* function = | 74 const Runtime::Function* function = |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
247 Graph* ChangeLowering::graph() const { return jsgraph()->graph(); } | 237 Graph* ChangeLowering::graph() const { return jsgraph()->graph(); } |
248 | 238 |
249 | 239 |
250 CommonOperatorBuilder* ChangeLowering::common() const { | 240 CommonOperatorBuilder* ChangeLowering::common() const { |
251 return jsgraph()->common(); | 241 return jsgraph()->common(); |
252 } | 242 } |
253 | 243 |
254 } // namespace compiler | 244 } // namespace compiler |
255 } // namespace internal | 245 } // namespace internal |
256 } // namespace v8 | 246 } // namespace v8 |
OLD | NEW |