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

Side by Side Diff: tools/parser-shell.cc

Issue 1230173002: Fixes the parser-shell by adding a dependency to StartupDataUtil. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | tools/parser-shell.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 25 matching lines...) Expand all
36 #include "include/libplatform/libplatform.h" 36 #include "include/libplatform/libplatform.h"
37 #include "src/api.h" 37 #include "src/api.h"
38 #include "src/compiler.h" 38 #include "src/compiler.h"
39 #include "src/scanner-character-streams.h" 39 #include "src/scanner-character-streams.h"
40 #include "tools/shell-utils.h" 40 #include "tools/shell-utils.h"
41 #include "src/parser.h" 41 #include "src/parser.h"
42 #include "src/preparse-data-format.h" 42 #include "src/preparse-data-format.h"
43 #include "src/preparse-data.h" 43 #include "src/preparse-data.h"
44 #include "src/preparser.h" 44 #include "src/preparser.h"
45 45
46 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
47 #include "src/startup-data-util.h"
48 #endif // V8_USE_EXTERNAL_STARTUP_DATA
49
46 using namespace v8::internal; 50 using namespace v8::internal;
47 51
48 class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { 52 class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
49 public: 53 public:
50 virtual void* Allocate(size_t length) { 54 virtual void* Allocate(size_t length) {
51 void* data = AllocateUninitialized(length); 55 void* data = AllocateUninitialized(length);
52 return data == NULL ? data : memset(data, 0, length); 56 return data == NULL ? data : memset(data, 0, length);
53 } 57 }
54 virtual void* AllocateUninitialized(size_t length) { return malloc(length); } 58 virtual void* AllocateUninitialized(size_t length) { return malloc(length); }
55 virtual void Free(void* data, size_t) { free(data); } 59 virtual void Free(void* data, size_t) { free(data); }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 return std::make_pair(parse_time1, parse_time2); 143 return std::make_pair(parse_time1, parse_time2);
140 } 144 }
141 145
142 146
143 int main(int argc, char* argv[]) { 147 int main(int argc, char* argv[]) {
144 v8::V8::SetFlagsFromCommandLine(&argc, argv, true); 148 v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
145 v8::V8::InitializeICU(); 149 v8::V8::InitializeICU();
146 v8::Platform* platform = v8::platform::CreateDefaultPlatform(); 150 v8::Platform* platform = v8::platform::CreateDefaultPlatform();
147 v8::V8::InitializePlatform(platform); 151 v8::V8::InitializePlatform(platform);
148 v8::V8::Initialize(); 152 v8::V8::Initialize();
153 #ifdef V8_USE_EXTERNAL_STARTUP_DATA
154 v8::StartupDataHandler startup_data(argv[0], NULL, NULL);
155 #endif // V8_USE_EXTERNAL_STARTUP_DATA
149 Encoding encoding = LATIN1; 156 Encoding encoding = LATIN1;
150 std::vector<std::string> fnames; 157 std::vector<std::string> fnames;
151 std::string benchmark; 158 std::string benchmark;
152 int repeat = 1; 159 int repeat = 1;
153 for (int i = 0; i < argc; ++i) { 160 for (int i = 0; i < argc; ++i) {
154 if (strcmp(argv[i], "--latin1") == 0) { 161 if (strcmp(argv[i], "--latin1") == 0) {
155 encoding = LATIN1; 162 encoding = LATIN1;
156 } else if (strcmp(argv[i], "--utf8") == 0) { 163 } else if (strcmp(argv[i], "--utf8") == 0) {
157 encoding = UTF8; 164 encoding = UTF8;
158 } else if (strcmp(argv[i], "--utf16") == 0) { 165 } else if (strcmp(argv[i], "--utf16") == 0) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 first_parse_total); 199 first_parse_total);
193 printf("%s(SecondParseRunTime): %.f ms\n", benchmark.c_str(), 200 printf("%s(SecondParseRunTime): %.f ms\n", benchmark.c_str(),
194 second_parse_total); 201 second_parse_total);
195 } 202 }
196 } 203 }
197 v8::V8::Dispose(); 204 v8::V8::Dispose();
198 v8::V8::ShutdownPlatform(); 205 v8::V8::ShutdownPlatform();
199 delete platform; 206 delete platform;
200 return 0; 207 return 0;
201 } 208 }
OLDNEW
« no previous file with comments | « no previous file | tools/parser-shell.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698