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

Unified Diff: runtime/vm/object.cc

Issue 1938653002: JIT precompilated snapshots. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 7d8acc3f24611b2e22085ac1ab08831a58dcee79..1e78ab07d260c2aafb5049b5759bd5c6a008a8b3 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -3426,7 +3426,7 @@ TokenPosition Class::ComputeEndTokenPos() const {
ASSERT(!scr.IsNull());
const TokenStream& tkns = TokenStream::Handle(scr.tokens());
if (tkns.IsNull()) {
- ASSERT(Dart::IsRunningPrecompiledCode());
+ ASSERT(Dart::snapshot_kind() == Snapshot::kAppNoJIT);
return TokenPosition::kNoSource;
}
TokenStream::Iterator tkit(tkns,
@@ -8822,7 +8822,7 @@ RawString* Script::Source() const {
RawString* Script::GenerateSource() const {
const TokenStream& token_stream = TokenStream::Handle(tokens());
if (token_stream.IsNull()) {
- ASSERT(Dart::IsRunningPrecompiledCode());
+ ASSERT(Dart::snapshot_kind() == Snapshot::kAppNoJIT);
return String::null();
}
return token_stream.GenerateSource();
@@ -8991,7 +8991,7 @@ void Script::GetTokenLocation(TokenPosition token_pos,
ASSERT(line != NULL);
const TokenStream& tkns = TokenStream::Handle(tokens());
if (tkns.IsNull()) {
- ASSERT(Dart::IsRunningPrecompiledCode());
+ ASSERT(Dart::snapshot_kind() == Snapshot::kAppNoJIT);
*line = -1;
if (column != NULL) {
*column = -1;
@@ -9090,7 +9090,7 @@ void Script::TokenRangeAtLine(intptr_t line_number,
RawString* Script::GetLine(intptr_t line_number, Heap::Space space) const {
const String& src = String::Handle(Source());
if (src.IsNull()) {
- ASSERT(Dart::IsRunningPrecompiledCode());
+ ASSERT(Dart::snapshot_kind() == Snapshot::kAppNoJIT);
return Symbols::OptimizedOut().raw();
}
intptr_t relative_line_number = line_number - line_offset();
@@ -9132,7 +9132,7 @@ RawString* Script::GetSnippet(intptr_t from_line,
intptr_t to_column) const {
const String& src = String::Handle(Source());
if (src.IsNull()) {
- ASSERT(Dart::IsRunningPrecompiledCode());
+ ASSERT(Dart::snapshot_kind() == Snapshot::kAppNoJIT);
return Symbols::OptimizedOut().raw();
}
intptr_t length = src.Length();
@@ -10981,7 +10981,7 @@ bool LibraryPrefix::LoadLibrary() const {
}
ASSERT(is_deferred_load());
ASSERT(num_imports() == 1);
- if (Dart::IsRunningPrecompiledCode()) {
+ if (Dart::snapshot_kind() == Snapshot::kAppNoJIT) {
// The library list was tree-shaken away.
this->set_is_loaded();
return true;
@@ -13525,26 +13525,6 @@ void Code::set_static_calls_target_table(const Array& value) const {
}
-uword Code::EntryPoint() const {
- RawObject* instr = instructions();
- if (!instr->IsHeapObject()) {
- return active_entry_point();
- } else {
- return Instructions::EntryPoint(instructions());
- }
-}
-
-
-intptr_t Code::Size() const {
- RawObject* instr = instructions();
- if (!instr->IsHeapObject()) {
- return Smi::Value(raw_ptr()->precompiled_instructions_size_);
- } else {
- return instructions()->ptr()->size_;
- }
-}
-
-
bool Code::HasBreakpoint() const {
if (!FLAG_support_debugger) {
return false;
@@ -13570,7 +13550,7 @@ RawTypedData* Code::GetDeoptInfoAtPc(uword pc,
uword code_entry = instrs.EntryPoint();
const Array& table = Array::Handle(deopt_info_array());
if (table.IsNull()) {
- ASSERT(Dart::IsRunningPrecompiledCode());
+ ASSERT(Dart::snapshot_kind() == Snapshot::kAppNoJIT);
return TypedData::null();
}
// Linear search for the PC offset matching the target PC.
@@ -13890,13 +13870,10 @@ RawCode* Code::FinalizeCode(const char* name,
}
// Hook up Code and Instructions objects.
- code.set_instructions(instrs.raw());
code.SetActiveInstructions(instrs.raw());
+ code.set_instructions(instrs.raw());
code.set_is_alive(true);
- ASSERT(code.EntryPoint() == instrs.EntryPoint());
- ASSERT(code.Size() == instrs.size());
-
// Set object pool in Instructions object.
INC_STAT(Thread::Current(),
total_code_size, object_pool.Length() * sizeof(uintptr_t));
@@ -14099,10 +14076,9 @@ bool Code::IsFunctionCode() const {
void Code::DisableDartCode() const {
DEBUG_ASSERT(IsMutatorOrAtSafepoint());
ASSERT(IsFunctionCode());
- ASSERT(!IsDisabled());
+ ASSERT(instructions() == active_instructions());
const Code& new_code =
Code::Handle(StubCode::FixCallersTarget_entry()->code());
- ASSERT(new_code.instructions()->IsVMHeapObject());
SetActiveInstructions(new_code.instructions());
}
@@ -14111,10 +14087,9 @@ void Code::DisableStubCode() const {
#if !defined(TARGET_ARCH_DBC)
ASSERT(Thread::Current()->IsMutatorThread());
ASSERT(IsAllocationStubCode());
- ASSERT(!IsDisabled());
+ ASSERT(instructions() == active_instructions());
const Code& new_code =
Code::Handle(StubCode::FixAllocationStubTarget_entry()->code());
- ASSERT(new_code.instructions()->IsVMHeapObject());
SetActiveInstructions(new_code.instructions());
#else
// DBC does not use allocation stubs.
@@ -14127,6 +14102,7 @@ void Code::SetActiveInstructions(RawInstructions* instructions) const {
DEBUG_ASSERT(IsMutatorOrAtSafepoint() || !is_alive());
// RawInstructions are never allocated in New space and hence a
// store buffer update is not needed here.
+ StorePointer(&raw_ptr()->active_instructions_, instructions);
StoreNonPointer(&raw_ptr()->entry_point_,
reinterpret_cast<uword>(instructions->ptr()) +
Instructions::HeaderSize());

Powered by Google App Engine
This is Rietveld 408576698