| 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 = machine()->is32() ? SmiTagging<4>::SmiValueSize() |
| 54 // src/compiler/change-lowering.cc:46: undefined reference to | 54 : SmiTagging<8>::SmiValueSize(); |
| 55 // `v8::internal::SmiTagging<4u>::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( | 55 return jsgraph()->Int32Constant( |
| 62 -(static_cast<int>(0xffffffffu << (smi_value_size - 1)) + 1)); | 56 -(static_cast<int>(0xffffffffu << (smi_value_size - 1)) + 1)); |
| 63 } | 57 } |
| 64 | 58 |
| 65 | 59 |
| 66 Node* ChangeLowering::SmiShiftBitsConstant() { | 60 Node* ChangeLowering::SmiShiftBitsConstant() { |
| 67 // TODO(turbofan): Work-around for weird GCC 4.6 linker issue: | 61 const int smi_shift_size = machine()->is32() ? SmiTagging<4>::SmiShiftSize() |
| 68 // src/compiler/change-lowering.cc:46: undefined reference to | 62 : SmiTagging<8>::SmiShiftSize(); |
| 69 // `v8::internal::SmiTagging<4u>::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); | 63 return jsgraph()->Int32Constant(smi_shift_size + kSmiTagSize); |
| 76 } | 64 } |
| 77 | 65 |
| 78 | 66 |
| 79 Node* ChangeLowering::AllocateHeapNumberWithValue(Node* value, Node* control) { | 67 Node* ChangeLowering::AllocateHeapNumberWithValue(Node* value, Node* control) { |
| 80 // The AllocateHeapNumber() runtime function does not use the context, so we | 68 // The AllocateHeapNumber() runtime function does not use the context, so we |
| 81 // can safely pass in Smi zero here. | 69 // can safely pass in Smi zero here. |
| 82 Node* context = jsgraph()->ZeroConstant(); | 70 Node* context = jsgraph()->ZeroConstant(); |
| 83 Node* effect = graph()->NewNode(common()->ValueEffect(1), value); | 71 Node* effect = graph()->NewNode(common()->ValueEffect(1), value); |
| 84 const Runtime::Function* function = | 72 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(); } | 235 Graph* ChangeLowering::graph() const { return jsgraph()->graph(); } |
| 248 | 236 |
| 249 | 237 |
| 250 CommonOperatorBuilder* ChangeLowering::common() const { | 238 CommonOperatorBuilder* ChangeLowering::common() const { |
| 251 return jsgraph()->common(); | 239 return jsgraph()->common(); |
| 252 } | 240 } |
| 253 | 241 |
| 254 } // namespace compiler | 242 } // namespace compiler |
| 255 } // namespace internal | 243 } // namespace internal |
| 256 } // namespace v8 | 244 } // namespace v8 |
| OLD | NEW |