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

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 merge Created 5 years, 6 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/arm/macro-assembler-arm.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 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 2522 matching lines...) Expand 10 before | Expand all | Expand 10 after
2533 if (!key->IsJSReceiver() && !key->IsSymbol()) { 2533 if (!key->IsJSReceiver() && !key->IsSymbol()) {
2534 DCHECK(false); 2534 DCHECK(false);
2535 return; 2535 return;
2536 } 2536 }
2537 i::Handle<i::ObjectHashTable> table( 2537 i::Handle<i::ObjectHashTable> table(
2538 i::ObjectHashTable::cast(weak_collection->table())); 2538 i::ObjectHashTable::cast(weak_collection->table()));
2539 if (!table->IsKey(*key)) { 2539 if (!table->IsKey(*key)) {
2540 DCHECK(false); 2540 DCHECK(false);
2541 return; 2541 return;
2542 } 2542 }
2543 i::Runtime::WeakCollectionSet(weak_collection, key, value); 2543 int32_t hash = i::Object::GetOrCreateHash(isolate, key)->value();
2544 i::Runtime::WeakCollectionSet(weak_collection, key, value, hash);
2544 } 2545 }
2545 2546
2546 2547
2547 Local<Value> NativeWeakMap::Get(Handle<Value> v8_key) { 2548 Local<Value> NativeWeakMap::Get(Handle<Value> v8_key) {
2548 i::Handle<i::JSWeakMap> weak_collection = Utils::OpenHandle(this); 2549 i::Handle<i::JSWeakMap> weak_collection = Utils::OpenHandle(this);
2549 i::Isolate* isolate = weak_collection->GetIsolate(); 2550 i::Isolate* isolate = weak_collection->GetIsolate();
2550 ENTER_V8(isolate); 2551 ENTER_V8(isolate);
2551 i::Handle<i::Object> key = Utils::OpenHandle(*v8_key); 2552 i::Handle<i::Object> key = Utils::OpenHandle(*v8_key);
2552 if (!key->IsJSReceiver() && !key->IsSymbol()) { 2553 if (!key->IsJSReceiver() && !key->IsSymbol()) {
2553 DCHECK(false); 2554 DCHECK(false);
(...skipping 5554 matching lines...) Expand 10 before | Expand all | Expand 10 after
8108 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 8109 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
8109 Address callback_address = 8110 Address callback_address =
8110 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 8111 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
8111 VMState<EXTERNAL> state(isolate); 8112 VMState<EXTERNAL> state(isolate);
8112 ExternalCallbackScope call_scope(isolate, callback_address); 8113 ExternalCallbackScope call_scope(isolate, callback_address);
8113 callback(info); 8114 callback(info);
8114 } 8115 }
8115 8116
8116 8117
8117 } } // namespace v8::internal 8118 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/arm/macro-assembler-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698