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

Side by Side Diff: src/api.cc

Issue 2619203002: [serializer] pass internal fields deserializer callback as argument. (Closed)
Patch Set: Created 3 years, 11 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 | « include/v8.h ('k') | src/bootstrapper.h » ('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 #include "src/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 469
470 static SnapshotCreatorData* cast(void* data) { 470 static SnapshotCreatorData* cast(void* data) {
471 return reinterpret_cast<SnapshotCreatorData*>(data); 471 return reinterpret_cast<SnapshotCreatorData*>(data);
472 } 472 }
473 473
474 ArrayBufferAllocator allocator_; 474 ArrayBufferAllocator allocator_;
475 Isolate* isolate_; 475 Isolate* isolate_;
476 Persistent<Context> default_context_; 476 Persistent<Context> default_context_;
477 PersistentValueVector<Context> contexts_; 477 PersistentValueVector<Context> contexts_;
478 PersistentValueVector<Template> templates_; 478 PersistentValueVector<Template> templates_;
479 std::vector<SerializeInternalFieldsCallback> internal_fields_serializers_;
479 bool created_; 480 bool created_;
480 }; 481 };
481 482
482 } // namespace 483 } // namespace
483 484
484 SnapshotCreator::SnapshotCreator(intptr_t* external_references, 485 SnapshotCreator::SnapshotCreator(intptr_t* external_references,
485 StartupData* existing_snapshot) { 486 StartupData* existing_snapshot) {
486 i::Isolate* internal_isolate = new i::Isolate(true); 487 i::Isolate* internal_isolate = new i::Isolate(true);
487 Isolate* isolate = reinterpret_cast<Isolate*>(internal_isolate); 488 Isolate* isolate = reinterpret_cast<Isolate*>(internal_isolate);
488 SnapshotCreatorData* data = new SnapshotCreatorData(isolate); 489 SnapshotCreatorData* data = new SnapshotCreatorData(isolate);
(...skipping 26 matching lines...) Expand all
515 void SnapshotCreator::SetDefaultContext(Local<Context> context) { 516 void SnapshotCreator::SetDefaultContext(Local<Context> context) {
516 DCHECK(!context.IsEmpty()); 517 DCHECK(!context.IsEmpty());
517 SnapshotCreatorData* data = SnapshotCreatorData::cast(data_); 518 SnapshotCreatorData* data = SnapshotCreatorData::cast(data_);
518 DCHECK(!data->created_); 519 DCHECK(!data->created_);
519 DCHECK(data->default_context_.IsEmpty()); 520 DCHECK(data->default_context_.IsEmpty());
520 Isolate* isolate = data->isolate_; 521 Isolate* isolate = data->isolate_;
521 CHECK_EQ(isolate, context->GetIsolate()); 522 CHECK_EQ(isolate, context->GetIsolate());
522 data->default_context_.Reset(isolate, context); 523 data->default_context_.Reset(isolate, context);
523 } 524 }
524 525
525 size_t SnapshotCreator::AddContext(Local<Context> context) { 526 size_t SnapshotCreator::AddContext(Local<Context> context,
527 SerializeInternalFieldsCallback callback) {
526 DCHECK(!context.IsEmpty()); 528 DCHECK(!context.IsEmpty());
527 SnapshotCreatorData* data = SnapshotCreatorData::cast(data_); 529 SnapshotCreatorData* data = SnapshotCreatorData::cast(data_);
528 DCHECK(!data->created_); 530 DCHECK(!data->created_);
529 Isolate* isolate = data->isolate_; 531 Isolate* isolate = data->isolate_;
530 CHECK_EQ(isolate, context->GetIsolate()); 532 CHECK_EQ(isolate, context->GetIsolate());
531 size_t index = static_cast<int>(data->contexts_.Size()); 533 size_t index = static_cast<int>(data->contexts_.Size());
532 data->contexts_.Append(context); 534 data->contexts_.Append(context);
535 data->internal_fields_serializers_.push_back(callback);
533 return index; 536 return index;
534 } 537 }
535 538
536 size_t SnapshotCreator::AddTemplate(Local<Template> template_obj) { 539 size_t SnapshotCreator::AddTemplate(Local<Template> template_obj) {
537 DCHECK(!template_obj.IsEmpty()); 540 DCHECK(!template_obj.IsEmpty());
538 SnapshotCreatorData* data = SnapshotCreatorData::cast(data_); 541 SnapshotCreatorData* data = SnapshotCreatorData::cast(data_);
539 DCHECK(!data->created_); 542 DCHECK(!data->created_);
540 DCHECK_EQ(reinterpret_cast<i::Isolate*>(data->isolate_), 543 DCHECK_EQ(reinterpret_cast<i::Isolate*>(data->isolate_),
541 Utils::OpenHandle(*template_obj)->GetIsolate()); 544 Utils::OpenHandle(*template_obj)->GetIsolate());
542 size_t index = static_cast<int>(data->templates_.Size()); 545 size_t index = static_cast<int>(data->templates_.Size());
543 data->templates_.Append(template_obj); 546 data->templates_.Append(template_obj);
544 return index; 547 return index;
545 } 548 }
546 549
547 StartupData SnapshotCreator::CreateBlob( 550 StartupData SnapshotCreator::CreateBlob(
548 SnapshotCreator::FunctionCodeHandling function_code_handling, 551 SnapshotCreator::FunctionCodeHandling function_code_handling) {
549 SerializeInternalFieldsCallback callback) {
550 SnapshotCreatorData* data = SnapshotCreatorData::cast(data_); 552 SnapshotCreatorData* data = SnapshotCreatorData::cast(data_);
551 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(data->isolate_); 553 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(data->isolate_);
552 DCHECK(!data->created_); 554 DCHECK(!data->created_);
553 DCHECK(!data->default_context_.IsEmpty()); 555 DCHECK(!data->default_context_.IsEmpty());
554 556
555 int num_additional_contexts = static_cast<int>(data->contexts_.Size()); 557 int num_additional_contexts = static_cast<int>(data->contexts_.Size());
556 558
557 { 559 {
558 int num_templates = static_cast<int>(data->templates_.Size()); 560 int num_templates = static_cast<int>(data->templates_.Size());
559 i::HandleScope scope(isolate); 561 i::HandleScope scope(isolate);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 i::ExternalReferenceTable::instance(isolate)->ResetCount(); 607 i::ExternalReferenceTable::instance(isolate)->ResetCount();
606 #endif // DEBUG 608 #endif // DEBUG
607 609
608 i::StartupSerializer startup_serializer(isolate, function_code_handling); 610 i::StartupSerializer startup_serializer(isolate, function_code_handling);
609 startup_serializer.SerializeStrongReferences(); 611 startup_serializer.SerializeStrongReferences();
610 612
611 // Serialize each context with a new partial serializer. 613 // Serialize each context with a new partial serializer.
612 i::List<i::SnapshotData*> context_snapshots(num_additional_contexts + 1); 614 i::List<i::SnapshotData*> context_snapshots(num_additional_contexts + 1);
613 615
614 { 616 {
617 // The default snapshot does not support internal fields.
615 i::PartialSerializer partial_serializer(isolate, &startup_serializer, 618 i::PartialSerializer partial_serializer(isolate, &startup_serializer,
616 callback); 619 nullptr);
617 partial_serializer.Serialize(&default_context, false); 620 partial_serializer.Serialize(&default_context, false);
618 context_snapshots.Add(new i::SnapshotData(&partial_serializer)); 621 context_snapshots.Add(new i::SnapshotData(&partial_serializer));
619 } 622 }
620 623
621 for (int i = 0; i < num_additional_contexts; i++) { 624 for (int i = 0; i < num_additional_contexts; i++) {
622 i::PartialSerializer partial_serializer(isolate, &startup_serializer, 625 i::PartialSerializer partial_serializer(
623 callback); 626 isolate, &startup_serializer, data->internal_fields_serializers_[i]);
624 partial_serializer.Serialize(&contexts[i], true); 627 partial_serializer.Serialize(&contexts[i], true);
625 context_snapshots.Add(new i::SnapshotData(&partial_serializer)); 628 context_snapshots.Add(new i::SnapshotData(&partial_serializer));
626 } 629 }
627 630
628 startup_serializer.SerializeWeakReferencesAndDeferred(); 631 startup_serializer.SerializeWeakReferencesAndDeferred();
629 632
630 #ifdef DEBUG 633 #ifdef DEBUG
631 if (i::FLAG_external_reference_stats) { 634 if (i::FLAG_external_reference_stats) {
632 i::ExternalReferenceTable::instance(isolate)->PrintCount(); 635 i::ExternalReferenceTable::instance(isolate)->PrintCount();
633 } 636 }
(...skipping 5529 matching lines...) Expand 10 before | Expand all | Expand 10 after
6163 } 6166 }
6164 6167
6165 template <typename ObjectType> 6168 template <typename ObjectType>
6166 struct InvokeBootstrapper; 6169 struct InvokeBootstrapper;
6167 6170
6168 template <> 6171 template <>
6169 struct InvokeBootstrapper<i::Context> { 6172 struct InvokeBootstrapper<i::Context> {
6170 i::Handle<i::Context> Invoke( 6173 i::Handle<i::Context> Invoke(
6171 i::Isolate* isolate, i::MaybeHandle<i::JSGlobalProxy> maybe_global_proxy, 6174 i::Isolate* isolate, i::MaybeHandle<i::JSGlobalProxy> maybe_global_proxy,
6172 v8::Local<v8::ObjectTemplate> global_object_template, 6175 v8::Local<v8::ObjectTemplate> global_object_template,
6173 v8::ExtensionConfiguration* extensions, size_t context_snapshot_index) { 6176 v8::ExtensionConfiguration* extensions, size_t context_snapshot_index,
6177 v8::DeserializeInternalFieldsCallback internal_fields_deserializer) {
6174 return isolate->bootstrapper()->CreateEnvironment( 6178 return isolate->bootstrapper()->CreateEnvironment(
6175 maybe_global_proxy, global_object_template, extensions, 6179 maybe_global_proxy, global_object_template, extensions,
6176 context_snapshot_index); 6180 context_snapshot_index, internal_fields_deserializer);
6177 } 6181 }
6178 }; 6182 };
6179 6183
6180 template <> 6184 template <>
6181 struct InvokeBootstrapper<i::JSGlobalProxy> { 6185 struct InvokeBootstrapper<i::JSGlobalProxy> {
6182 i::Handle<i::JSGlobalProxy> Invoke( 6186 i::Handle<i::JSGlobalProxy> Invoke(
6183 i::Isolate* isolate, i::MaybeHandle<i::JSGlobalProxy> maybe_global_proxy, 6187 i::Isolate* isolate, i::MaybeHandle<i::JSGlobalProxy> maybe_global_proxy,
6184 v8::Local<v8::ObjectTemplate> global_object_template, 6188 v8::Local<v8::ObjectTemplate> global_object_template,
6185 v8::ExtensionConfiguration* extensions, size_t context_snapshot_index) { 6189 v8::ExtensionConfiguration* extensions, size_t context_snapshot_index,
6190 v8::DeserializeInternalFieldsCallback internal_fields_deserializer) {
6186 USE(extensions); 6191 USE(extensions);
6187 USE(context_snapshot_index); 6192 USE(context_snapshot_index);
6188 return isolate->bootstrapper()->NewRemoteContext(maybe_global_proxy, 6193 return isolate->bootstrapper()->NewRemoteContext(maybe_global_proxy,
6189 global_object_template); 6194 global_object_template);
6190 } 6195 }
6191 }; 6196 };
6192 6197
6193 template <typename ObjectType> 6198 template <typename ObjectType>
6194 static i::Handle<ObjectType> CreateEnvironment( 6199 static i::Handle<ObjectType> CreateEnvironment(
6195 i::Isolate* isolate, v8::ExtensionConfiguration* extensions, 6200 i::Isolate* isolate, v8::ExtensionConfiguration* extensions,
6196 v8::MaybeLocal<ObjectTemplate> maybe_global_template, 6201 v8::MaybeLocal<ObjectTemplate> maybe_global_template,
6197 v8::MaybeLocal<Value> maybe_global_proxy, size_t context_snapshot_index) { 6202 v8::MaybeLocal<Value> maybe_global_proxy, size_t context_snapshot_index,
6203 v8::DeserializeInternalFieldsCallback internal_fields_deserializer) {
6198 i::Handle<ObjectType> result; 6204 i::Handle<ObjectType> result;
6199 6205
6200 // Enter V8 via an ENTER_V8 scope. 6206 // Enter V8 via an ENTER_V8 scope.
6201 { 6207 {
6202 ENTER_V8(isolate); 6208 ENTER_V8(isolate);
6203 v8::Local<ObjectTemplate> proxy_template; 6209 v8::Local<ObjectTemplate> proxy_template;
6204 i::Handle<i::FunctionTemplateInfo> proxy_constructor; 6210 i::Handle<i::FunctionTemplateInfo> proxy_constructor;
6205 i::Handle<i::FunctionTemplateInfo> global_constructor; 6211 i::Handle<i::FunctionTemplateInfo> global_constructor;
6206 6212
6207 if (!maybe_global_template.IsEmpty()) { 6213 if (!maybe_global_template.IsEmpty()) {
(...skipping 29 matching lines...) Expand all
6237 } 6243 }
6238 } 6244 }
6239 6245
6240 i::MaybeHandle<i::JSGlobalProxy> maybe_proxy; 6246 i::MaybeHandle<i::JSGlobalProxy> maybe_proxy;
6241 if (!maybe_global_proxy.IsEmpty()) { 6247 if (!maybe_global_proxy.IsEmpty()) {
6242 maybe_proxy = i::Handle<i::JSGlobalProxy>::cast( 6248 maybe_proxy = i::Handle<i::JSGlobalProxy>::cast(
6243 Utils::OpenHandle(*maybe_global_proxy.ToLocalChecked())); 6249 Utils::OpenHandle(*maybe_global_proxy.ToLocalChecked()));
6244 } 6250 }
6245 // Create the environment. 6251 // Create the environment.
6246 InvokeBootstrapper<ObjectType> invoke; 6252 InvokeBootstrapper<ObjectType> invoke;
6247 result = invoke.Invoke(isolate, maybe_proxy, proxy_template, extensions, 6253 result =
6248 context_snapshot_index); 6254 invoke.Invoke(isolate, maybe_proxy, proxy_template, extensions,
6255 context_snapshot_index, internal_fields_deserializer);
6249 6256
6250 // Restore the access check info on the global template. 6257 // Restore the access check info on the global template.
6251 if (!maybe_global_template.IsEmpty()) { 6258 if (!maybe_global_template.IsEmpty()) {
6252 DCHECK(!global_constructor.is_null()); 6259 DCHECK(!global_constructor.is_null());
6253 DCHECK(!proxy_constructor.is_null()); 6260 DCHECK(!proxy_constructor.is_null());
6254 global_constructor->set_access_check_info( 6261 global_constructor->set_access_check_info(
6255 proxy_constructor->access_check_info()); 6262 proxy_constructor->access_check_info());
6256 global_constructor->set_needs_access_check( 6263 global_constructor->set_needs_access_check(
6257 proxy_constructor->needs_access_check()); 6264 proxy_constructor->needs_access_check());
6258 } 6265 }
6259 } 6266 }
6260 // Leave V8. 6267 // Leave V8.
6261 6268
6262 return result; 6269 return result;
6263 } 6270 }
6264 6271
6265 Local<Context> NewContext(v8::Isolate* external_isolate, 6272 Local<Context> NewContext(
6266 v8::ExtensionConfiguration* extensions, 6273 v8::Isolate* external_isolate, v8::ExtensionConfiguration* extensions,
6267 v8::MaybeLocal<ObjectTemplate> global_template, 6274 v8::MaybeLocal<ObjectTemplate> global_template,
6268 v8::MaybeLocal<Value> global_object, 6275 v8::MaybeLocal<Value> global_object, size_t context_snapshot_index,
6269 size_t context_snapshot_index) { 6276 v8::DeserializeInternalFieldsCallback internal_fields_deserializer) {
6270 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(external_isolate); 6277 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(external_isolate);
6271 TRACE_EVENT_CALL_STATS_SCOPED(isolate, "v8", "V8.NewContext"); 6278 TRACE_EVENT_CALL_STATS_SCOPED(isolate, "v8", "V8.NewContext");
6272 LOG_API(isolate, Context, New); 6279 LOG_API(isolate, Context, New);
6273 i::HandleScope scope(isolate); 6280 i::HandleScope scope(isolate);
6274 ExtensionConfiguration no_extensions; 6281 ExtensionConfiguration no_extensions;
6275 if (extensions == NULL) extensions = &no_extensions; 6282 if (extensions == NULL) extensions = &no_extensions;
6276 i::Handle<i::Context> env = 6283 i::Handle<i::Context> env = CreateEnvironment<i::Context>(
6277 CreateEnvironment<i::Context>(isolate, extensions, global_template, 6284 isolate, extensions, global_template, global_object,
6278 global_object, context_snapshot_index); 6285 context_snapshot_index, internal_fields_deserializer);
6279 if (env.is_null()) { 6286 if (env.is_null()) {
6280 if (isolate->has_pending_exception()) { 6287 if (isolate->has_pending_exception()) {
6281 isolate->OptionalRescheduleException(true); 6288 isolate->OptionalRescheduleException(true);
6282 } 6289 }
6283 return Local<Context>(); 6290 return Local<Context>();
6284 } 6291 }
6285 return Utils::ToLocal(scope.CloseAndEscape(env)); 6292 return Utils::ToLocal(scope.CloseAndEscape(env));
6286 } 6293 }
6287 6294
6288 Local<Context> v8::Context::New(v8::Isolate* external_isolate, 6295 Local<Context> v8::Context::New(v8::Isolate* external_isolate,
6289 v8::ExtensionConfiguration* extensions, 6296 v8::ExtensionConfiguration* extensions,
6290 v8::MaybeLocal<ObjectTemplate> global_template, 6297 v8::MaybeLocal<ObjectTemplate> global_template,
6291 v8::MaybeLocal<Value> global_object) { 6298 v8::MaybeLocal<Value> global_object) {
6292 return NewContext(external_isolate, extensions, global_template, 6299 return NewContext(external_isolate, extensions, global_template,
6293 global_object, 0); 6300 global_object, 0, nullptr);
6294 } 6301 }
6295 6302
6296 MaybeLocal<Context> v8::Context::FromSnapshot( 6303 MaybeLocal<Context> v8::Context::FromSnapshot(
6297 v8::Isolate* external_isolate, size_t context_snapshot_index, 6304 v8::Isolate* external_isolate, size_t context_snapshot_index,
6305 v8::DeserializeInternalFieldsCallback internal_fields_deserializer,
6298 v8::ExtensionConfiguration* extensions, MaybeLocal<Value> global_object) { 6306 v8::ExtensionConfiguration* extensions, MaybeLocal<Value> global_object) {
6299 size_t index_including_default_context = context_snapshot_index + 1; 6307 size_t index_including_default_context = context_snapshot_index + 1;
6300 if (!i::Snapshot::HasContextSnapshot( 6308 if (!i::Snapshot::HasContextSnapshot(
6301 reinterpret_cast<i::Isolate*>(external_isolate), 6309 reinterpret_cast<i::Isolate*>(external_isolate),
6302 index_including_default_context)) { 6310 index_including_default_context)) {
6303 return MaybeLocal<Context>(); 6311 return MaybeLocal<Context>();
6304 } 6312 }
6305 return NewContext(external_isolate, extensions, MaybeLocal<ObjectTemplate>(), 6313 return NewContext(external_isolate, extensions, MaybeLocal<ObjectTemplate>(),
6306 global_object, index_including_default_context); 6314 global_object, index_including_default_context,
6315 internal_fields_deserializer);
6307 } 6316 }
6308 6317
6309 MaybeLocal<Object> v8::Context::NewRemoteContext( 6318 MaybeLocal<Object> v8::Context::NewRemoteContext(
6310 v8::Isolate* external_isolate, v8::Local<ObjectTemplate> global_template, 6319 v8::Isolate* external_isolate, v8::Local<ObjectTemplate> global_template,
6311 v8::MaybeLocal<v8::Value> global_object) { 6320 v8::MaybeLocal<v8::Value> global_object) {
6312 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(external_isolate); 6321 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(external_isolate);
6313 LOG_API(isolate, Context, NewRemoteContext); 6322 LOG_API(isolate, Context, NewRemoteContext);
6314 i::HandleScope scope(isolate); 6323 i::HandleScope scope(isolate);
6315 i::Handle<i::FunctionTemplateInfo> global_constructor = 6324 i::Handle<i::FunctionTemplateInfo> global_constructor =
6316 EnsureConstructor(isolate, *global_template); 6325 EnsureConstructor(isolate, *global_template);
6317 Utils::ApiCheck(global_constructor->needs_access_check(), 6326 Utils::ApiCheck(global_constructor->needs_access_check(),
6318 "v8::Context::NewRemoteContext", 6327 "v8::Context::NewRemoteContext",
6319 "Global template needs to have access checks enabled."); 6328 "Global template needs to have access checks enabled.");
6320 i::Handle<i::AccessCheckInfo> access_check_info = i::handle( 6329 i::Handle<i::AccessCheckInfo> access_check_info = i::handle(
6321 i::AccessCheckInfo::cast(global_constructor->access_check_info()), 6330 i::AccessCheckInfo::cast(global_constructor->access_check_info()),
6322 isolate); 6331 isolate);
6323 Utils::ApiCheck(access_check_info->named_interceptor() != nullptr, 6332 Utils::ApiCheck(access_check_info->named_interceptor() != nullptr,
6324 "v8::Context::NewRemoteContext", 6333 "v8::Context::NewRemoteContext",
6325 "Global template needs to have access check handlers."); 6334 "Global template needs to have access check handlers.");
6326 i::Handle<i::JSGlobalProxy> global_proxy = 6335 i::Handle<i::JSGlobalProxy> global_proxy =
6327 CreateEnvironment<i::JSGlobalProxy>(isolate, nullptr, global_template, 6336 CreateEnvironment<i::JSGlobalProxy>(isolate, nullptr, global_template,
6328 global_object, 0); 6337 global_object, 0, nullptr);
6329 if (global_proxy.is_null()) { 6338 if (global_proxy.is_null()) {
6330 if (isolate->has_pending_exception()) { 6339 if (isolate->has_pending_exception()) {
6331 isolate->OptionalRescheduleException(true); 6340 isolate->OptionalRescheduleException(true);
6332 } 6341 }
6333 return MaybeLocal<Object>(); 6342 return MaybeLocal<Object>();
6334 } 6343 }
6335 return Utils::ToLocal( 6344 return Utils::ToLocal(
6336 scope.CloseAndEscape(i::Handle<i::JSObject>::cast(global_proxy))); 6345 scope.CloseAndEscape(i::Handle<i::JSObject>::cast(global_proxy)));
6337 } 6346 }
6338 6347
(...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after
8050 if (params.create_histogram_callback) { 8059 if (params.create_histogram_callback) {
8051 v8_isolate->SetCreateHistogramFunction(params.create_histogram_callback); 8060 v8_isolate->SetCreateHistogramFunction(params.create_histogram_callback);
8052 } 8061 }
8053 8062
8054 if (params.add_histogram_sample_callback) { 8063 if (params.add_histogram_sample_callback) {
8055 v8_isolate->SetAddHistogramSampleFunction( 8064 v8_isolate->SetAddHistogramSampleFunction(
8056 params.add_histogram_sample_callback); 8065 params.add_histogram_sample_callback);
8057 } 8066 }
8058 8067
8059 isolate->set_api_external_references(params.external_references); 8068 isolate->set_api_external_references(params.external_references);
8060 isolate->set_deserialize_internal_fields_callback(
8061 params.deserialize_internal_fields_callback);
8062 SetResourceConstraints(isolate, params.constraints); 8069 SetResourceConstraints(isolate, params.constraints);
8063 // TODO(jochen): Once we got rid of Isolate::Current(), we can remove this. 8070 // TODO(jochen): Once we got rid of Isolate::Current(), we can remove this.
8064 Isolate::Scope isolate_scope(v8_isolate); 8071 Isolate::Scope isolate_scope(v8_isolate);
8065 if (params.entry_hook || !i::Snapshot::Initialize(isolate)) { 8072 if (params.entry_hook || !i::Snapshot::Initialize(isolate)) {
8066 isolate->Init(NULL); 8073 isolate->Init(NULL);
8067 } 8074 }
8068 return v8_isolate; 8075 return v8_isolate;
8069 } 8076 }
8070 8077
8071 8078
(...skipping 1897 matching lines...) Expand 10 before | Expand all | Expand 10 after
9969 Address callback_address = 9976 Address callback_address =
9970 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 9977 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
9971 VMState<EXTERNAL> state(isolate); 9978 VMState<EXTERNAL> state(isolate);
9972 ExternalCallbackScope call_scope(isolate, callback_address); 9979 ExternalCallbackScope call_scope(isolate, callback_address);
9973 callback(info); 9980 callback(info);
9974 } 9981 }
9975 9982
9976 9983
9977 } // namespace internal 9984 } // namespace internal
9978 } // namespace v8 9985 } // namespace v8
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/bootstrapper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698