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

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

Issue 1752503002: Change function source fingerprint calculation to rely on tokens exclusively and (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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 | « runtime/vm/method_recognizer.h ('k') | runtime/vm/object_test.cc » ('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/cpu.h" 10 #include "vm/cpu.h"
(...skipping 6733 matching lines...) Expand 10 before | Expand all | Expand 10 after
6744 const String& result = String::Handle(func_script.GetSnippet( 6744 const String& result = String::Handle(func_script.GetSnippet(
6745 from_line, from_col, to_line, to_col + last_tok_len)); 6745 from_line, from_col, to_line, to_col + last_tok_len));
6746 ASSERT(!result.IsNull()); 6746 ASSERT(!result.IsNull());
6747 return result.raw(); 6747 return result.raw();
6748 } 6748 }
6749 6749
6750 6750
6751 // Construct fingerprint from token stream. The token stream contains also 6751 // Construct fingerprint from token stream. The token stream contains also
6752 // arguments. 6752 // arguments.
6753 int32_t Function::SourceFingerprint() const { 6753 int32_t Function::SourceFingerprint() const {
6754 uint32_t result = IsImplicitClosureFunction() 6754 uint32_t result = 0;
6755 ? String::Handle(Function::Handle(parent_function()).Signature()).Hash()
6756 : String::Handle(Signature()).Hash();
6757 TokenStream::Iterator tokens_iterator(TokenStream::Handle( 6755 TokenStream::Iterator tokens_iterator(TokenStream::Handle(
6758 Script::Handle(script()).tokens()), token_pos()); 6756 Script::Handle(script()).tokens()), token_pos());
6759 Object& obj = Object::Handle(); 6757 Object& obj = Object::Handle();
6760 String& literal = String::Handle(); 6758 String& literal = String::Handle();
6761 while (tokens_iterator.CurrentPosition() < end_token_pos()) { 6759 while (tokens_iterator.CurrentPosition() < end_token_pos()) {
6762 uint32_t val = 0; 6760 uint32_t val = 0;
6763 obj = tokens_iterator.CurrentToken(); 6761 obj = tokens_iterator.CurrentToken();
6764 if (obj.IsSmi()) { 6762 if (obj.IsSmi()) {
6765 val = Smi::Cast(obj).Value(); 6763 val = Smi::Cast(obj).Value();
6766 } else { 6764 } else {
(...skipping 14913 matching lines...) Expand 10 before | Expand all | Expand 10 after
21680 return UserTag::null(); 21678 return UserTag::null();
21681 } 21679 }
21682 21680
21683 21681
21684 const char* UserTag::ToCString() const { 21682 const char* UserTag::ToCString() const {
21685 const String& tag_label = String::Handle(label()); 21683 const String& tag_label = String::Handle(label());
21686 return tag_label.ToCString(); 21684 return tag_label.ToCString();
21687 } 21685 }
21688 21686
21689 } // namespace dart 21687 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/method_recognizer.h ('k') | runtime/vm/object_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698