OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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-stub-assembler.h" | 5 #include "src/code-stub-assembler.h" |
6 #include "src/code-factory.h" | 6 #include "src/code-factory.h" |
7 #include "src/frames-inl.h" | 7 #include "src/frames-inl.h" |
8 #include "src/frames.h" | 8 #include "src/frames.h" |
9 #include "src/ic/handler-configuration.h" | 9 #include "src/ic/handler-configuration.h" |
10 #include "src/ic/stub-cache.h" | 10 #include "src/ic/stub-cache.h" |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 Bind(&return_x); | 289 Bind(&return_x); |
290 return var_x.value(); | 290 return var_x.value(); |
291 } | 291 } |
292 | 292 |
293 Node* CodeStubAssembler::SmiShiftBitsConstant() { | 293 Node* CodeStubAssembler::SmiShiftBitsConstant() { |
294 return IntPtrConstant(kSmiShiftSize + kSmiTagSize); | 294 return IntPtrConstant(kSmiShiftSize + kSmiTagSize); |
295 } | 295 } |
296 | 296 |
297 Node* CodeStubAssembler::SmiFromWord32(Node* value) { | 297 Node* CodeStubAssembler::SmiFromWord32(Node* value) { |
298 value = ChangeInt32ToIntPtr(value); | 298 value = ChangeInt32ToIntPtr(value); |
299 return WordShl(value, SmiShiftBitsConstant()); | 299 return BitcastWordToTaggedSigned(WordShl(value, SmiShiftBitsConstant())); |
300 } | 300 } |
301 | 301 |
302 Node* CodeStubAssembler::SmiTag(Node* value) { | 302 Node* CodeStubAssembler::SmiTag(Node* value) { |
303 int32_t constant_value; | 303 int32_t constant_value; |
304 if (ToInt32Constant(value, constant_value) && Smi::IsValid(constant_value)) { | 304 if (ToInt32Constant(value, constant_value) && Smi::IsValid(constant_value)) { |
305 return SmiConstant(Smi::FromInt(constant_value)); | 305 return SmiConstant(Smi::FromInt(constant_value)); |
306 } | 306 } |
307 return WordShl(value, SmiShiftBitsConstant()); | 307 return BitcastWordToTaggedSigned(WordShl(value, SmiShiftBitsConstant())); |
308 } | 308 } |
309 | 309 |
310 Node* CodeStubAssembler::SmiUntag(Node* value) { | 310 Node* CodeStubAssembler::SmiUntag(Node* value) { |
311 return WordSar(value, SmiShiftBitsConstant()); | 311 return WordSar(BitcastTaggedToWord(value), SmiShiftBitsConstant()); |
312 } | 312 } |
313 | 313 |
314 Node* CodeStubAssembler::SmiToWord32(Node* value) { | 314 Node* CodeStubAssembler::SmiToWord32(Node* value) { |
315 Node* result = WordSar(value, SmiShiftBitsConstant()); | 315 Node* result = SmiUntag(value); |
316 if (Is64()) { | 316 if (Is64()) { |
317 result = TruncateInt64ToInt32(result); | 317 result = TruncateInt64ToInt32(result); |
318 } | 318 } |
319 return result; | 319 return result; |
320 } | 320 } |
321 | 321 |
322 Node* CodeStubAssembler::SmiToFloat64(Node* value) { | 322 Node* CodeStubAssembler::SmiToFloat64(Node* value) { |
323 return ChangeInt32ToFloat64(SmiToWord32(value)); | 323 return ChangeInt32ToFloat64(SmiToWord32(value)); |
324 } | 324 } |
325 | 325 |
(...skipping 5011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5337 Heap::kTheHoleValueRootIndex); | 5337 Heap::kTheHoleValueRootIndex); |
5338 | 5338 |
5339 // Store the WeakCell in the feedback vector. | 5339 // Store the WeakCell in the feedback vector. |
5340 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, | 5340 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, |
5341 CodeStubAssembler::SMI_PARAMETERS); | 5341 CodeStubAssembler::SMI_PARAMETERS); |
5342 return cell; | 5342 return cell; |
5343 } | 5343 } |
5344 | 5344 |
5345 } // namespace internal | 5345 } // namespace internal |
5346 } // namespace v8 | 5346 } // namespace v8 |
OLD | NEW |