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

Side by Side Diff: include/v8.h

Issue 750543002: Rip out bzip compression for native sources. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: compressed_size Created 6 years 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 | « build/features.gypi ('k') | samples/process.cc » ('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 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 /** \mainpage V8 API Reference Guide 5 /** \mainpage V8 API Reference Guide
6 * 6 *
7 * V8 is Google's open source JavaScript engine. 7 * V8 is Google's open source JavaScript engine.
8 * 8 *
9 * This set of documents provides reference material generated from the 9 * This set of documents provides reference material generated from the
10 * V8 header file, include/v8.h. 10 * V8 header file, include/v8.h.
(...skipping 5142 matching lines...) Expand 10 before | Expand all | Expand 10 after
5153 void operator delete(void*, size_t); 5153 void operator delete(void*, size_t);
5154 5154
5155 void SetObjectGroupId(internal::Object** object, UniqueId id); 5155 void SetObjectGroupId(internal::Object** object, UniqueId id);
5156 void SetReferenceFromGroup(UniqueId id, internal::Object** object); 5156 void SetReferenceFromGroup(UniqueId id, internal::Object** object);
5157 void SetReference(internal::Object** parent, internal::Object** child); 5157 void SetReference(internal::Object** parent, internal::Object** child);
5158 void CollectAllGarbage(const char* gc_reason); 5158 void CollectAllGarbage(const char* gc_reason);
5159 }; 5159 };
5160 5160
5161 class V8_EXPORT StartupData { 5161 class V8_EXPORT StartupData {
5162 public: 5162 public:
5163 enum CompressionAlgorithm {
5164 kUncompressed,
5165 kBZip2
5166 };
5167
5168 const char* data; 5163 const char* data;
5169 int compressed_size; 5164 int compressed_size; // TODO(yangguo): remove this.
5170 int raw_size; 5165 int raw_size;
5171 }; 5166 };
5172 5167
5173 5168
5174 /** 5169 /**
5175 * A helper class for driving V8 startup data decompression. It is based on
5176 * "CompressedStartupData" API functions from the V8 class. It isn't mandatory
5177 * for an embedder to use this class, instead, API functions can be used
5178 * directly.
5179 *
5180 * For an example of the class usage, see the "shell.cc" sample application.
5181 */
5182 class V8_EXPORT StartupDataDecompressor { // NOLINT
5183 public:
5184 StartupDataDecompressor();
5185 virtual ~StartupDataDecompressor();
5186 int Decompress();
5187
5188 protected:
5189 virtual int DecompressData(char* raw_data,
5190 int* raw_data_size,
5191 const char* compressed_data,
5192 int compressed_data_size) = 0;
5193
5194 private:
5195 char** raw_data;
5196 };
5197
5198
5199 /**
5200 * EntropySource is used as a callback function when v8 needs a source 5170 * EntropySource is used as a callback function when v8 needs a source
5201 * of entropy. 5171 * of entropy.
5202 */ 5172 */
5203 typedef bool (*EntropySource)(unsigned char* buffer, size_t length); 5173 typedef bool (*EntropySource)(unsigned char* buffer, size_t length);
5204 5174
5205 5175
5206 /** 5176 /**
5207 * ReturnAddressLocationResolver is used as a callback function when v8 is 5177 * ReturnAddressLocationResolver is used as a callback function when v8 is
5208 * resolving the location of a return address on the stack. Profilers that 5178 * resolving the location of a return address on the stack. Profilers that
5209 * change the return address on the stack can use this to resolve the stack 5179 * change the return address on the stack can use this to resolve the stack
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
5246 static void SetArrayBufferAllocator(ArrayBuffer::Allocator* allocator); 5216 static void SetArrayBufferAllocator(ArrayBuffer::Allocator* allocator);
5247 5217
5248 /** 5218 /**
5249 * Check if V8 is dead and therefore unusable. This is the case after 5219 * Check if V8 is dead and therefore unusable. This is the case after
5250 * fatal errors such as out-of-memory situations. 5220 * fatal errors such as out-of-memory situations.
5251 */ 5221 */
5252 // TODO(dcarney): deprecate this. 5222 // TODO(dcarney): deprecate this.
5253 V8_INLINE static bool IsDead(); 5223 V8_INLINE static bool IsDead();
5254 5224
5255 /** 5225 /**
5256 * The following 4 functions are to be used when V8 is built with
5257 * the 'compress_startup_data' flag enabled. In this case, the
5258 * embedder must decompress startup data prior to initializing V8.
5259 *
5260 * This is how interaction with V8 should look like:
5261 * int compressed_data_count = v8::V8::GetCompressedStartupDataCount();
5262 * v8::StartupData* compressed_data =
5263 * new v8::StartupData[compressed_data_count];
5264 * v8::V8::GetCompressedStartupData(compressed_data);
5265 * ... decompress data (compressed_data can be updated in-place) ...
5266 * v8::V8::SetDecompressedStartupData(compressed_data);
5267 * ... now V8 can be initialized
5268 * ... make sure the decompressed data stays valid until V8 shutdown
5269 *
5270 * A helper class StartupDataDecompressor is provided. It implements
5271 * the protocol of the interaction described above, and can be used in
5272 * most cases instead of calling these API functions directly.
5273 */
5274 static StartupData::CompressionAlgorithm GetCompressedStartupDataAlgorithm();
5275 static int GetCompressedStartupDataCount();
5276 static void GetCompressedStartupData(StartupData* compressed_data);
5277 static void SetDecompressedStartupData(StartupData* decompressed_data);
5278
5279 /**
5280 * Hand startup data to V8, in case the embedder has chosen to build 5226 * Hand startup data to V8, in case the embedder has chosen to build
5281 * V8 with external startup data. 5227 * V8 with external startup data.
5282 * 5228 *
5283 * Note: 5229 * Note:
5284 * - By default the startup data is linked into the V8 library, in which 5230 * - By default the startup data is linked into the V8 library, in which
5285 * case this function is not meaningful. 5231 * case this function is not meaningful.
5286 * - If this needs to be called, it needs to be called before V8 5232 * - If this needs to be called, it needs to be called before V8
5287 * tries to make use of its built-ins. 5233 * tries to make use of its built-ins.
5288 * - To avoid unnecessary copies of data, V8 will point directly into the 5234 * - To avoid unnecessary copies of data, V8 will point directly into the
5289 * given data blob, so pretty please keep it around until V8 exit. 5235 * given data blob, so pretty please keep it around until V8 exit.
(...skipping 2142 matching lines...) Expand 10 before | Expand all | Expand 10 after
7432 */ 7378 */
7433 7379
7434 7380
7435 } // namespace v8 7381 } // namespace v8
7436 7382
7437 7383
7438 #undef TYPE_CHECK 7384 #undef TYPE_CHECK
7439 7385
7440 7386
7441 #endif // V8_H_ 7387 #endif // V8_H_
OLDNEW
« no previous file with comments | « build/features.gypi ('k') | samples/process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698