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

Side by Side Diff: src/api.cc

Issue 1149863005: Move hash code from hidden string to a private symbol (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix global object hash code. This eated about 5% of weak collection performance Created 5 years, 7 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 | « no previous file | src/collection.js » ('j') | src/collection.js » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 2514 matching lines...) Expand 10 before | Expand all | Expand 10 after
2525 if (!key->IsJSReceiver() && !key->IsSymbol()) { 2525 if (!key->IsJSReceiver() && !key->IsSymbol()) {
2526 DCHECK(false); 2526 DCHECK(false);
2527 return; 2527 return;
2528 } 2528 }
2529 i::Handle<i::ObjectHashTable> table( 2529 i::Handle<i::ObjectHashTable> table(
2530 i::ObjectHashTable::cast(weak_collection->table())); 2530 i::ObjectHashTable::cast(weak_collection->table()));
2531 if (!table->IsKey(*key)) { 2531 if (!table->IsKey(*key)) {
2532 DCHECK(false); 2532 DCHECK(false);
2533 return; 2533 return;
2534 } 2534 }
2535 i::Runtime::WeakCollectionSet(weak_collection, key, value); 2535 int32_t hash = i::Object::GetOrCreateHash(isolate, key)->value();
2536 i::Runtime::WeakCollectionSet(weak_collection, key, value, hash);
2536 } 2537 }
2537 2538
2538 2539
2539 Local<Value> NativeWeakMap::Get(Handle<Value> v8_key) { 2540 Local<Value> NativeWeakMap::Get(Handle<Value> v8_key) {
2540 i::Handle<i::JSWeakMap> weak_collection = Utils::OpenHandle(this); 2541 i::Handle<i::JSWeakMap> weak_collection = Utils::OpenHandle(this);
2541 i::Isolate* isolate = weak_collection->GetIsolate(); 2542 i::Isolate* isolate = weak_collection->GetIsolate();
2542 ENTER_V8(isolate); 2543 ENTER_V8(isolate);
2543 i::Handle<i::Object> key = Utils::OpenHandle(*v8_key); 2544 i::Handle<i::Object> key = Utils::OpenHandle(*v8_key);
2544 if (!key->IsJSReceiver() && !key->IsSymbol()) { 2545 if (!key->IsJSReceiver() && !key->IsSymbol()) {
2545 DCHECK(false); 2546 DCHECK(false);
(...skipping 5533 matching lines...) Expand 10 before | Expand all | Expand 10 after
8079 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 8080 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
8080 Address callback_address = 8081 Address callback_address =
8081 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8082 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8082 VMState<EXTERNAL> state(isolate); 8083 VMState<EXTERNAL> state(isolate);
8083 ExternalCallbackScope call_scope(isolate, callback_address); 8084 ExternalCallbackScope call_scope(isolate, callback_address);
8084 callback(info); 8085 callback(info);
8085 } 8086 }
8086 8087
8087 8088
8088 } } // namespace v8::internal 8089 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/collection.js » ('j') | src/collection.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698