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

Side by Side Diff: src/isolate.cc

Issue 1142493002: Use a private own symbol instead of a hidden property for hash codes (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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
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 <stdlib.h> 5 #include <stdlib.h>
6 6
7 #include <fstream> // NOLINT(readability/streams) 7 #include <fstream> // NOLINT(readability/streams)
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "src/v8.h" 10 #include "src/v8.h"
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 } 772 }
773 773
774 // Leaving JavaScript. 774 // Leaving JavaScript.
775 VMState<EXTERNAL> state(this); 775 VMState<EXTERNAL> state(this);
776 thread_local_top()->failed_access_check_callback_( 776 thread_local_top()->failed_access_check_callback_(
777 v8::Utils::ToLocal(receiver), v8::ACCESS_HAS, v8::Utils::ToLocal(data)); 777 v8::Utils::ToLocal(receiver), v8::ACCESS_HAS, v8::Utils::ToLocal(data));
778 } 778 }
779 779
780 780
781 bool Isolate::IsInternallyUsedPropertyName(Handle<Object> name) { 781 bool Isolate::IsInternallyUsedPropertyName(Handle<Object> name) {
782 if (name->IsSymbol()) {
783 return (Handle<Symbol>::cast(name)->is_private()) &&
784 Handle<Symbol>::cast(name)->is_own();
785 }
782 return name.is_identical_to(factory()->hidden_string()); 786 return name.is_identical_to(factory()->hidden_string());
783 } 787 }
784 788
785 789
786 bool Isolate::IsInternallyUsedPropertyName(Object* name) { 790 bool Isolate::IsInternallyUsedPropertyName(Object* name) {
787 return name == heap()->hidden_string(); 791 return name == heap()->hidden_string();
arv (Not doing code reviews) 2015/05/14 19:58:54 Does this one need to be updated too?
788 } 792 }
789 793
790 794
791 bool Isolate::MayAccess(Handle<JSObject> receiver) { 795 bool Isolate::MayAccess(Handle<JSObject> receiver) {
792 DCHECK(receiver->IsJSGlobalProxy() || receiver->IsAccessCheckNeeded()); 796 DCHECK(receiver->IsJSGlobalProxy() || receiver->IsAccessCheckNeeded());
793 797
794 // Check for compatibility between the security tokens in the 798 // Check for compatibility between the security tokens in the
795 // current lexical context and the accessed object. 799 // current lexical context and the accessed object.
796 DCHECK(context()); 800 DCHECK(context());
797 801
(...skipping 1723 matching lines...) Expand 10 before | Expand all | Expand 10 after
2521 Handle<JSObject> registry = factory()->NewJSObjectFromMap(map); 2525 Handle<JSObject> registry = factory()->NewJSObjectFromMap(map);
2522 heap()->set_symbol_registry(*registry); 2526 heap()->set_symbol_registry(*registry);
2523 2527
2524 static const char* nested[] = {"for", "for_api", "keyFor", "private_api", 2528 static const char* nested[] = {"for", "for_api", "keyFor", "private_api",
2525 "private_intern"}; 2529 "private_intern"};
2526 for (unsigned i = 0; i < arraysize(nested); ++i) { 2530 for (unsigned i = 0; i < arraysize(nested); ++i) {
2527 Handle<String> name = factory()->InternalizeUtf8String(nested[i]); 2531 Handle<String> name = factory()->InternalizeUtf8String(nested[i]);
2528 Handle<JSObject> obj = factory()->NewJSObjectFromMap(map); 2532 Handle<JSObject> obj = factory()->NewJSObjectFromMap(map);
2529 JSObject::NormalizeProperties(obj, KEEP_INOBJECT_PROPERTIES, 8, 2533 JSObject::NormalizeProperties(obj, KEEP_INOBJECT_PROPERTIES, 8,
2530 "SetupSymbolRegistry"); 2534 "SetupSymbolRegistry");
2535 if (strcmp(nested[i], "private_intern") == 0) {
2536 heap()->AddPrivateGlobalSymbols(obj);
2537 }
2531 JSObject::SetProperty(registry, name, obj, STRICT).Assert(); 2538 JSObject::SetProperty(registry, name, obj, STRICT).Assert();
2532 } 2539 }
2533 } 2540 }
2534 return Handle<JSObject>::cast(factory()->symbol_registry()); 2541 return Handle<JSObject>::cast(factory()->symbol_registry());
2535 } 2542 }
2536 2543
2537 2544
2538 void Isolate::AddCallCompletedCallback(CallCompletedCallback callback) { 2545 void Isolate::AddCallCompletedCallback(CallCompletedCallback callback) {
2539 for (int i = 0; i < call_completed_callbacks_.length(); i++) { 2546 for (int i = 0; i < call_completed_callbacks_.length(); i++) {
2540 if (callback == call_completed_callbacks_.at(i)) return; 2547 if (callback == call_completed_callbacks_.at(i)) return;
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
2778 if (prev_ && prev_->Intercept(flag)) return true; 2785 if (prev_ && prev_->Intercept(flag)) return true;
2779 // Then check whether this scope intercepts. 2786 // Then check whether this scope intercepts.
2780 if ((flag & intercept_mask_)) { 2787 if ((flag & intercept_mask_)) {
2781 intercepted_flags_ |= flag; 2788 intercepted_flags_ |= flag;
2782 return true; 2789 return true;
2783 } 2790 }
2784 return false; 2791 return false;
2785 } 2792 }
2786 2793
2787 } } // namespace v8::internal 2794 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698