| 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 #ifndef V8_FACTORY_H_ | 5 #ifndef V8_FACTORY_H_ |
| 6 #define V8_FACTORY_H_ | 6 #define V8_FACTORY_H_ |
| 7 | 7 |
| 8 #include "src/isolate.h" | 8 #include "src/isolate.h" |
| 9 #include "src/messages.h" | 9 #include "src/messages.h" |
| 10 #include "src/type-feedback-vector.h" | 10 #include "src/type-feedback-vector.h" |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 Handle<Object> NewNumberFromSize(size_t value, | 373 Handle<Object> NewNumberFromSize(size_t value, |
| 374 PretenureFlag pretenure = NOT_TENURED) { | 374 PretenureFlag pretenure = NOT_TENURED) { |
| 375 // We can't use Smi::IsValid() here because that operates on a signed | 375 // We can't use Smi::IsValid() here because that operates on a signed |
| 376 // intptr_t, and casting from size_t could create a bogus sign bit. | 376 // intptr_t, and casting from size_t could create a bogus sign bit. |
| 377 if (value <= static_cast<size_t>(Smi::kMaxValue)) { | 377 if (value <= static_cast<size_t>(Smi::kMaxValue)) { |
| 378 return Handle<Object>(Smi::FromIntptr(static_cast<intptr_t>(value)), | 378 return Handle<Object>(Smi::FromIntptr(static_cast<intptr_t>(value)), |
| 379 isolate()); | 379 isolate()); |
| 380 } | 380 } |
| 381 return NewNumber(static_cast<double>(value), pretenure); | 381 return NewNumber(static_cast<double>(value), pretenure); |
| 382 } | 382 } |
| 383 Handle<Object> NewNumberFromInt64(int64_t value, | |
| 384 PretenureFlag pretenure = NOT_TENURED) { | |
| 385 if (value <= std::numeric_limits<int32_t>::max() && | |
| 386 value >= std::numeric_limits<int32_t>::min() && | |
| 387 Smi::IsValid(static_cast<int32_t>(value))) { | |
| 388 return Handle<Object>(Smi::FromInt(static_cast<int32_t>(value)), | |
| 389 isolate()); | |
| 390 } | |
| 391 return NewNumber(static_cast<double>(value), pretenure); | |
| 392 } | |
| 393 Handle<HeapNumber> NewHeapNumber(double value, | 383 Handle<HeapNumber> NewHeapNumber(double value, |
| 394 MutableMode mode = IMMUTABLE, | 384 MutableMode mode = IMMUTABLE, |
| 395 PretenureFlag pretenure = NOT_TENURED); | 385 PretenureFlag pretenure = NOT_TENURED); |
| 396 | 386 |
| 397 #define SIMD128_NEW_DECL(TYPE, Type, type, lane_count, lane_type) \ | 387 #define SIMD128_NEW_DECL(TYPE, Type, type, lane_count, lane_type) \ |
| 398 Handle<Type> New##Type(lane_type lanes[lane_count], \ | 388 Handle<Type> New##Type(lane_type lanes[lane_count], \ |
| 399 PretenureFlag pretenure = NOT_TENURED); | 389 PretenureFlag pretenure = NOT_TENURED); |
| 400 SIMD128_TYPES(SIMD128_NEW_DECL) | 390 SIMD128_TYPES(SIMD128_NEW_DECL) |
| 401 #undef SIMD128_NEW_DECL | 391 #undef SIMD128_NEW_DECL |
| 402 | 392 |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 750 FunctionMode function_mode); | 740 FunctionMode function_mode); |
| 751 | 741 |
| 752 void SetStrictFunctionInstanceDescriptor(Handle<Map> map, | 742 void SetStrictFunctionInstanceDescriptor(Handle<Map> map, |
| 753 FunctionMode function_mode); | 743 FunctionMode function_mode); |
| 754 }; | 744 }; |
| 755 | 745 |
| 756 } // namespace internal | 746 } // namespace internal |
| 757 } // namespace v8 | 747 } // namespace v8 |
| 758 | 748 |
| 759 #endif // V8_FACTORY_H_ | 749 #endif // V8_FACTORY_H_ |
| OLD | NEW |