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" | |
40 #include "vm/resolver.h" | 39 #include "vm/resolver.h" |
41 #include "vm/reusable_handles.h" | 40 #include "vm/reusable_handles.h" |
42 #include "vm/service_event.h" | 41 #include "vm/service_event.h" |
43 #include "vm/service_isolate.h" | 42 #include "vm/service_isolate.h" |
44 #include "vm/service.h" | 43 #include "vm/service.h" |
45 #include "vm/stack_frame.h" | 44 #include "vm/stack_frame.h" |
46 #include "vm/symbols.h" | 45 #include "vm/symbols.h" |
47 #include "vm/tags.h" | 46 #include "vm/tags.h" |
48 #include "vm/thread_registry.h" | 47 #include "vm/thread_registry.h" |
49 #include "vm/timeline.h" | 48 #include "vm/timeline.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 } while (false) | 105 } while (false) |
107 #define API_TIMELINE_BEGIN_END \ | 106 #define API_TIMELINE_BEGIN_END \ |
108 do { \ | 107 do { \ |
109 } while (false) | 108 } while (false) |
110 #endif // !PRODUCT | 109 #endif // !PRODUCT |
111 | 110 |
112 #if defined(DEBUG) | 111 #if defined(DEBUG) |
113 // An object visitor which will iterate over all the function objects in the | 112 // An object visitor which will iterate over all the function objects in the |
114 // heap and check if the result type and parameter types are canonicalized | 113 // heap and check if the result type and parameter types are canonicalized |
115 // or not. An assertion is raised if a type is not canonicalized. | 114 // or not. An assertion is raised if a type is not canonicalized. |
116 class CheckFunctionTypesVisitor : public ObjectVisitor { | 115 class FunctionVisitor : public ObjectVisitor { |
117 public: | 116 public: |
118 explicit CheckFunctionTypesVisitor(Thread* thread) | 117 explicit FunctionVisitor(Thread* thread) |
119 : classHandle_(Class::Handle(thread->zone())), | 118 : classHandle_(Class::Handle(thread->zone())), |
120 funcHandle_(Function::Handle(thread->zone())), | 119 funcHandle_(Function::Handle(thread->zone())), |
121 typeHandle_(AbstractType::Handle(thread->zone())) {} | 120 typeHandle_(AbstractType::Handle(thread->zone())) {} |
122 | 121 |
123 void VisitObject(RawObject* obj) { | 122 void VisitObject(RawObject* obj) { |
124 if (obj->IsFunction()) { | 123 if (obj->IsFunction()) { |
125 funcHandle_ ^= obj; | 124 funcHandle_ ^= obj; |
126 classHandle_ ^= funcHandle_.Owner(); | 125 classHandle_ ^= funcHandle_.Owner(); |
127 // Verify that the result type of a function is canonical or a | 126 // Verify that the result type of a function is canonical or a |
128 // TypeParameter. | 127 // TypeParameter. |
(...skipping 1437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1566 } | 1565 } |
1567 // Finalize all classes if needed. | 1566 // Finalize all classes if needed. |
1568 Dart_Handle state = Api::CheckAndFinalizePendingClasses(T); | 1567 Dart_Handle state = Api::CheckAndFinalizePendingClasses(T); |
1569 if (::Dart_IsError(state)) { | 1568 if (::Dart_IsError(state)) { |
1570 return state; | 1569 return state; |
1571 } | 1570 } |
1572 I->StopBackgroundCompiler(); | 1571 I->StopBackgroundCompiler(); |
1573 | 1572 |
1574 #if defined(DEBUG) | 1573 #if defined(DEBUG) |
1575 I->heap()->CollectAllGarbage(); | 1574 I->heap()->CollectAllGarbage(); |
1576 CheckFunctionTypesVisitor check_canonical(T); | 1575 FunctionVisitor check_canonical(T); |
1577 I->heap()->IterateObjects(&check_canonical); | 1576 I->heap()->IterateObjects(&check_canonical); |
1578 #endif // #if defined(DEBUG) | 1577 #endif // #if defined(DEBUG) |
1579 | 1578 |
1580 FullSnapshotWriter writer(Snapshot::kCore, vm_isolate_snapshot_buffer, | 1579 FullSnapshotWriter writer(Snapshot::kCore, vm_isolate_snapshot_buffer, |
1581 isolate_snapshot_buffer, ApiReallocate, | 1580 isolate_snapshot_buffer, ApiReallocate, |
1582 NULL /* instructions_writer */); | 1581 NULL /* instructions_writer */); |
1583 writer.WriteFullSnapshot(); | 1582 writer.WriteFullSnapshot(); |
1584 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); | 1583 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); |
1585 *isolate_snapshot_size = writer.IsolateSnapshotSize(); | 1584 *isolate_snapshot_size = writer.IsolateSnapshotSize(); |
1586 return Api::Success(); | 1585 return Api::Success(); |
(...skipping 18 matching lines...) Expand all Loading... |
1605 } | 1604 } |
1606 Library& lib = Library::Handle(Z); | 1605 Library& lib = Library::Handle(Z); |
1607 if (library == Dart_Null()) { | 1606 if (library == Dart_Null()) { |
1608 lib ^= I->object_store()->root_library(); | 1607 lib ^= I->object_store()->root_library(); |
1609 } else { | 1608 } else { |
1610 lib ^= Api::UnwrapHandle(library); | 1609 lib ^= Api::UnwrapHandle(library); |
1611 } | 1610 } |
1612 | 1611 |
1613 #if defined(DEBUG) | 1612 #if defined(DEBUG) |
1614 I->heap()->CollectAllGarbage(); | 1613 I->heap()->CollectAllGarbage(); |
1615 CheckFunctionTypesVisitor check_canonical(T); | 1614 FunctionVisitor check_canonical(T); |
1616 I->heap()->IterateObjects(&check_canonical); | 1615 I->heap()->IterateObjects(&check_canonical); |
1617 #endif // #if defined(DEBUG) | 1616 #endif // #if defined(DEBUG) |
1618 | 1617 |
1619 ScriptSnapshotWriter writer(buffer, ApiReallocate); | 1618 ScriptSnapshotWriter writer(buffer, ApiReallocate); |
1620 writer.WriteScriptSnapshot(lib); | 1619 writer.WriteScriptSnapshot(lib); |
1621 *size = writer.BytesWritten(); | 1620 *size = writer.BytesWritten(); |
1622 return Api::Success(); | 1621 return Api::Success(); |
1623 } | 1622 } |
1624 | 1623 |
1625 | 1624 |
(...skipping 4794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6420 DART_EXPORT void Dart_SetThreadName(const char* name) { | 6419 DART_EXPORT void Dart_SetThreadName(const char* name) { |
6421 OSThread* thread = OSThread::Current(); | 6420 OSThread* thread = OSThread::Current(); |
6422 if (thread == NULL) { | 6421 if (thread == NULL) { |
6423 // VM is shutting down. | 6422 // VM is shutting down. |
6424 return; | 6423 return; |
6425 } | 6424 } |
6426 thread->SetName(name); | 6425 thread->SetName(name); |
6427 } | 6426 } |
6428 | 6427 |
6429 | 6428 |
6430 DART_EXPORT | 6429 // The precompiler is included in dart_bootstrap and dart_noopt, and |
6431 Dart_Handle Dart_SaveJITFeedback(uint8_t** buffer, intptr_t* buffer_length) { | 6430 // excluded from dart and dart_precompiled_runtime. |
6432 #if defined(DART_PRECOMPILED_RUNTIME) | 6431 #if !defined(DART_PRECOMPILER) |
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(); | |
6442 | 6432 |
6443 if (buffer == NULL) { | 6433 DART_EXPORT Dart_Handle |
6444 RETURN_NULL_ERROR(buffer); | 6434 Dart_Precompile(Dart_QualifiedFunctionName entry_points[], bool reset_fields) { |
6445 } | 6435 return Api::NewError( |
6446 if (buffer_length == NULL) { | 6436 "This VM was built without support for AOT compilation."); |
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 | |
6584 } | 6437 } |
6585 | 6438 |
6586 | 6439 |
6587 DART_EXPORT Dart_Handle | 6440 DART_EXPORT Dart_Handle |
6588 Dart_Precompile(Dart_QualifiedFunctionName entry_points[], | 6441 Dart_CreatePrecompiledSnapshotAssembly(uint8_t** assembly_buffer, |
6589 bool reset_fields, | 6442 intptr_t* assembly_size) { |
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) | |
6597 return Api::NewError( | 6443 return Api::NewError( |
6598 "This VM was built without support for AOT compilation."); | 6444 "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."); |
6599 #else | 6470 #else |
6600 API_TIMELINE_BEGIN_END; | 6471 API_TIMELINE_BEGIN_END; |
6601 DARTSCOPE(Thread::Current()); | 6472 DARTSCOPE(Thread::Current()); |
6602 if (!FLAG_precompiled_mode) { | 6473 if (!FLAG_precompiled_mode) { |
6603 return Api::NewError("Flag --precompilation was not specified."); | 6474 return Api::NewError("Flag --precompilation was not specified."); |
6604 } | 6475 } |
6605 Dart_Handle result = Api::CheckAndFinalizePendingClasses(T); | 6476 Dart_Handle result = Api::CheckAndFinalizePendingClasses(T); |
6606 if (::Dart_IsError(result)) { | 6477 if (::Dart_IsError(result)) { |
6607 return result; | 6478 return result; |
6608 } | 6479 } |
6609 CHECK_CALLBACK_STATE(T); | 6480 CHECK_CALLBACK_STATE(T); |
6610 const Error& error = Error::Handle(Precompiler::CompileAll( | 6481 const Error& error = |
6611 entry_points, reset_fields, jit_feedback, jit_feedback_length)); | 6482 Error::Handle(Precompiler::CompileAll(entry_points, reset_fields)); |
6612 if (!error.IsNull()) { | 6483 if (!error.IsNull()) { |
6613 return Api::NewHandle(T, error.raw()); | 6484 return Api::NewHandle(T, error.raw()); |
6614 } | 6485 } |
6615 return Api::Success(); | 6486 return Api::Success(); |
6616 #endif | 6487 #endif |
6617 } | 6488 } |
6618 | 6489 |
6619 | 6490 |
6620 DART_EXPORT Dart_Handle | 6491 DART_EXPORT Dart_Handle |
6621 Dart_CreatePrecompiledSnapshotAssembly(uint8_t** assembly_buffer, | 6492 Dart_CreatePrecompiledSnapshotAssembly(uint8_t** assembly_buffer, |
6622 intptr_t* assembly_size) { | 6493 intptr_t* assembly_size) { |
6623 #if defined(TARGET_ARCH_IA32) | 6494 #if defined(TARGET_ARCH_IA32) |
6624 return Api::NewError("AOT compilation is not supported on IA32."); | 6495 return Api::NewError("Precompilation is not supported on IA32."); |
6625 #elif defined(TARGET_ARCH_DBC) | 6496 #elif defined(TARGET_ARCH_DBC) |
6626 return Api::NewError("AOT compilation is not supported on DBC."); | 6497 return Api::NewError("Precompilation is not supported on DBC."); |
6627 #elif !defined(DART_PRECOMPILER) | |
6628 return Api::NewError( | |
6629 "This VM was built without support for AOT compilation."); | |
6630 #else | 6498 #else |
6631 API_TIMELINE_DURATION; | 6499 API_TIMELINE_DURATION; |
6632 DARTSCOPE(Thread::Current()); | 6500 DARTSCOPE(Thread::Current()); |
6633 Isolate* I = T->isolate(); | 6501 Isolate* I = T->isolate(); |
6634 if (I->compilation_allowed()) { | 6502 if (I->compilation_allowed()) { |
6635 return Api::NewError( | 6503 return Api::NewError( |
6636 "Isolate is not precompiled. " | 6504 "Isolate is not precompiled. " |
6637 "Did you forget to call Dart_Precompile?"); | 6505 "Did you forget to call Dart_Precompile?"); |
6638 } | 6506 } |
6639 ASSERT(FLAG_load_deferred_eagerly); | 6507 ASSERT(FLAG_load_deferred_eagerly); |
(...skipping 25 matching lines...) Expand all Loading... |
6665 DART_EXPORT Dart_Handle | 6533 DART_EXPORT Dart_Handle |
6666 Dart_CreatePrecompiledSnapshotBlob(uint8_t** vm_isolate_snapshot_buffer, | 6534 Dart_CreatePrecompiledSnapshotBlob(uint8_t** vm_isolate_snapshot_buffer, |
6667 intptr_t* vm_isolate_snapshot_size, | 6535 intptr_t* vm_isolate_snapshot_size, |
6668 uint8_t** isolate_snapshot_buffer, | 6536 uint8_t** isolate_snapshot_buffer, |
6669 intptr_t* isolate_snapshot_size, | 6537 intptr_t* isolate_snapshot_size, |
6670 uint8_t** instructions_blob_buffer, | 6538 uint8_t** instructions_blob_buffer, |
6671 intptr_t* instructions_blob_size, | 6539 intptr_t* instructions_blob_size, |
6672 uint8_t** rodata_blob_buffer, | 6540 uint8_t** rodata_blob_buffer, |
6673 intptr_t* rodata_blob_size) { | 6541 intptr_t* rodata_blob_size) { |
6674 #if defined(TARGET_ARCH_IA32) | 6542 #if defined(TARGET_ARCH_IA32) |
6675 return Api::NewError("AOT compilation is not supported on IA32."); | 6543 return Api::NewError("Precompilation is not supported on IA32."); |
6676 #elif defined(TARGET_ARCH_DBC) | 6544 #elif defined(TARGET_ARCH_DBC) |
6677 return Api::NewError("AOT compilation is not supported on DBC."); | 6545 return Api::NewError("Precompilation is not supported on DBC."); |
6678 #elif !defined(DART_PRECOMPILER) | |
6679 return Api::NewError( | |
6680 "This VM was built without support for AOT compilation."); | |
6681 #else | 6546 #else |
6682 API_TIMELINE_DURATION; | 6547 API_TIMELINE_DURATION; |
6683 DARTSCOPE(Thread::Current()); | 6548 DARTSCOPE(Thread::Current()); |
6684 Isolate* I = T->isolate(); | 6549 Isolate* I = T->isolate(); |
6685 if (I->compilation_allowed()) { | 6550 if (I->compilation_allowed()) { |
6686 return Api::NewError( | 6551 return Api::NewError( |
6687 "Isolate is not precompiled. " | 6552 "Isolate is not precompiled. " |
6688 "Did you forget to call Dart_Precompile?"); | 6553 "Did you forget to call Dart_Precompile?"); |
6689 } | 6554 } |
6690 ASSERT(FLAG_load_deferred_eagerly); | 6555 ASSERT(FLAG_load_deferred_eagerly); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6724 | 6589 |
6725 writer.WriteFullSnapshot(); | 6590 writer.WriteFullSnapshot(); |
6726 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); | 6591 *vm_isolate_snapshot_size = writer.VmIsolateSnapshotSize(); |
6727 *isolate_snapshot_size = writer.IsolateSnapshotSize(); | 6592 *isolate_snapshot_size = writer.IsolateSnapshotSize(); |
6728 *instructions_blob_size = instructions_writer.InstructionsBlobSize(); | 6593 *instructions_blob_size = instructions_writer.InstructionsBlobSize(); |
6729 *rodata_blob_size = instructions_writer.RodataBlobSize(); | 6594 *rodata_blob_size = instructions_writer.RodataBlobSize(); |
6730 | 6595 |
6731 return Api::Success(); | 6596 return Api::Success(); |
6732 #endif | 6597 #endif |
6733 } | 6598 } |
| 6599 #endif // DART_PRECOMPILER |
6734 | 6600 |
6735 | 6601 |
6736 DART_EXPORT Dart_Handle Dart_PrecompileJIT() { | 6602 DART_EXPORT Dart_Handle Dart_PrecompileJIT() { |
6737 API_TIMELINE_BEGIN_END; | 6603 API_TIMELINE_BEGIN_END; |
6738 DARTSCOPE(Thread::Current()); | 6604 DARTSCOPE(Thread::Current()); |
6739 Isolate* I = T->isolate(); | 6605 Isolate* I = T->isolate(); |
6740 Dart_Handle result = Api::CheckAndFinalizePendingClasses(T); | 6606 Dart_Handle result = Api::CheckAndFinalizePendingClasses(T); |
6741 if (::Dart_IsError(result)) { | 6607 if (::Dart_IsError(result)) { |
6742 return result; | 6608 return result; |
6743 } | 6609 } |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6845 } | 6711 } |
6846 | 6712 |
6847 | 6713 |
6848 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) { | 6714 DART_EXPORT void Dart_DumpNativeStackTrace(void* context) { |
6849 #ifndef PRODUCT | 6715 #ifndef PRODUCT |
6850 Profiler::DumpStackTrace(context); | 6716 Profiler::DumpStackTrace(context); |
6851 #endif | 6717 #endif |
6852 } | 6718 } |
6853 | 6719 |
6854 } // namespace dart | 6720 } // namespace dart |
OLD | NEW |