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

Side by Side Diff: runtime/vm/object.cc

Issue 2580823003: Rename snapshot kind enum values kAppWithJIT -> kAppJIT, kAppNoJIT -> kAppAOT. (Closed)
Patch Set: Created 4 years 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 | « runtime/vm/megamorphic_cache_table.cc ('k') | runtime/vm/object_store.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 (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/become.h" 10 #include "vm/become.h"
(...skipping 3423 matching lines...) Expand 10 before | Expand all | Expand 10 after
3434 TokenPosition Class::ComputeEndTokenPos() const { 3434 TokenPosition Class::ComputeEndTokenPos() const {
3435 // Return the begin token for synthetic classes. 3435 // Return the begin token for synthetic classes.
3436 if (is_synthesized_class() || IsMixinApplication() || IsTopLevel()) { 3436 if (is_synthesized_class() || IsMixinApplication() || IsTopLevel()) {
3437 return token_pos(); 3437 return token_pos();
3438 } 3438 }
3439 Zone* zone = Thread::Current()->zone(); 3439 Zone* zone = Thread::Current()->zone();
3440 const Script& scr = Script::Handle(zone, script()); 3440 const Script& scr = Script::Handle(zone, script());
3441 ASSERT(!scr.IsNull()); 3441 ASSERT(!scr.IsNull());
3442 const TokenStream& tkns = TokenStream::Handle(zone, scr.tokens()); 3442 const TokenStream& tkns = TokenStream::Handle(zone, scr.tokens());
3443 if (tkns.IsNull()) { 3443 if (tkns.IsNull()) {
3444 ASSERT(Dart::snapshot_kind() == Snapshot::kAppNoJIT); 3444 ASSERT(Dart::snapshot_kind() == Snapshot::kAppAOT);
3445 return TokenPosition::kNoSource; 3445 return TokenPosition::kNoSource;
3446 } 3446 }
3447 TokenStream::Iterator tkit(zone, tkns, token_pos(), 3447 TokenStream::Iterator tkit(zone, tkns, token_pos(),
3448 TokenStream::Iterator::kNoNewlines); 3448 TokenStream::Iterator::kNoNewlines);
3449 intptr_t level = 0; 3449 intptr_t level = 0;
3450 while (tkit.CurrentTokenKind() != Token::kEOS) { 3450 while (tkit.CurrentTokenKind() != Token::kEOS) {
3451 if (tkit.CurrentTokenKind() == Token::kLBRACE) { 3451 if (tkit.CurrentTokenKind() == Token::kLBRACE) {
3452 level++; 3452 level++;
3453 } else if (tkit.CurrentTokenKind() == Token::kRBRACE) { 3453 } else if (tkit.CurrentTokenKind() == Token::kRBRACE) {
3454 if (--level == 0) { 3454 if (--level == 0) {
(...skipping 4070 matching lines...) Expand 10 before | Expand all | Expand 10 after
7525 } 7525 }
7526 7526
7527 7527
7528 RawString* Field::InitializingExpression() const { 7528 RawString* Field::InitializingExpression() const {
7529 Thread* thread = Thread::Current(); 7529 Thread* thread = Thread::Current();
7530 Zone* zone = thread->zone(); 7530 Zone* zone = thread->zone();
7531 const class Script& scr = Script::Handle(zone, Script()); 7531 const class Script& scr = Script::Handle(zone, Script());
7532 ASSERT(!scr.IsNull()); 7532 ASSERT(!scr.IsNull());
7533 const TokenStream& tkns = TokenStream::Handle(zone, scr.tokens()); 7533 const TokenStream& tkns = TokenStream::Handle(zone, scr.tokens());
7534 if (tkns.IsNull()) { 7534 if (tkns.IsNull()) {
7535 ASSERT(Dart::snapshot_kind() == Snapshot::kAppNoJIT); 7535 ASSERT(Dart::snapshot_kind() == Snapshot::kAppAOT);
7536 return String::null(); 7536 return String::null();
7537 } 7537 }
7538 TokenStream::Iterator tkit(zone, tkns, token_pos()); 7538 TokenStream::Iterator tkit(zone, tkns, token_pos());
7539 ASSERT(Token::IsIdentifier(tkit.CurrentTokenKind())); 7539 ASSERT(Token::IsIdentifier(tkit.CurrentTokenKind()));
7540 #if defined(DEBUG) 7540 #if defined(DEBUG)
7541 const String& literal = String::Handle(zone, tkit.CurrentLiteral()); 7541 const String& literal = String::Handle(zone, tkit.CurrentLiteral());
7542 ASSERT(literal.raw() == name()); 7542 ASSERT(literal.raw() == name());
7543 #endif 7543 #endif
7544 tkit.Advance(); 7544 tkit.Advance();
7545 if (tkit.CurrentTokenKind() != Token::kASSIGN) { 7545 if (tkit.CurrentTokenKind() != Token::kASSIGN) {
(...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after
8673 if (source.IsNull()) { 8673 if (source.IsNull()) {
8674 return GenerateSource(); 8674 return GenerateSource();
8675 } 8675 }
8676 return raw_ptr()->source_; 8676 return raw_ptr()->source_;
8677 } 8677 }
8678 8678
8679 8679
8680 RawString* Script::GenerateSource() const { 8680 RawString* Script::GenerateSource() const {
8681 const TokenStream& token_stream = TokenStream::Handle(tokens()); 8681 const TokenStream& token_stream = TokenStream::Handle(tokens());
8682 if (token_stream.IsNull()) { 8682 if (token_stream.IsNull()) {
8683 ASSERT(Dart::snapshot_kind() == Snapshot::kAppNoJIT); 8683 ASSERT(Dart::snapshot_kind() == Snapshot::kAppAOT);
8684 return String::null(); 8684 return String::null();
8685 } 8685 }
8686 return token_stream.GenerateSource(); 8686 return token_stream.GenerateSource();
8687 } 8687 }
8688 8688
8689 8689
8690 void Script::set_compile_time_constants(const Array& value) const { 8690 void Script::set_compile_time_constants(const Array& value) const {
8691 StorePointer(&raw_ptr()->compile_time_constants_, value.raw()); 8691 StorePointer(&raw_ptr()->compile_time_constants_, value.raw());
8692 } 8692 }
8693 8693
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
8900 smi ^= line_starts_array.At(min); 8900 smi ^= line_starts_array.At(min);
8901 *column = offset - smi.Value() + 1; 8901 *column = offset - smi.Value() + 1;
8902 if (token_len != NULL) { 8902 if (token_len != NULL) {
8903 *token_len = 1; 8903 *token_len = 1;
8904 } 8904 }
8905 return; 8905 return;
8906 } 8906 }
8907 8907
8908 const TokenStream& tkns = TokenStream::Handle(zone, tokens()); 8908 const TokenStream& tkns = TokenStream::Handle(zone, tokens());
8909 if (tkns.IsNull()) { 8909 if (tkns.IsNull()) {
8910 ASSERT((Dart::snapshot_kind() == Snapshot::kAppNoJIT)); 8910 ASSERT((Dart::snapshot_kind() == Snapshot::kAppAOT));
8911 *line = -1; 8911 *line = -1;
8912 if (column != NULL) { 8912 if (column != NULL) {
8913 *column = -1; 8913 *column = -1;
8914 } 8914 }
8915 if (token_len != NULL) { 8915 if (token_len != NULL) {
8916 *token_len = 1; 8916 *token_len = 1;
8917 } 8917 }
8918 return; 8918 return;
8919 } 8919 }
8920 if (column == NULL) { 8920 if (column == NULL) {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
8998 end_pos = tkit.CurrentPosition(); 8998 end_pos = tkit.CurrentPosition();
8999 tkit.Advance(); 8999 tkit.Advance();
9000 } 9000 }
9001 *last_token_index = end_pos; 9001 *last_token_index = end_pos;
9002 } 9002 }
9003 9003
9004 9004
9005 RawString* Script::GetLine(intptr_t line_number, Heap::Space space) const { 9005 RawString* Script::GetLine(intptr_t line_number, Heap::Space space) const {
9006 const String& src = String::Handle(Source()); 9006 const String& src = String::Handle(Source());
9007 if (src.IsNull()) { 9007 if (src.IsNull()) {
9008 ASSERT(Dart::snapshot_kind() == Snapshot::kAppNoJIT); 9008 ASSERT(Dart::snapshot_kind() == Snapshot::kAppAOT);
9009 return Symbols::OptimizedOut().raw(); 9009 return Symbols::OptimizedOut().raw();
9010 } 9010 }
9011 intptr_t relative_line_number = line_number - line_offset(); 9011 intptr_t relative_line_number = line_number - line_offset();
9012 intptr_t current_line = 1; 9012 intptr_t current_line = 1;
9013 intptr_t line_start_idx = -1; 9013 intptr_t line_start_idx = -1;
9014 intptr_t last_char_idx = -1; 9014 intptr_t last_char_idx = -1;
9015 for (intptr_t ix = 0; 9015 for (intptr_t ix = 0;
9016 (ix < src.Length()) && (current_line <= relative_line_number); ix++) { 9016 (ix < src.Length()) && (current_line <= relative_line_number); ix++) {
9017 if ((current_line == relative_line_number) && (line_start_idx < 0)) { 9017 if ((current_line == relative_line_number) && (line_start_idx < 0)) {
9018 line_start_idx = ix; 9018 line_start_idx = ix;
(...skipping 29 matching lines...) Expand all
9048 return GetSnippet(from_line, from_column, to_line, to_column); 9048 return GetSnippet(from_line, from_column, to_line, to_column);
9049 } 9049 }
9050 9050
9051 9051
9052 RawString* Script::GetSnippet(intptr_t from_line, 9052 RawString* Script::GetSnippet(intptr_t from_line,
9053 intptr_t from_column, 9053 intptr_t from_column,
9054 intptr_t to_line, 9054 intptr_t to_line,
9055 intptr_t to_column) const { 9055 intptr_t to_column) const {
9056 const String& src = String::Handle(Source()); 9056 const String& src = String::Handle(Source());
9057 if (src.IsNull()) { 9057 if (src.IsNull()) {
9058 ASSERT(Dart::snapshot_kind() == Snapshot::kAppNoJIT); 9058 ASSERT(Dart::snapshot_kind() == Snapshot::kAppAOT);
9059 return Symbols::OptimizedOut().raw(); 9059 return Symbols::OptimizedOut().raw();
9060 } 9060 }
9061 intptr_t length = src.Length(); 9061 intptr_t length = src.Length();
9062 intptr_t line = 1 + line_offset(); 9062 intptr_t line = 1 + line_offset();
9063 intptr_t column = 1; 9063 intptr_t column = 1;
9064 intptr_t scan_position = 0; 9064 intptr_t scan_position = 0;
9065 intptr_t snippet_start = -1; 9065 intptr_t snippet_start = -1;
9066 intptr_t snippet_end = -1; 9066 intptr_t snippet_end = -1;
9067 if (from_line - line_offset() == 1) { 9067 if (from_line - line_offset() == 1) {
9068 column += col_offset(); 9068 column += col_offset();
(...skipping 1893 matching lines...) Expand 10 before | Expand all | Expand 10 after
10962 10962
10963 10963
10964 bool LibraryPrefix::LoadLibrary() const { 10964 bool LibraryPrefix::LoadLibrary() const {
10965 // Non-deferred prefixes are loaded. 10965 // Non-deferred prefixes are loaded.
10966 ASSERT(is_deferred_load() || is_loaded()); 10966 ASSERT(is_deferred_load() || is_loaded());
10967 if (is_loaded()) { 10967 if (is_loaded()) {
10968 return true; // Load request has already completed. 10968 return true; // Load request has already completed.
10969 } 10969 }
10970 ASSERT(is_deferred_load()); 10970 ASSERT(is_deferred_load());
10971 ASSERT(num_imports() == 1); 10971 ASSERT(num_imports() == 1);
10972 if (Dart::snapshot_kind() == Snapshot::kAppNoJIT) { 10972 if (Dart::snapshot_kind() == Snapshot::kAppAOT) {
10973 // The library list was tree-shaken away. 10973 // The library list was tree-shaken away.
10974 this->set_is_loaded(); 10974 this->set_is_loaded();
10975 return true; 10975 return true;
10976 } 10976 }
10977 // This is a prefix for a deferred library. If the library is not loaded 10977 // This is a prefix for a deferred library. If the library is not loaded
10978 // yet and isn't being loaded, call the library tag handler to schedule 10978 // yet and isn't being loaded, call the library tag handler to schedule
10979 // loading. Once all outstanding load requests have completed, the embedder 10979 // loading. Once all outstanding load requests have completed, the embedder
10980 // will call the core library to: 10980 // will call the core library to:
10981 // - invalidate dependent code of this prefix; 10981 // - invalidate dependent code of this prefix;
10982 // - mark this prefixes as loaded; 10982 // - mark this prefixes as loaded;
(...skipping 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after
12568 const intptr_t num_checks = NumberOfChecks(); 12568 const intptr_t num_checks = NumberOfChecks();
12569 return OS::SCreate(Thread::Current()->zone(), 12569 return OS::SCreate(Thread::Current()->zone(),
12570 "ICData target:'%s' num-args: %" Pd " num-checks: %" Pd "", 12570 "ICData target:'%s' num-args: %" Pd " num-checks: %" Pd "",
12571 name.ToCString(), num_args, num_checks); 12571 name.ToCString(), num_args, num_checks);
12572 } 12572 }
12573 12573
12574 12574
12575 RawFunction* ICData::Owner() const { 12575 RawFunction* ICData::Owner() const {
12576 Object& obj = Object::Handle(raw_ptr()->owner_); 12576 Object& obj = Object::Handle(raw_ptr()->owner_);
12577 if (obj.IsNull()) { 12577 if (obj.IsNull()) {
12578 ASSERT(Dart::snapshot_kind() == Snapshot::kAppNoJIT); 12578 ASSERT(Dart::snapshot_kind() == Snapshot::kAppAOT);
12579 return Function::null(); 12579 return Function::null();
12580 } else if (obj.IsFunction()) { 12580 } else if (obj.IsFunction()) {
12581 return Function::Cast(obj).raw(); 12581 return Function::Cast(obj).raw();
12582 } else { 12582 } else {
12583 ICData& original = ICData::Handle(); 12583 ICData& original = ICData::Handle();
12584 original ^= obj.raw(); 12584 original ^= obj.raw();
12585 return original.Owner(); 12585 return original.Owner();
12586 } 12586 }
12587 } 12587 }
12588 12588
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after
13758 13758
13759 13759
13760 RawTypedData* Code::GetDeoptInfoAtPc(uword pc, 13760 RawTypedData* Code::GetDeoptInfoAtPc(uword pc,
13761 ICData::DeoptReasonId* deopt_reason, 13761 ICData::DeoptReasonId* deopt_reason,
13762 uint32_t* deopt_flags) const { 13762 uint32_t* deopt_flags) const {
13763 ASSERT(is_optimized()); 13763 ASSERT(is_optimized());
13764 const Instructions& instrs = Instructions::Handle(instructions()); 13764 const Instructions& instrs = Instructions::Handle(instructions());
13765 uword code_entry = instrs.PayloadStart(); 13765 uword code_entry = instrs.PayloadStart();
13766 const Array& table = Array::Handle(deopt_info_array()); 13766 const Array& table = Array::Handle(deopt_info_array());
13767 if (table.IsNull()) { 13767 if (table.IsNull()) {
13768 ASSERT(Dart::snapshot_kind() == Snapshot::kAppNoJIT); 13768 ASSERT(Dart::snapshot_kind() == Snapshot::kAppAOT);
13769 return TypedData::null(); 13769 return TypedData::null();
13770 } 13770 }
13771 // Linear search for the PC offset matching the target PC. 13771 // Linear search for the PC offset matching the target PC.
13772 intptr_t length = DeoptTable::GetLength(table); 13772 intptr_t length = DeoptTable::GetLength(table);
13773 Smi& offset = Smi::Handle(); 13773 Smi& offset = Smi::Handle();
13774 Smi& reason_and_flags = Smi::Handle(); 13774 Smi& reason_and_flags = Smi::Handle();
13775 TypedData& info = TypedData::Handle(); 13775 TypedData& info = TypedData::Handle();
13776 for (intptr_t i = 0; i < length; ++i) { 13776 for (intptr_t i = 0; i < length; ++i) {
13777 DeoptTable::GetEntry(table, i, &offset, &info, &reason_and_flags); 13777 DeoptTable::GetEntry(table, i, &offset, &info, &reason_and_flags);
13778 if (pc == (code_entry + offset.Value())) { 13778 if (pc == (code_entry + offset.Value())) {
(...skipping 8986 matching lines...) Expand 10 before | Expand all | Expand 10 after
22765 return UserTag::null(); 22765 return UserTag::null();
22766 } 22766 }
22767 22767
22768 22768
22769 const char* UserTag::ToCString() const { 22769 const char* UserTag::ToCString() const {
22770 const String& tag_label = String::Handle(label()); 22770 const String& tag_label = String::Handle(label());
22771 return tag_label.ToCString(); 22771 return tag_label.ToCString();
22772 } 22772 }
22773 22773
22774 } // namespace dart 22774 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/megamorphic_cache_table.cc ('k') | runtime/vm/object_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698