| Index: tools/shell-utils.h
|
| diff --git a/src/property-details-inl.h b/tools/shell-utils.h
|
| similarity index 71%
|
| copy from src/property-details-inl.h
|
| copy to tools/shell-utils.h
|
| index 98eb1cf58e606c6d755210c91f18c21e51a8bfaa..ac61fb6bac137a11b051607b90f63f73a0c22981 100644
|
| --- a/src/property-details-inl.h
|
| +++ b/tools/shell-utils.h
|
| @@ -25,27 +25,43 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -#ifndef V8_PROPERTY_DETAILS_INL_H_
|
| -#define V8_PROPERTY_DETAILS_INL_H_
|
| +// Utility functions used by parser-shell and lexer-shell.
|
|
|
| -#include "objects.h"
|
| -#include "property-details.h"
|
| -#include "v8conversions.h"
|
| +#include <stdio.h>
|
|
|
| namespace v8 {
|
| namespace internal {
|
|
|
| -inline bool Representation::CanContainDouble(double value) {
|
| - if (IsDouble() || is_more_general_than(Representation::Double())) {
|
| - return true;
|
| +enum Encoding {
|
| + LATIN1,
|
| + UTF8,
|
| + UTF16
|
| +};
|
| +
|
| +const byte* ReadFileAndRepeat(const char* name, int* size, int repeat) {
|
| + FILE* file = fopen(name, "rb");
|
| + *size = 0;
|
| + if (file == NULL) return NULL;
|
| +
|
| + fseek(file, 0, SEEK_END);
|
| + int file_size = ftell(file);
|
| + rewind(file);
|
| +
|
| + *size = file_size * repeat;
|
| +
|
| + byte* chars = new byte[*size + 1];
|
| + for (int i = 0; i < file_size;) {
|
| + int read = static_cast<int>(fread(&chars[i], 1, file_size - i, file));
|
| + i += read;
|
| }
|
| - if (IsInt32Double(value)) {
|
| - if (IsInteger32()) return true;
|
| - if (IsSmi()) return Smi::IsValid(static_cast<int32_t>(value));
|
| + fclose(file);
|
| +
|
| + for (int i = file_size; i < *size; i++) {
|
| + chars[i] = chars[i - file_size];
|
| }
|
| - return false;
|
| + chars[*size] = 0;
|
| +
|
| + return chars;
|
| }
|
|
|
| } } // namespace v8::internal
|
| -
|
| -#endif // V8_PROPERTY_DETAILS_INL_H_
|
|
|