OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "include/dart_api.h" | 5 #include "include/dart_api.h" |
6 #include "include/dart_mirrors_api.h" | 6 #include "include/dart_mirrors_api.h" |
7 #include "include/dart_native_api.h" | 7 #include "include/dart_native_api.h" |
8 | 8 |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 #include "lib/stacktrace.h" | 10 #include "lib/stacktrace.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "vm/message.h" | 29 #include "vm/message.h" |
30 #include "vm/message_handler.h" | 30 #include "vm/message_handler.h" |
31 #include "vm/native_entry.h" | 31 #include "vm/native_entry.h" |
32 #include "vm/object.h" | 32 #include "vm/object.h" |
33 #include "vm/object_store.h" | 33 #include "vm/object_store.h" |
34 #include "vm/os_thread.h" | 34 #include "vm/os_thread.h" |
35 #include "vm/os.h" | 35 #include "vm/os.h" |
36 #include "vm/port.h" | 36 #include "vm/port.h" |
37 #include "vm/precompiler.h" | 37 #include "vm/precompiler.h" |
38 #include "vm/profiler.h" | 38 #include "vm/profiler.h" |
| 39 #include "vm/program_visitor.h" |
39 #include "vm/resolver.h" | 40 #include "vm/resolver.h" |
40 #include "vm/reusable_handles.h" | 41 #include "vm/reusable_handles.h" |
41 #include "vm/service_event.h" | 42 #include "vm/service_event.h" |
42 #include "vm/service_isolate.h" | 43 #include "vm/service_isolate.h" |
43 #include "vm/service.h" | 44 #include "vm/service.h" |
44 #include "vm/stack_frame.h" | 45 #include "vm/stack_frame.h" |
45 #include "vm/symbols.h" | 46 #include "vm/symbols.h" |
46 #include "vm/tags.h" | 47 #include "vm/tags.h" |
47 #include "vm/thread_registry.h" | 48 #include "vm/thread_registry.h" |
48 #include "vm/timeline.h" | 49 #include "vm/timeline.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 } while (false) | 106 } while (false) |
106 #define API_TIMELINE_BEGIN_END \ | 107 #define API_TIMELINE_BEGIN_END \ |
107 do { \ | 108 do { \ |
108 } while (false) | 109 } while (false) |
109 #endif // !PRODUCT | 110 #endif // !PRODUCT |
110 | 111 |
111 #if defined(DEBUG) | 112 #if defined(DEBUG) |
112 // An object visitor which will iterate over all the function objects in the | 113 // An object visitor which will iterate over all the function objects in the |
113 // heap and check if the result type and parameter types are canonicalized | 114 // heap and check if the result type and parameter types are canonicalized |
114 // or not. An assertion is raised if a type is not canonicalized. | 115 // or not. An assertion is raised if a type is not canonicalized. |
115 class FunctionVisitor : public ObjectVisitor { | 116 class CheckFunctionTypesVisitor : public ObjectVisitor { |
116 public: | 117 public: |
117 explicit FunctionVisitor(Thread* thread) | 118 explicit CheckFunctionTypesVisitor(Thread* thread) |
118 : classHandle_(Class::Handle(thread->zone())), | 119 : classHandle_(Class::Handle(thread->zone())), |
119 funcHandle_(Function::Handle(thread->zone())), | 120 funcHandle_(Function::Handle(thread->zone())), |
120 typeHandle_(AbstractType::Handle(thread->zone())) {} | 121 typeHandle_(AbstractType::Handle(thread->zone())) {} |
121 | 122 |
122 void VisitObject(RawObject* obj) { | 123 void VisitObject(RawObject* obj) { |
123 if (obj->IsFunction()) { | 124 if (obj->IsFunction()) { |
124 funcHandle_ ^= obj; | 125 funcHandle_ ^= obj; |
125 classHandle_ ^= funcHandle_.Owner(); | 126 classHandle_ ^= funcHandle_.Owner(); |
126 // Verify that the result type of a function is canonical or a | 127 // Verify that the result type of a function is canonical or a |
127 // TypeParameter. | 128 // TypeParameter. |
(...skipping 1437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1565 } | 1566 } |
1566 // Finalize all classes if needed. | 1567 // Finalize all classes if needed. |
1567 Dart_Handle state = Api::CheckAndFinalizePendingClasses(T); | 1568 Dart_Handle state = Api::CheckAndFinalizePendingClasses(T); |
1568 if (::Dart_IsError(state)) { | 1569 if (::Dart_IsError(state)) { |
1569 return state; | 1570 return state; |
1570 } | 1571 } |
1571 I->StopBackgroundCompiler(); | 1572 I->StopBackgroundCompiler(); |
1572 | 1573 |
1573 #if defined(DEBUG) | 1574 #if defined(DEBUG) |
1574 I->heap()->CollectAllGarbage(); | 1575 I->heap()->CollectAllGarbage(); |
1575 FunctionVisitor check_canonical(T); | 1576 CheckFunctionTypesVisitor check_canonical(T); |
1576 I->heap()->IterateObjects(&check_canonical); | 1577 I->heap()->IterateObjects(&check_canonical); |
1577 #endif // #if defined(DEBUG) | 1578 #endif // #if defined(DEBUG) |
1578 | 1579 |
1579 FullSnapshotWriter writer(Snapshot::kCore, vm_isolate_snapshot_buffer, | 1580 FullSnapshotWriter writer(Snapshot::kCore, vm_isolate_snapshot_buffer, |
1580 isolate_snapshot_buffer, ApiReallocate, | 1581 isolate_snapshot_buffer, ApiReallocate, |
1581 NULL /* instructions_writer */); | 1582 NULL /* instructions_writer */); |
1582 writer.WriteFullSnapshot(); | 1583 writer.WriteFullSnapshot(); |
1583 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); | 1584 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); |
1584 *isolate_snapshot_size = writer.IsolateSnapshotSize(); | 1585 *isolate_snapshot_size = writer.IsolateSnapshotSize(); |
1585 return Api::Success(); | 1586 return Api::Success(); |
(...skipping 18 matching lines...) Expand all Loading... |
1604 } | 1605 } |
1605 Library& lib = Library::Handle(Z); | 1606 Library& lib = Library::Handle(Z); |
1606 if (library == Dart_Null()) { | 1607 if (library == Dart_Null()) { |
1607 lib ^= I->object_store()->root_library(); | 1608 lib ^= I->object_store()->root_library(); |
1608 } else { | 1609 } else { |
1609 lib ^= Api::UnwrapHandle(library); | 1610 lib ^= Api::UnwrapHandle(library); |
1610 } | 1611 } |
1611 | 1612 |
1612 #if defined(DEBUG) | 1613 #if defined(DEBUG) |
1613 I->heap()->CollectAllGarbage(); | 1614 I->heap()->CollectAllGarbage(); |
1614 FunctionVisitor check_canonical(T); | 1615 CheckFunctionTypesVisitor check_canonical(T); |
1615 I->heap()->IterateObjects(&check_canonical); | 1616 I->heap()->IterateObjects(&check_canonical); |
1616 #endif // #if defined(DEBUG) | 1617 #endif // #if defined(DEBUG) |
1617 | 1618 |
1618 ScriptSnapshotWriter writer(buffer, ApiReallocate); | 1619 ScriptSnapshotWriter writer(buffer, ApiReallocate); |
1619 writer.WriteScriptSnapshot(lib); | 1620 writer.WriteScriptSnapshot(lib); |
1620 *size = writer.BytesWritten(); | 1621 *size = writer.BytesWritten(); |
1621 return Api::Success(); | 1622 return Api::Success(); |
1622 } | 1623 } |
1623 | 1624 |
1624 | 1625 |
(...skipping 4794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6419 DART_EXPORT void Dart_SetThreadName(const char* name) { | 6420 DART_EXPORT void Dart_SetThreadName(const char* name) { |
6420 OSThread* thread = OSThread::Current(); | 6421 OSThread* thread = OSThread::Current(); |
6421 if (thread == NULL) { | 6422 if (thread == NULL) { |
6422 // VM is shutting down. | 6423 // VM is shutting down. |
6423 return; | 6424 return; |
6424 } | 6425 } |
6425 thread->SetName(name); | 6426 thread->SetName(name); |
6426 } | 6427 } |
6427 | 6428 |
6428 | 6429 |
6429 // The precompiler is included in dart_bootstrap and dart_noopt, and | 6430 DART_EXPORT |
6430 // excluded from dart and dart_precompiled_runtime. | 6431 Dart_Handle Dart_SaveJITFeedback(uint8_t** buffer, intptr_t* buffer_length) { |
6431 #if !defined(DART_PRECOMPILER) | 6432 #if defined(DART_PRECOMPILED_RUNTIME) |
| 6433 return Api::NewError("No JIT feedback to save on an AOT runtime."); |
| 6434 #elif defined(PRODUCT) |
| 6435 // TOOD(rmacnak): We'd need to include the JSON printing code again. |
| 6436 return Api::NewError("Dart_SaveJITFeedback not supported in PRODUCT mode."); |
| 6437 #else |
| 6438 Thread* thread = Thread::Current(); |
| 6439 DARTSCOPE(thread); |
| 6440 Isolate* isolate = thread->isolate(); |
| 6441 Zone* zone = thread->zone(); |
6432 | 6442 |
6433 DART_EXPORT Dart_Handle | 6443 if (buffer == NULL) { |
6434 Dart_Precompile(Dart_QualifiedFunctionName entry_points[], bool reset_fields) { | 6444 RETURN_NULL_ERROR(buffer); |
6435 return Api::NewError( | 6445 } |
6436 "This VM was built without support for AOT compilation."); | 6446 if (buffer_length == NULL) { |
| 6447 RETURN_NULL_ERROR(buffer_length); |
| 6448 } |
| 6449 |
| 6450 JSONStream js_stream; |
| 6451 { |
| 6452 JSONObject js_profile(&js_stream); |
| 6453 js_profile.AddProperty("vmVersion", Version::CommitString()); |
| 6454 js_profile.AddProperty("asserts", FLAG_enable_asserts); |
| 6455 js_profile.AddProperty("typeChecks", FLAG_enable_type_checks); |
| 6456 |
| 6457 { |
| 6458 JSONArray js_scripts(&js_profile, "scripts"); |
| 6459 |
| 6460 const GrowableObjectArray& libraries = GrowableObjectArray::Handle( |
| 6461 zone, isolate->object_store()->libraries()); |
| 6462 Library& library = Library::Handle(zone); |
| 6463 Array& scripts = Array::Handle(zone); |
| 6464 Script& script = Script::Handle(zone); |
| 6465 String& uri = String::Handle(zone); |
| 6466 for (intptr_t i = 0; i < libraries.Length(); i++) { |
| 6467 library ^= libraries.At(i); |
| 6468 scripts = library.LoadedScripts(); |
| 6469 for (intptr_t j = 0; j < scripts.Length(); j++) { |
| 6470 script ^= scripts.At(j); |
| 6471 JSONObject js_script(&js_scripts); |
| 6472 uri = script.url(); |
| 6473 js_script.AddProperty("uri", uri.ToCString()); |
| 6474 int64_t fp = script.SourceFingerprint(); |
| 6475 js_script.AddProperty64("checksum", fp); |
| 6476 } |
| 6477 } |
| 6478 } |
| 6479 |
| 6480 { |
| 6481 JSONArray js_classes(&js_profile, "classes"); |
| 6482 |
| 6483 ClassTable* classes = isolate->class_table(); |
| 6484 Class& cls = Class::Handle(zone); |
| 6485 Library& library = Library::Handle(zone); |
| 6486 String& uri = String::Handle(zone); |
| 6487 String& name = String::Handle(zone); |
| 6488 for (intptr_t cid = kNumPredefinedCids; cid < classes->NumCids(); cid++) { |
| 6489 if (!classes->HasValidClassAt(cid)) continue; |
| 6490 cls ^= classes->At(cid); |
| 6491 library = cls.library(); |
| 6492 JSONObject js_class(&js_classes); |
| 6493 js_class.AddProperty("cid", cid); |
| 6494 uri = library.url(); |
| 6495 js_class.AddProperty("uri", uri.ToCString()); |
| 6496 name = cls.Name(); |
| 6497 name = String::RemovePrivateKey(name); |
| 6498 js_class.AddProperty("name", name.ToCString()); |
| 6499 } |
| 6500 } |
| 6501 |
| 6502 { |
| 6503 JSONArray js_functions(&js_profile, "functions"); |
| 6504 |
| 6505 class JITFeedbackFunctionVisitor : public FunctionVisitor { |
| 6506 public: |
| 6507 JITFeedbackFunctionVisitor(JSONArray* js_functions, Zone* zone) |
| 6508 : js_functions_(js_functions), |
| 6509 function_(Function::Handle(zone)), |
| 6510 owner_(Class::Handle(zone)), |
| 6511 name_(String::Handle(zone)), |
| 6512 ic_datas_(Array::Handle(zone)), |
| 6513 ic_data_(ICData::Handle(zone)), |
| 6514 entry_(Object::Handle(zone)) {} |
| 6515 |
| 6516 void Visit(const Function& function) { |
| 6517 if (function.usage_counter() == 0) return; |
| 6518 |
| 6519 JSONObject js_function(js_functions_); |
| 6520 name_ = function.name(); |
| 6521 name_ = String::RemovePrivateKey(name_); |
| 6522 js_function.AddProperty("name", name_.ToCString()); |
| 6523 owner_ ^= function.Owner(); |
| 6524 js_function.AddProperty("class", owner_.id()); |
| 6525 js_function.AddProperty("tokenPos", function.token_pos().value()); |
| 6526 js_function.AddProperty("kind", |
| 6527 static_cast<intptr_t>(function.kind())); |
| 6528 intptr_t usage = function.usage_counter(); |
| 6529 if (usage < 0) { |
| 6530 // Function was in the background compiler's queue. |
| 6531 usage = FLAG_optimization_counter_threshold; |
| 6532 } |
| 6533 js_function.AddProperty("usageCounter", usage); |
| 6534 |
| 6535 ic_datas_ = function.ic_data_array(); |
| 6536 JSONArray js_icdatas(&js_function, "ics"); |
| 6537 if (ic_datas_.IsNull()) return; |
| 6538 |
| 6539 for (intptr_t j = 0; j < ic_datas_.Length(); j++) { |
| 6540 entry_ = ic_datas_.At(j); |
| 6541 if (!entry_.IsICData()) continue; // Skip edge counters. |
| 6542 ic_data_ ^= entry_.raw(); |
| 6543 |
| 6544 JSONObject js_icdata(&js_icdatas); |
| 6545 js_icdata.AddProperty("deoptId", ic_data_.deopt_id()); |
| 6546 name_ = ic_data_.target_name(); |
| 6547 name_ = String::RemovePrivateKey(name_); |
| 6548 js_icdata.AddProperty("selector", name_.ToCString()); |
| 6549 js_icdata.AddProperty("isStaticCall", ic_data_.is_static_call()); |
| 6550 intptr_t num_args_checked = ic_data_.NumArgsTested(); |
| 6551 js_icdata.AddProperty("argsTested", num_args_checked); |
| 6552 JSONArray js_entries(&js_icdata, "entries"); |
| 6553 for (intptr_t check = 0; check < ic_data_.NumberOfChecks(); |
| 6554 check++) { |
| 6555 GrowableArray<intptr_t> class_ids(num_args_checked); |
| 6556 ic_data_.GetClassIdsAt(check, &class_ids); |
| 6557 for (intptr_t k = 0; k < num_args_checked; k++) { |
| 6558 ASSERT(class_ids[k] != kIllegalCid); |
| 6559 js_entries.AddValue(class_ids[k]); |
| 6560 } |
| 6561 js_entries.AddValue(ic_data_.GetCountAt(check)); |
| 6562 } |
| 6563 } |
| 6564 } |
| 6565 |
| 6566 private: |
| 6567 JSONArray* js_functions_; |
| 6568 Function& function_; |
| 6569 Class& owner_; |
| 6570 String& name_; |
| 6571 Array& ic_datas_; |
| 6572 ICData& ic_data_; |
| 6573 Object& entry_; |
| 6574 }; |
| 6575 |
| 6576 JITFeedbackFunctionVisitor visitor(&js_functions, zone); |
| 6577 ProgramVisitor::VisitFunctions(&visitor); |
| 6578 } |
| 6579 } |
| 6580 |
| 6581 js_stream.Steal(reinterpret_cast<char**>(buffer), buffer_length); |
| 6582 return Api::Success(); |
| 6583 #endif |
6437 } | 6584 } |
6438 | 6585 |
6439 | 6586 |
6440 DART_EXPORT Dart_Handle | 6587 DART_EXPORT Dart_Handle |
6441 Dart_CreatePrecompiledSnapshotAssembly(uint8_t** assembly_buffer, | 6588 Dart_Precompile(Dart_QualifiedFunctionName entry_points[], |
6442 intptr_t* assembly_size) { | 6589 bool reset_fields, |
| 6590 uint8_t* jit_feedback, |
| 6591 intptr_t jit_feedback_length) { |
| 6592 #if defined(TARGET_ARCH_IA32) |
| 6593 return Api::NewError("AOT compilation is not supported on IA32."); |
| 6594 #elif defined(TARGET_ARCH_DBC) |
| 6595 return Api::NewError("AOT compilation is not supported on DBC."); |
| 6596 #elif !defined(DART_PRECOMPILER) |
6443 return Api::NewError( | 6597 return Api::NewError( |
6444 "This VM was built without support for AOT compilation."); | 6598 "This VM was built without support for AOT compilation."); |
6445 return 0; | |
6446 } | |
6447 | |
6448 | |
6449 DART_EXPORT Dart_Handle | |
6450 Dart_CreatePrecompiledSnapshotBlob(uint8_t** vm_isolate_snapshot_buffer, | |
6451 intptr_t* vm_isolate_snapshot_size, | |
6452 uint8_t** isolate_snapshot_buffer, | |
6453 intptr_t* isolate_snapshot_size, | |
6454 uint8_t** instructions_blob_buffer, | |
6455 intptr_t* instructions_blob_size, | |
6456 uint8_t** rodata_blob_buffer, | |
6457 intptr_t* rodata_blob_size) { | |
6458 return Api::NewError( | |
6459 "This VM was built without support for AOT compilation."); | |
6460 } | |
6461 | |
6462 #else // DART_PRECOMPILER | |
6463 | |
6464 DART_EXPORT Dart_Handle | |
6465 Dart_Precompile(Dart_QualifiedFunctionName entry_points[], bool reset_fields) { | |
6466 #if defined(TARGET_ARCH_IA32) | |
6467 return Api::NewError("Precompilation is not supported on IA32."); | |
6468 #elif defined(TARGET_ARCH_DBC) | |
6469 return Api::NewError("Precompilation is not supported on DBC."); | |
6470 #else | 6599 #else |
6471 API_TIMELINE_BEGIN_END; | 6600 API_TIMELINE_BEGIN_END; |
6472 DARTSCOPE(Thread::Current()); | 6601 DARTSCOPE(Thread::Current()); |
6473 if (!FLAG_precompiled_mode) { | 6602 if (!FLAG_precompiled_mode) { |
6474 return Api::NewError("Flag --precompilation was not specified."); | 6603 return Api::NewError("Flag --precompilation was not specified."); |
6475 } | 6604 } |
6476 Dart_Handle result = Api::CheckAndFinalizePendingClasses(T); | 6605 Dart_Handle result = Api::CheckAndFinalizePendingClasses(T); |
6477 if (::Dart_IsError(result)) { | 6606 if (::Dart_IsError(result)) { |
6478 return result; | 6607 return result; |
6479 } | 6608 } |
6480 CHECK_CALLBACK_STATE(T); | 6609 CHECK_CALLBACK_STATE(T); |
6481 const Error& error = | 6610 const Error& error = Error::Handle(Precompiler::CompileAll( |
6482 Error::Handle(Precompiler::CompileAll(entry_points, reset_fields)); | 6611 entry_points, reset_fields, jit_feedback, jit_feedback_length)); |
6483 if (!error.IsNull()) { | 6612 if (!error.IsNull()) { |
6484 return Api::NewHandle(T, error.raw()); | 6613 return Api::NewHandle(T, error.raw()); |
6485 } | 6614 } |
6486 return Api::Success(); | 6615 return Api::Success(); |
6487 #endif | 6616 #endif |
6488 } | 6617 } |
6489 | 6618 |
6490 | 6619 |
6491 DART_EXPORT Dart_Handle | 6620 DART_EXPORT Dart_Handle |
6492 Dart_CreatePrecompiledSnapshotAssembly(uint8_t** assembly_buffer, | 6621 Dart_CreatePrecompiledSnapshotAssembly(uint8_t** assembly_buffer, |
6493 intptr_t* assembly_size) { | 6622 intptr_t* assembly_size) { |
6494 #if defined(TARGET_ARCH_IA32) | 6623 #if defined(TARGET_ARCH_IA32) |
6495 return Api::NewError("Precompilation is not supported on IA32."); | 6624 return Api::NewError("AOT compilation is not supported on IA32."); |
6496 #elif defined(TARGET_ARCH_DBC) | 6625 #elif defined(TARGET_ARCH_DBC) |
6497 return Api::NewError("Precompilation is not supported on DBC."); | 6626 return Api::NewError("AOT compilation is not supported on DBC."); |
| 6627 #elif !defined(DART_PRECOMPILER) |
| 6628 return Api::NewError( |
| 6629 "This VM was built without support for AOT compilation."); |
6498 #else | 6630 #else |
6499 API_TIMELINE_DURATION; | 6631 API_TIMELINE_DURATION; |
6500 DARTSCOPE(Thread::Current()); | 6632 DARTSCOPE(Thread::Current()); |
6501 Isolate* I = T->isolate(); | 6633 Isolate* I = T->isolate(); |
6502 if (I->compilation_allowed()) { | 6634 if (I->compilation_allowed()) { |
6503 return Api::NewError( | 6635 return Api::NewError( |
6504 "Isolate is not precompiled. " | 6636 "Isolate is not precompiled. " |
6505 "Did you forget to call Dart_Precompile?"); | 6637 "Did you forget to call Dart_Precompile?"); |
6506 } | 6638 } |
6507 ASSERT(FLAG_load_deferred_eagerly); | 6639 ASSERT(FLAG_load_deferred_eagerly); |
(...skipping 25 matching lines...) Expand all Loading... |
6533 DART_EXPORT Dart_Handle | 6665 DART_EXPORT Dart_Handle |
6534 Dart_CreatePrecompiledSnapshotBlob(uint8_t** vm_isolate_snapshot_buffer, | 6666 Dart_CreatePrecompiledSnapshotBlob(uint8_t** vm_isolate_snapshot_buffer, |
6535 intptr_t* vm_isolate_snapshot_size, | 6667 intptr_t* vm_isolate_snapshot_size, |
6536 uint8_t** isolate_snapshot_buffer, | 6668 uint8_t** isolate_snapshot_buffer, |
6537 intptr_t* isolate_snapshot_size, | 6669 intptr_t* isolate_snapshot_size, |
6538 uint8_t** instructions_blob_buffer, | 6670 uint8_t** instructions_blob_buffer, |
6539 intptr_t* instructions_blob_size, | 6671 intptr_t* instructions_blob_size, |
6540 uint8_t** rodata_blob_buffer, | 6672 uint8_t** rodata_blob_buffer, |
6541 intptr_t* rodata_blob_size) { | 6673 intptr_t* rodata_blob_size) { |
6542 #if defined(TARGET_ARCH_IA32) | 6674 #if defined(TARGET_ARCH_IA32) |
6543 return Api::NewError("Precompilation is not supported on IA32."); | 6675 return Api::NewError("AOT compilation is not supported on IA32."); |
6544 #elif defined(TARGET_ARCH_DBC) | 6676 #elif defined(TARGET_ARCH_DBC) |
6545 return Api::NewError("Precompilation is not supported on DBC."); | 6677 return Api::NewError("AOT compilation is not supported on DBC."); |
| 6678 #elif !defined(DART_PRECOMPILER) |
| 6679 return Api::NewError( |
| 6680 "This VM was built without support for AOT compilation."); |
6546 #else | 6681 #else |
6547 API_TIMELINE_DURATION; | 6682 API_TIMELINE_DURATION; |
6548 DARTSCOPE(Thread::Current()); | 6683 DARTSCOPE(Thread::Current()); |
6549 Isolate* I = T->isolate(); | 6684 Isolate* I = T->isolate(); |
6550 if (I->compilation_allowed()) { | 6685 if (I->compilation_allowed()) { |
6551 return Api::NewError( | 6686 return Api::NewError( |
6552 "Isolate is not precompiled. " | 6687 "Isolate is not precompiled. " |
6553 "Did you forget to call Dart_Precompile?"); | 6688 "Did you forget to call Dart_Precompile?"); |
6554 } | 6689 } |
6555 ASSERT(FLAG_load_deferred_eagerly); | 6690 ASSERT(FLAG_load_deferred_eagerly); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6589 | 6724 |
6590 writer.WriteFullSnapshot(); | 6725 writer.WriteFullSnapshot(); |
6591 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); | 6726 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); |
6592 *isolate_snapshot_size = writer.IsolateSnapshotSize(); | 6727 *isolate_snapshot_size = writer.IsolateSnapshotSize(); |
6593 *instructions_blob_size = instructions_writer.InstructionsBlobSize(); | 6728 *instructions_blob_size = instructions_writer.InstructionsBlobSize(); |
6594 *rodata_blob_size = instructions_writer.RodataBlobSize(); | 6729 *rodata_blob_size = instructions_writer.RodataBlobSize(); |
6595 | 6730 |
6596 return Api::Success(); | 6731 return Api::Success(); |
6597 #endif | 6732 #endif |
6598 } | 6733 } |
6599 #endif // DART_PRECOMPILER | |
6600 | 6734 |
6601 | 6735 |
6602 DART_EXPORT Dart_Handle Dart_PrecompileJIT() { | 6736 DART_EXPORT Dart_Handle Dart_PrecompileJIT() { |
6603 API_TIMELINE_BEGIN_END; | 6737 API_TIMELINE_BEGIN_END; |
6604 DARTSCOPE(Thread::Current()); | 6738 DARTSCOPE(Thread::Current()); |
6605 Isolate* I = T->isolate(); | 6739 Isolate* I = T->isolate(); |
6606 Dart_Handle result = Api::CheckAndFinalizePendingClasses(T); | 6740 Dart_Handle result = Api::CheckAndFinalizePendingClasses(T); |
6607 if (::Dart_IsError(result)) { | 6741 if (::Dart_IsError(result)) { |
6608 return result; | 6742 return result; |
6609 } | 6743 } |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6711 } | 6845 } |
6712 | 6846 |
6713 | 6847 |
6714 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) { | 6848 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) { |
6715 #ifndef PRODUCT | 6849 #ifndef PRODUCT |
6716 Profiler::DumpStackTrace(context); | 6850 Profiler::DumpStackTrace(context); |
6717 #endif | 6851 #endif |
6718 } | 6852 } |
6719 | 6853 |
6720 } // namespace dart | 6854 } // namespace dart |
OLD | NEW |