OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 | 9 |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 2534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2545 | 2545 |
2546 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedArray); | 2546 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedArray); |
2547 }; | 2547 }; |
2548 | 2548 |
2549 | 2549 |
2550 // FixedDoubleArray describes fixed-sized arrays with element type double. | 2550 // FixedDoubleArray describes fixed-sized arrays with element type double. |
2551 class FixedDoubleArray: public FixedArrayBase { | 2551 class FixedDoubleArray: public FixedArrayBase { |
2552 public: | 2552 public: |
2553 // Setter and getter for elements. | 2553 // Setter and getter for elements. |
2554 inline double get_scalar(int index); | 2554 inline double get_scalar(int index); |
2555 inline int64_t get_representation(int index); | 2555 inline uint64_t get_representation(int index); |
2556 static inline Handle<Object> get(Handle<FixedDoubleArray> array, int index); | 2556 static inline Handle<Object> get(Handle<FixedDoubleArray> array, int index); |
2557 inline void set(int index, double value); | 2557 inline void set(int index, double value); |
2558 inline void set_the_hole(int index); | 2558 inline void set_the_hole(int index); |
2559 | 2559 |
2560 // Checking for the hole. | 2560 // Checking for the hole. |
2561 inline bool is_the_hole(int index); | 2561 inline bool is_the_hole(int index); |
2562 | 2562 |
2563 // Garbage collection support. | 2563 // Garbage collection support. |
2564 inline static int SizeFor(int length) { | 2564 inline static int SizeFor(int length) { |
2565 return kHeaderSize + length * kDoubleSize; | 2565 return kHeaderSize + length * kDoubleSize; |
2566 } | 2566 } |
2567 | 2567 |
2568 // Gives access to raw memory which stores the array's data. | 2568 // Gives access to raw memory which stores the array's data. |
2569 inline double* data_start(); | 2569 inline double* data_start(); |
2570 | 2570 |
2571 inline void FillWithHoles(int from, int to); | 2571 inline void FillWithHoles(int from, int to); |
2572 | 2572 |
2573 // Code Generation support. | 2573 // Code Generation support. |
2574 static int OffsetOfElementAt(int index) { return SizeFor(index); } | 2574 static int OffsetOfElementAt(int index) { return SizeFor(index); } |
2575 | 2575 |
2576 inline static bool is_the_hole_nan(double value); | |
2577 inline static double hole_nan_as_double(); | |
2578 inline static double canonical_not_the_hole_nan_as_double(); | |
2579 | |
2580 DECLARE_CAST(FixedDoubleArray) | 2576 DECLARE_CAST(FixedDoubleArray) |
2581 | 2577 |
2582 // Maximal allowed size, in bytes, of a single FixedDoubleArray. | 2578 // Maximal allowed size, in bytes, of a single FixedDoubleArray. |
2583 // Prevents overflowing size computations, as well as extreme memory | 2579 // Prevents overflowing size computations, as well as extreme memory |
2584 // consumption. | 2580 // consumption. |
2585 static const int kMaxSize = 512 * MB; | 2581 static const int kMaxSize = 512 * MB; |
2586 // Maximally allowed length of a FixedArray. | 2582 // Maximally allowed length of a FixedArray. |
2587 static const int kMaxLength = (kMaxSize - kHeaderSize) / kDoubleSize; | 2583 static const int kMaxLength = (kMaxSize - kHeaderSize) / kDoubleSize; |
2588 | 2584 |
2589 // Dispatched behavior. | 2585 // Dispatched behavior. |
(...skipping 8324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10914 } else { | 10910 } else { |
10915 value &= ~(1 << bit_position); | 10911 value &= ~(1 << bit_position); |
10916 } | 10912 } |
10917 return value; | 10913 return value; |
10918 } | 10914 } |
10919 }; | 10915 }; |
10920 | 10916 |
10921 } } // namespace v8::internal | 10917 } } // namespace v8::internal |
10922 | 10918 |
10923 #endif // V8_OBJECTS_H_ | 10919 #endif // V8_OBJECTS_H_ |
OLD | NEW |