| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #include "mark-compact.h" | 42 #include "mark-compact.h" |
| 43 #include "natives.h" | 43 #include "natives.h" |
| 44 #include "objects-visiting.h" | 44 #include "objects-visiting.h" |
| 45 #include "objects-visiting-inl.h" | 45 #include "objects-visiting-inl.h" |
| 46 #include "once.h" | 46 #include "once.h" |
| 47 #include "runtime-profiler.h" | 47 #include "runtime-profiler.h" |
| 48 #include "scopeinfo.h" | 48 #include "scopeinfo.h" |
| 49 #include "snapshot.h" | 49 #include "snapshot.h" |
| 50 #include "store-buffer.h" | 50 #include "store-buffer.h" |
| 51 #include "utils/random-number-generator.h" | 51 #include "utils/random-number-generator.h" |
| 52 #include "v8conversions.h" |
| 52 #include "v8threads.h" | 53 #include "v8threads.h" |
| 53 #include "v8utils.h" | 54 #include "v8utils.h" |
| 54 #include "vm-state-inl.h" | 55 #include "vm-state-inl.h" |
| 55 #if V8_TARGET_ARCH_ARM && !V8_INTERPRETED_REGEXP | 56 #if V8_TARGET_ARCH_ARM && !V8_INTERPRETED_REGEXP |
| 56 #include "regexp-macro-assembler.h" | 57 #include "regexp-macro-assembler.h" |
| 57 #include "arm/regexp-macro-assembler-arm.h" | 58 #include "arm/regexp-macro-assembler-arm.h" |
| 58 #endif | 59 #endif |
| 59 #if V8_TARGET_ARCH_MIPS && !V8_INTERPRETED_REGEXP | 60 #if V8_TARGET_ARCH_MIPS && !V8_INTERPRETED_REGEXP |
| 60 #include "regexp-macro-assembler.h" | 61 #include "regexp-macro-assembler.h" |
| 61 #include "mips/regexp-macro-assembler-mips.h" | 62 #include "mips/regexp-macro-assembler-mips.h" |
| (...skipping 3591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3653 case kExternalDoubleArray: | 3654 case kExternalDoubleArray: |
| 3654 return kExternalDoubleArrayMapRootIndex; | 3655 return kExternalDoubleArrayMapRootIndex; |
| 3655 case kExternalPixelArray: | 3656 case kExternalPixelArray: |
| 3656 return kExternalPixelArrayMapRootIndex; | 3657 return kExternalPixelArrayMapRootIndex; |
| 3657 default: | 3658 default: |
| 3658 UNREACHABLE(); | 3659 UNREACHABLE(); |
| 3659 return kUndefinedValueRootIndex; | 3660 return kUndefinedValueRootIndex; |
| 3660 } | 3661 } |
| 3661 } | 3662 } |
| 3662 | 3663 |
| 3664 |
| 3663 Heap::RootListIndex Heap::RootIndexForEmptyExternalArray( | 3665 Heap::RootListIndex Heap::RootIndexForEmptyExternalArray( |
| 3664 ElementsKind elementsKind) { | 3666 ElementsKind elementsKind) { |
| 3665 switch (elementsKind) { | 3667 switch (elementsKind) { |
| 3666 case EXTERNAL_BYTE_ELEMENTS: | 3668 case EXTERNAL_BYTE_ELEMENTS: |
| 3667 return kEmptyExternalByteArrayRootIndex; | 3669 return kEmptyExternalByteArrayRootIndex; |
| 3668 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 3670 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 3669 return kEmptyExternalUnsignedByteArrayRootIndex; | 3671 return kEmptyExternalUnsignedByteArrayRootIndex; |
| 3670 case EXTERNAL_SHORT_ELEMENTS: | 3672 case EXTERNAL_SHORT_ELEMENTS: |
| 3671 return kEmptyExternalShortArrayRootIndex; | 3673 return kEmptyExternalShortArrayRootIndex; |
| 3672 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 3674 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| (...skipping 14 matching lines...) Expand all Loading... |
| 3687 } | 3689 } |
| 3688 } | 3690 } |
| 3689 | 3691 |
| 3690 | 3692 |
| 3691 ExternalArray* Heap::EmptyExternalArrayForMap(Map* map) { | 3693 ExternalArray* Heap::EmptyExternalArrayForMap(Map* map) { |
| 3692 return ExternalArray::cast( | 3694 return ExternalArray::cast( |
| 3693 roots_[RootIndexForEmptyExternalArray(map->elements_kind())]); | 3695 roots_[RootIndexForEmptyExternalArray(map->elements_kind())]); |
| 3694 } | 3696 } |
| 3695 | 3697 |
| 3696 | 3698 |
| 3697 | |
| 3698 | |
| 3699 MaybeObject* Heap::NumberFromDouble(double value, PretenureFlag pretenure) { | 3699 MaybeObject* Heap::NumberFromDouble(double value, PretenureFlag pretenure) { |
| 3700 // We need to distinguish the minus zero value and this cannot be | 3700 // We need to distinguish the minus zero value and this cannot be |
| 3701 // done after conversion to int. Doing this by comparing bit | 3701 // done after conversion to int. Doing this by comparing bit |
| 3702 // patterns is faster than using fpclassify() et al. | 3702 // patterns is faster than using fpclassify() et al. |
| 3703 static const DoubleRepresentation minus_zero(-0.0); | 3703 if (IsMinusZero(value)) { |
| 3704 | |
| 3705 DoubleRepresentation rep(value); | |
| 3706 if (rep.bits == minus_zero.bits) { | |
| 3707 return AllocateHeapNumber(-0.0, pretenure); | 3704 return AllocateHeapNumber(-0.0, pretenure); |
| 3708 } | 3705 } |
| 3709 | 3706 |
| 3710 int int_value = FastD2I(value); | 3707 int int_value = FastD2I(value); |
| 3711 if (value == int_value && Smi::IsValid(int_value)) { | 3708 if (value == int_value && Smi::IsValid(int_value)) { |
| 3712 return Smi::FromInt(int_value); | 3709 return Smi::FromInt(int_value); |
| 3713 } | 3710 } |
| 3714 | 3711 |
| 3715 // Materialize the value in the heap. | 3712 // Materialize the value in the heap. |
| 3716 return AllocateHeapNumber(value, pretenure); | 3713 return AllocateHeapNumber(value, pretenure); |
| (...skipping 4242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7959 static_cast<int>(object_sizes_last_time_[index])); | 7956 static_cast<int>(object_sizes_last_time_[index])); |
| 7960 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) | 7957 CODE_AGE_LIST_COMPLETE(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 7961 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7958 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 7962 | 7959 |
| 7963 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7960 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 7964 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7961 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 7965 ClearObjectStats(); | 7962 ClearObjectStats(); |
| 7966 } | 7963 } |
| 7967 | 7964 |
| 7968 } } // namespace v8::internal | 7965 } } // namespace v8::internal |
| OLD | NEW |