Nodejsc ++ startup process 3

Source: Internet
Author: User
Persistentv8: Context: New (v8: ExtensionConfiguration * extensions, v8: Handleglobal_template, v8: Handleglobal_object) {I: Isolate: EnsureDefaultIsolate ();

Persistent V8: Context: New (
V8: ExtensionConfiguration * extensions,
V8: Handle Global_template,
V8: Handle Global_object ){
I: Isolate: EnsureDefaultIsolate ();
I: Isolate * isolate = I: Isolate: Current ();
EnsureInitializedForIsolate (isolate, "v8: Context: New ()");
LOG_API (isolate, "Context: New ");
On_initlout (isolate, "v8: Context: New ()", return Persistent ());


// Add the following content to blog 1
// Enter V8 via an ENTER_V8 scope.
I: Handle Env;

{

// Enter the engine and use the VMState class to exit the engine during analysis.

ENTER_V8 (isolate );
V8: Handle Proxy_template = global_template;
I: Handle Proxy_constructor;
I: Handle Global_constructor;




If (! Global_template.IsEmpty ()){
// Make sure that the global_template has a constructor.
Global_constructor =
EnsureConstructor (Utils: OpenHandle (* global_template ));




// Create a fresh template for the global proxy object.
Proxy_template = ObjectTemplate: New ();
Proxy_constructor =
EnsureConstructor (Utils: OpenHandle (* proxy_template ));




// Set the global template to be the prototype template
// Global proxy template.
Proxy_constructor-> set_prototype_template (
* Utils: OpenHandle (* global_template ));




// Migrate security handlers from global_template
// Proxy_template. Temporarily removing access check
// Information from the global template.
If (! Global_constructor-> access_check_info ()-> IsUndefined ()){
Proxy_constructor-> set_access_check_info (
Global_constructor-> access_check_info ());
Proxy_constructor-> set_needs_access_check (
Global_constructor-> needs_access_check ());
Global_constructor-> set_needs_access_check (false );
Global_constructor-> set_access_check_info (
Isolate-> heap ()-> undefined_value ());
}
}




// Create the environment.
Env = isolate-> bootstrapper ()-> CreateEnvironment (
Isolate,
Utils: OpenHandle (* global_object, true ),
Proxy_template,
Extensions );




// Restore the access check info on the global template.
If (! Global_template.IsEmpty ()){
ASSERT (! Global_constructor.is_null ());
ASSERT (! Proxy_constructor.is_null ());
Global_constructor-> set_access_check_info (
Proxy_constructor-> access_check_info ());
Global_constructor-> set_needs_access_check (
Proxy_constructor-> needs_access_check ());
}
Isolate-> runtime_profiler ()-> Reset ();
}
// Leave V8.




If (env. is_null ()){
Return Persistent ();
}
Return Persistent (Utils: ToLocal (env ));
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.