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

Side by Side Diff: src/objects.cc

Issue 1702353002: Attempt to speed up v8::Object::SetPrivate (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 4 years, 10 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 | « src/objects.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 6995 matching lines...) Expand 10 before | Expand all | Expand 10 after
7006 7006
7007 7007
7008 // ES6 9.5.6 7008 // ES6 9.5.6
7009 // static 7009 // static
7010 Maybe<bool> JSProxy::DefineOwnProperty(Isolate* isolate, Handle<JSProxy> proxy, 7010 Maybe<bool> JSProxy::DefineOwnProperty(Isolate* isolate, Handle<JSProxy> proxy,
7011 Handle<Object> key, 7011 Handle<Object> key,
7012 PropertyDescriptor* desc, 7012 PropertyDescriptor* desc,
7013 ShouldThrow should_throw) { 7013 ShouldThrow should_throw) {
7014 STACK_CHECK(Nothing<bool>()); 7014 STACK_CHECK(Nothing<bool>());
7015 if (key->IsSymbol() && Handle<Symbol>::cast(key)->IsPrivate()) { 7015 if (key->IsSymbol() && Handle<Symbol>::cast(key)->IsPrivate()) {
7016 return AddPrivateProperty(isolate, proxy, Handle<Symbol>::cast(key), desc, 7016 return SetPrivateProperty(isolate, proxy, Handle<Symbol>::cast(key), desc,
7017 should_throw); 7017 should_throw);
7018 } 7018 }
7019 Handle<String> trap_name = isolate->factory()->defineProperty_string(); 7019 Handle<String> trap_name = isolate->factory()->defineProperty_string();
7020 // 1. Assert: IsPropertyKey(P) is true. 7020 // 1. Assert: IsPropertyKey(P) is true.
7021 DCHECK(key->IsName() || key->IsNumber()); 7021 DCHECK(key->IsName() || key->IsNumber());
7022 // 2. Let handler be the value of the [[ProxyHandler]] internal slot of O. 7022 // 2. Let handler be the value of the [[ProxyHandler]] internal slot of O.
7023 Handle<Object> handler(proxy->handler(), isolate); 7023 Handle<Object> handler(proxy->handler(), isolate);
7024 // 3. If handler is null, throw a TypeError exception. 7024 // 3. If handler is null, throw a TypeError exception.
7025 // 4. Assert: Type(handler) is Object. 7025 // 4. Assert: Type(handler) is Object.
7026 if (proxy->IsRevoked()) { 7026 if (proxy->IsRevoked()) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
7112 MessageTemplate::kProxyDefinePropertyNonConfigurable, property_name)); 7112 MessageTemplate::kProxyDefinePropertyNonConfigurable, property_name));
7113 return Nothing<bool>(); 7113 return Nothing<bool>();
7114 } 7114 }
7115 } 7115 }
7116 // 17. Return true. 7116 // 17. Return true.
7117 return Just(true); 7117 return Just(true);
7118 } 7118 }
7119 7119
7120 7120
7121 // static 7121 // static
7122 Maybe<bool> JSProxy::AddPrivateProperty(Isolate* isolate, Handle<JSProxy> proxy, 7122 Maybe<bool> JSProxy::SetPrivateProperty(Isolate* isolate, Handle<JSProxy> proxy,
7123 Handle<Symbol> private_name, 7123 Handle<Symbol> private_name,
7124 PropertyDescriptor* desc, 7124 PropertyDescriptor* desc,
7125 ShouldThrow should_throw) { 7125 ShouldThrow should_throw) {
7126 // Despite the generic name, this can only add private data properties. 7126 // Despite the generic name, this can only add private data properties.
7127 if (!PropertyDescriptor::IsDataDescriptor(desc) || 7127 if (!PropertyDescriptor::IsDataDescriptor(desc) ||
7128 desc->ToAttributes() != DONT_ENUM) { 7128 desc->ToAttributes() != DONT_ENUM) {
7129 RETURN_FAILURE(isolate, should_throw, 7129 RETURN_FAILURE(isolate, should_throw,
7130 NewTypeError(MessageTemplate::kProxyPrivate)); 7130 NewTypeError(MessageTemplate::kProxyPrivate));
7131 } 7131 }
7132 DCHECK(proxy->map()->is_dictionary_map()); 7132 DCHECK(proxy->map()->is_dictionary_map());
(...skipping 12751 matching lines...) Expand 10 before | Expand all | Expand 10 after
19884 if (cell->value() != *new_value) { 19884 if (cell->value() != *new_value) {
19885 cell->set_value(*new_value); 19885 cell->set_value(*new_value);
19886 Isolate* isolate = cell->GetIsolate(); 19886 Isolate* isolate = cell->GetIsolate();
19887 cell->dependent_code()->DeoptimizeDependentCodeGroup( 19887 cell->dependent_code()->DeoptimizeDependentCodeGroup(
19888 isolate, DependentCode::kPropertyCellChangedGroup); 19888 isolate, DependentCode::kPropertyCellChangedGroup);
19889 } 19889 }
19890 } 19890 }
19891 19891
19892 } // namespace internal 19892 } // namespace internal
19893 } // namespace v8 19893 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698