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

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

Issue 1292053002: Rework startup-data-util. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Same as Patch Set 3, but revert the "Test for all platforms" bits. Created 5 years, 4 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 | « tools/gyp/v8.gyp ('k') | 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
50 using namespace v8::internal; 46 using namespace v8::internal;
51 47
52 class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator { 48 class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
53 public: 49 public:
54 virtual void* Allocate(size_t length) { 50 virtual void* Allocate(size_t length) {
55 void* data = AllocateUninitialized(length); 51 void* data = AllocateUninitialized(length);
56 return data == NULL ? data : memset(data, 0, length); 52 return data == NULL ? data : memset(data, 0, length);
57 } 53 }
58 virtual void* AllocateUninitialized(size_t length) { return malloc(length); } 54 virtual void* AllocateUninitialized(size_t length) { return malloc(length); }
59 virtual void Free(void* data, size_t) { free(data); } 55 virtual void Free(void* data, size_t) { free(data); }
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 return std::make_pair(parse_time1, parse_time2); 139 return std::make_pair(parse_time1, parse_time2);
144 } 140 }
145 141
146 142
147 int main(int argc, char* argv[]) { 143 int main(int argc, char* argv[]) {
148 v8::V8::SetFlagsFromCommandLine(&argc, argv, true); 144 v8::V8::SetFlagsFromCommandLine(&argc, argv, true);
149 v8::V8::InitializeICU(); 145 v8::V8::InitializeICU();
150 v8::Platform* platform = v8::platform::CreateDefaultPlatform(); 146 v8::Platform* platform = v8::platform::CreateDefaultPlatform();
151 v8::V8::InitializePlatform(platform); 147 v8::V8::InitializePlatform(platform);
152 v8::V8::Initialize(); 148 v8::V8::Initialize();
153 #ifdef V8_USE_EXTERNAL_STARTUP_DATA 149 v8::V8::InitializeExternalStartupData(argv[0]);
154 v8::StartupDataHandler startup_data(argv[0], NULL, NULL); 150
155 #endif // V8_USE_EXTERNAL_STARTUP_DATA
156 Encoding encoding = LATIN1; 151 Encoding encoding = LATIN1;
157 std::vector<std::string> fnames; 152 std::vector<std::string> fnames;
158 std::string benchmark; 153 std::string benchmark;
159 int repeat = 1; 154 int repeat = 1;
160 for (int i = 0; i < argc; ++i) { 155 for (int i = 0; i < argc; ++i) {
161 if (strcmp(argv[i], "--latin1") == 0) { 156 if (strcmp(argv[i], "--latin1") == 0) {
162 encoding = LATIN1; 157 encoding = LATIN1;
163 } else if (strcmp(argv[i], "--utf8") == 0) { 158 } else if (strcmp(argv[i], "--utf8") == 0) {
164 encoding = UTF8; 159 encoding = UTF8;
165 } else if (strcmp(argv[i], "--utf16") == 0) { 160 } else if (strcmp(argv[i], "--utf16") == 0) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 first_parse_total); 194 first_parse_total);
200 printf("%s(SecondParseRunTime): %.f ms\n", benchmark.c_str(), 195 printf("%s(SecondParseRunTime): %.f ms\n", benchmark.c_str(),
201 second_parse_total); 196 second_parse_total);
202 } 197 }
203 } 198 }
204 v8::V8::Dispose(); 199 v8::V8::Dispose();
205 v8::V8::ShutdownPlatform(); 200 v8::V8::ShutdownPlatform();
206 delete platform; 201 delete platform;
207 return 0; 202 return 0;
208 } 203 }
OLDNEW
« no previous file with comments | « tools/gyp/v8.gyp ('k') | tools/parser-shell.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698