OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |