Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1708)

Unified Diff: tools/shell-utils.h

Issue 209353008: Add parser-shell. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebased Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/parser-shell.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « tools/parser-shell.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698