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

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

Issue 11893002: Improve compilation speed on a pathological case > 2x (7 sec -> 2.7 sec) by improving local lookups. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object.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/bigint_operations.h" 10 #include "vm/bigint_operations.h"
(...skipping 10162 matching lines...) Expand 10 before | Expand all | Expand 10 after
10173 hash_ += hash_ << 15; 10173 hash_ += hash_ << 15;
10174 hash_ = hash_ & ((static_cast<intptr_t>(1) << bits) - 1); 10174 hash_ = hash_ & ((static_cast<intptr_t>(1) << bits) - 1);
10175 ASSERT(hash_ <= static_cast<uint32_t>(kMaxInt32)); 10175 ASSERT(hash_ <= static_cast<uint32_t>(kMaxInt32));
10176 return hash_ == 0 ? 1 : hash_; 10176 return hash_ == 0 ? 1 : hash_;
10177 } 10177 }
10178 private: 10178 private:
10179 uint32_t hash_; 10179 uint32_t hash_;
10180 }; 10180 };
10181 10181
10182 10182
10183 intptr_t String::Hash() const {
10184 intptr_t result = Smi::Value(raw_ptr()->hash_);
10185 if (result != 0) {
10186 return result;
10187 }
10188 result = String::Hash(*this, 0, this->Length());
10189 this->SetHash(result);
10190 return result;
10191 }
10192
10193
10194 intptr_t String::Hash(const String& str, intptr_t begin_index, intptr_t len) { 10183 intptr_t String::Hash(const String& str, intptr_t begin_index, intptr_t len) {
10195 ASSERT(begin_index >= 0); 10184 ASSERT(begin_index >= 0);
10196 ASSERT(len >= 0); 10185 ASSERT(len >= 0);
10197 ASSERT((begin_index + len) <= str.Length()); 10186 ASSERT((begin_index + len) <= str.Length());
10198 StringHasher hasher; 10187 StringHasher hasher;
10199 CodePointIterator it(str, begin_index, len); 10188 CodePointIterator it(str, begin_index, len);
10200 while (it.Next()) { 10189 while (it.Next()) {
10201 hasher.Add(it.Current()); 10190 hasher.Add(it.Current());
10202 } 10191 }
10203 return hasher.Finalize(String::kHashBits); 10192 return hasher.Finalize(String::kHashBits);
(...skipping 2292 matching lines...) Expand 10 before | Expand all | Expand 10 after
12496 } 12485 }
12497 return result.raw(); 12486 return result.raw();
12498 } 12487 }
12499 12488
12500 12489
12501 const char* WeakProperty::ToCString() const { 12490 const char* WeakProperty::ToCString() const {
12502 return "_WeakProperty"; 12491 return "_WeakProperty";
12503 } 12492 }
12504 12493
12505 } // namespace dart 12494 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/object_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698