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

Side by Side Diff: runtime/include/dart_api.h

Issue 3003583002: [VM, Precompiler] PoC Obfuscator (Closed)
Patch Set: address comments and fix stuff Created 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 * Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 * for details. All rights reserved. Use of this source code is governed by a 3 * for details. All rights reserved. Use of this source code is governed by a
4 * BSD-style license that can be found in the LICENSE file. 4 * BSD-style license that can be found in the LICENSE file.
5 */ 5 */
6 6
7 #ifndef RUNTIME_INCLUDE_DART_API_H_ 7 #ifndef RUNTIME_INCLUDE_DART_API_H_
8 #define RUNTIME_INCLUDE_DART_API_H_ 8 #define RUNTIME_INCLUDE_DART_API_H_
9 9
10 /** \mainpage Dart Embedding API Reference 10 /** \mainpage Dart Embedding API Reference
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 568
569 /** 569 /**
570 * Gets the version string for the Dart VM. 570 * Gets the version string for the Dart VM.
571 * 571 *
572 * The version of the Dart VM can be accessed without initializing the VM. 572 * The version of the Dart VM can be accessed without initializing the VM.
573 * 573 *
574 * \return The version string for the embedded Dart VM. 574 * \return The version string for the embedded Dart VM.
575 */ 575 */
576 DART_EXPORT const char* Dart_VersionString(); 576 DART_EXPORT const char* Dart_VersionString();
577 577
578 typedef struct {
579 const char* library_uri;
580 const char* class_name;
581 const char* function_name;
582 } Dart_QualifiedFunctionName;
583
578 /** 584 /**
579 * Isolate specific flags are set when creating a new isolate using the 585 * Isolate specific flags are set when creating a new isolate using the
580 * Dart_IsolateFlags structure. 586 * Dart_IsolateFlags structure.
581 * 587 *
582 * Current version of flags is encoded in a 32-bit integer with 16 bits used 588 * Current version of flags is encoded in a 32-bit integer with 16 bits used
583 * for each part. 589 * for each part.
584 */ 590 */
585 591
586 #define DART_FLAGS_CURRENT_VERSION (0x00000003) 592 #define DART_FLAGS_CURRENT_VERSION (0x00000004)
587 593
588 typedef struct { 594 typedef struct {
589 int32_t version; 595 int32_t version;
590 bool enable_type_checks; 596 bool enable_type_checks;
591 bool enable_asserts; 597 bool enable_asserts;
592 bool enable_error_on_bad_type; 598 bool enable_error_on_bad_type;
593 bool enable_error_on_bad_override; 599 bool enable_error_on_bad_override;
594 bool use_field_guards; 600 bool use_field_guards;
595 bool use_osr; 601 bool use_osr;
596 bool use_dart_frontend; 602 bool use_dart_frontend;
603 bool obfuscate;
604 Dart_QualifiedFunctionName* entry_points;
597 } Dart_IsolateFlags; 605 } Dart_IsolateFlags;
598 606
607 DART_EXPORT void Dart_IsolateFlagsInitialize(Dart_IsolateFlags* flags);
608
599 /** 609 /**
600 * An isolate creation and initialization callback function. 610 * An isolate creation and initialization callback function.
601 * 611 *
602 * This callback, provided by the embedder, is called when the vm 612 * This callback, provided by the embedder, is called when the vm
603 * needs to create an isolate. The callback should create an isolate 613 * needs to create an isolate. The callback should create an isolate
604 * by calling Dart_CreateIsolate and load any scripts required for 614 * by calling Dart_CreateIsolate and load any scripts required for
605 * execution. 615 * execution.
606 * 616 *
607 * When the function returns false, it is the responsibility of this 617 * When the function returns false, it is the responsibility of this
608 * function to ensure that Dart_ShutdownIsolate has been called if 618 * function to ensure that Dart_ShutdownIsolate has been called if
(...skipping 2576 matching lines...) Expand 10 before | Expand all | Expand 10 after
3185 * - are running the same Dart program 3195 * - are running the same Dart program
3186 * - are built from the same version of the VM 3196 * - are built from the same version of the VM
3187 * - agree on whether type checks and assertions are enabled 3197 * - agree on whether type checks and assertions are enabled
3188 * 3198 *
3189 * \return Returns an error handler if the VM was built in a mode that does not 3199 * \return Returns an error handler if the VM was built in a mode that does not
3190 * support saving JIT feedback. 3200 * support saving JIT feedback.
3191 */ 3201 */
3192 DART_EXPORT Dart_Handle Dart_SaveJITFeedback(uint8_t** buffer, 3202 DART_EXPORT Dart_Handle Dart_SaveJITFeedback(uint8_t** buffer,
3193 intptr_t* buffer_length); 3203 intptr_t* buffer_length);
3194 3204
3195 typedef struct {
3196 const char* library_uri;
3197 const char* class_name;
3198 const char* function_name;
3199 } Dart_QualifiedFunctionName;
3200
3201 /** 3205 /**
3202 * Compiles all functions reachable from the provided entry points and marks 3206 * Compiles all functions reachable from the provided entry points and marks
3203 * the isolate to disallow future compilation. 3207 * the isolate to disallow future compilation.
3204 * 3208 *
3205 * \param entry_points A list of functions that may be invoked through the 3209 * \param entry_points A list of functions that may be invoked through the
3206 * embedding API, e.g. Dart_Invoke/GetField/SetField/New/InvokeClosure. 3210 * embedding API, e.g. Dart_Invoke/GetField/SetField/New/InvokeClosure.
3207 * 3211 *
3208 * \param reset_fields Controls whether static fields are reset. Fields without 3212 * \param reset_fields Controls whether static fields are reset. Fields without
3209 * an initializer will be set to null, and fields with an initializer will have 3213 * an initializer will be set to null, and fields with an initializer will have
3210 * their initializer run the next time they are accessed. 3214 * their initializer run the next time they are accessed.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
3317 uint8_t** vm_snapshot_data_buffer, 3321 uint8_t** vm_snapshot_data_buffer,
3318 intptr_t* vm_snapshot_data_size, 3322 intptr_t* vm_snapshot_data_size,
3319 uint8_t** vm_snapshot_instructions_buffer, 3323 uint8_t** vm_snapshot_instructions_buffer,
3320 intptr_t* vm_snapshot_instructions_size, 3324 intptr_t* vm_snapshot_instructions_size,
3321 uint8_t** isolate_snapshot_data_buffer, 3325 uint8_t** isolate_snapshot_data_buffer,
3322 intptr_t* isolate_snapshot_data_size, 3326 intptr_t* isolate_snapshot_data_size,
3323 uint8_t** isolate_snapshot_instructions_buffer, 3327 uint8_t** isolate_snapshot_instructions_buffer,
3324 intptr_t* isolate_snapshot_instructions_size); 3328 intptr_t* isolate_snapshot_instructions_size);
3325 3329
3326 /** 3330 /**
3331 * Get obfuscation map for precompiled code.
3332 *
3333 * Obfuscation map is encoded as a JSON array of pairs (original name,
3334 * obfuscated name).
3335 *
3336 * \return Returns an error handler if the VM was built in a mode that does not
3337 * support obfuscation.
3338 */
3339 DART_EXPORT Dart_Handle Dart_GetObfuscationMap(uint8_t** buffer,
3340 intptr_t* buffer_length);
3341
3342 /**
3327 * Returns whether the VM only supports running from precompiled snapshots and 3343 * Returns whether the VM only supports running from precompiled snapshots and
3328 * not from any other kind of snapshot or from source (that is, the VM was 3344 * not from any other kind of snapshot or from source (that is, the VM was
3329 * compiled with DART_PRECOMPILED_RUNTIME). 3345 * compiled with DART_PRECOMPILED_RUNTIME).
3330 */ 3346 */
3331 DART_EXPORT bool Dart_IsPrecompiledRuntime(); 3347 DART_EXPORT bool Dart_IsPrecompiledRuntime();
3332 3348
3333 /** 3349 /**
3334 * Print a native stack trace. Used for crash handling. 3350 * Print a native stack trace. Used for crash handling.
3335 */ 3351 */
3336 DART_EXPORT void Dart_DumpNativeStackTrace(void* context); 3352 DART_EXPORT void Dart_DumpNativeStackTrace(void* context);
3337 3353
3338 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */ 3354 #endif /* INCLUDE_DART_API_H_ */ /* NOLINT */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698