| 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 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 // The return value may be a smi or a heap number. | 336 // The return value may be a smi or a heap number. |
| 337 Handle<Object> NewNumber(double value, | 337 Handle<Object> NewNumber(double value, |
| 338 PretenureFlag pretenure = NOT_TENURED); | 338 PretenureFlag pretenure = NOT_TENURED); |
| 339 | 339 |
| 340 Handle<Object> NewNumberFromInt(int32_t value, | 340 Handle<Object> NewNumberFromInt(int32_t value, |
| 341 PretenureFlag pretenure = NOT_TENURED); | 341 PretenureFlag pretenure = NOT_TENURED); |
| 342 Handle<Object> NewNumberFromUint(uint32_t value, | 342 Handle<Object> NewNumberFromUint(uint32_t value, |
| 343 PretenureFlag pretenure = NOT_TENURED); | 343 PretenureFlag pretenure = NOT_TENURED); |
| 344 Handle<Object> NewNumberFromSize(size_t value, | 344 Handle<Object> NewNumberFromSize(size_t value, |
| 345 PretenureFlag pretenure = NOT_TENURED) { | 345 PretenureFlag pretenure = NOT_TENURED) { |
| 346 if (Smi::IsValid(static_cast<intptr_t>(value))) { | 346 // We can't use Smi::IsValid() here because that operates on a signed |
| 347 // intptr_t, and casting from size_t could create a bogus sign bit. |
| 348 if (value <= static_cast<size_t>(Smi::kMaxValue)) { |
| 347 return Handle<Object>(Smi::FromIntptr(static_cast<intptr_t>(value)), | 349 return Handle<Object>(Smi::FromIntptr(static_cast<intptr_t>(value)), |
| 348 isolate()); | 350 isolate()); |
| 349 } | 351 } |
| 350 return NewNumber(static_cast<double>(value), pretenure); | 352 return NewNumber(static_cast<double>(value), pretenure); |
| 351 } | 353 } |
| 352 Handle<HeapNumber> NewHeapNumber(double value, | 354 Handle<HeapNumber> NewHeapNumber(double value, |
| 353 MutableMode mode = IMMUTABLE, | 355 MutableMode mode = IMMUTABLE, |
| 354 PretenureFlag pretenure = NOT_TENURED); | 356 PretenureFlag pretenure = NOT_TENURED); |
| 355 | 357 |
| 356 #define SIMD128_NEW_DECL(TYPE, Type, type, lane_count, lane_type) \ | 358 #define SIMD128_NEW_DECL(TYPE, Type, type, lane_count, lane_type) \ |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 Handle<JSFunction> NewFunction(Handle<Map> map, | 703 Handle<JSFunction> NewFunction(Handle<Map> map, |
| 702 Handle<SharedFunctionInfo> info, | 704 Handle<SharedFunctionInfo> info, |
| 703 Handle<Context> context, | 705 Handle<Context> context, |
| 704 PretenureFlag pretenure = TENURED); | 706 PretenureFlag pretenure = TENURED); |
| 705 }; | 707 }; |
| 706 | 708 |
| 707 } // namespace internal | 709 } // namespace internal |
| 708 } // namespace v8 | 710 } // namespace v8 |
| 709 | 711 |
| 710 #endif // V8_FACTORY_H_ | 712 #endif // V8_FACTORY_H_ |
| OLD | NEW |