Reviewers: Yang,
Message:
PTAL.
I have not removed private non-own symbols, and they are still exposed
through
the API (v8::Private::New creates a private non-own symbol) to enable
experimenting with changes like these:
https://codereview.chromium.org/555723002
Description:
Change all V8 internal private symbols to be private own symbols.
[email protected]
Please review this at https://codereview.chromium.org/598603002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+25, -20 lines):
M src/heap/heap.cc
M src/macros.py
M src/messages.js
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index
8c103dd23d42d6eced6f9c2c668329c9899a43ae..1cc646e14465620e244101a2470d45dfa23193fa
100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -2861,17 +2861,17 @@ void Heap::CreateInitialObjects() {
// Number of queued microtasks stored in
Isolate::pending_microtask_count().
set_microtask_queue(empty_fixed_array());
- set_detailed_stack_trace_symbol(*factory->NewPrivateSymbol());
- set_elements_transition_symbol(*factory->NewPrivateSymbol());
- set_frozen_symbol(*factory->NewPrivateSymbol());
- set_megamorphic_symbol(*factory->NewPrivateSymbol());
- set_premonomorphic_symbol(*factory->NewPrivateSymbol());
- set_generic_symbol(*factory->NewPrivateSymbol());
- set_nonexistent_symbol(*factory->NewPrivateSymbol());
- set_normal_ic_symbol(*factory->NewPrivateSymbol());
- set_observed_symbol(*factory->NewPrivateSymbol());
- set_stack_trace_symbol(*factory->NewPrivateSymbol());
- set_uninitialized_symbol(*factory->NewPrivateSymbol());
+ set_detailed_stack_trace_symbol(*factory->NewPrivateOwnSymbol());
+ set_elements_transition_symbol(*factory->NewPrivateOwnSymbol());
+ set_frozen_symbol(*factory->NewPrivateOwnSymbol());
+ set_megamorphic_symbol(*factory->NewPrivateOwnSymbol());
+ set_premonomorphic_symbol(*factory->NewPrivateOwnSymbol());
+ set_generic_symbol(*factory->NewPrivateOwnSymbol());
+ set_nonexistent_symbol(*factory->NewPrivateOwnSymbol());
+ set_normal_ic_symbol(*factory->NewPrivateOwnSymbol());
+ set_observed_symbol(*factory->NewPrivateOwnSymbol());
+ set_stack_trace_symbol(*factory->NewPrivateOwnSymbol());
+ set_uninitialized_symbol(*factory->NewPrivateOwnSymbol());
set_home_object_symbol(*factory->NewPrivateOwnSymbol());
Handle<SeededNumberDictionary> slow_element_dictionary =
Index: src/macros.py
diff --git a/src/macros.py b/src/macros.py
index
65c11615209cb2953213ef8560b6940fcfdd2065..b3ff0fcf11fb1888c7c9059c4df45b21cec8dfda
100644
--- a/src/macros.py
+++ b/src/macros.py
@@ -172,7 +172,7 @@ macro HAS_OWN_PROPERTY(obj, index) =
(%_CallFunction(obj, index, ObjectHasOwnPro
# GET_PRIVATE should only be used if the property is known to exists on obj
# itself (it should really use %GetOwnProperty, but that would be way
slower).
macro GLOBAL_PRIVATE(name) = (%CreateGlobalPrivateOwnSymbol(name));
-macro NEW_PRIVATE(name) = (%CreatePrivateSymbol(name));
+macro NEW_PRIVATE_OWN(name) = (%CreatePrivateOwnSymbol(name));
macro IS_PRIVATE(sym) = (%SymbolIsPrivate(sym));
macro HAS_PRIVATE(obj, sym) = (%HasOwnProperty(obj, sym));
macro HAS_DEFINED_PRIVATE(obj, sym) = (!IS_UNDEFINED(obj[sym]));
Index: src/messages.js
diff --git a/src/messages.js b/src/messages.js
index
d4375ef626aeabf9f427a46b1ac000f3547ed627..4d64d1e1319a1501dc4ae2357c33131e4036ebda
100644
--- a/src/messages.js
+++ b/src/messages.js
@@ -757,10 +757,10 @@ function GetStackTraceLine(recv, fun, pos, isGlobal) {
//
----------------------------------------------------------------------------
// Error implementation
-var CallSiteReceiverKey = NEW_PRIVATE("CallSite#receiver");
-var CallSiteFunctionKey = NEW_PRIVATE("CallSite#function");
-var CallSitePositionKey = NEW_PRIVATE("CallSite#position");
-var CallSiteStrictModeKey = NEW_PRIVATE("CallSite#strict_mode");
+var CallSiteReceiverKey = NEW_PRIVATE_OWN("CallSite#receiver");
+var CallSiteFunctionKey = NEW_PRIVATE_OWN("CallSite#function");
+var CallSitePositionKey = NEW_PRIVATE_OWN("CallSite#position");
+var CallSiteStrictModeKey = NEW_PRIVATE_OWN("CallSite#strict_mode");
function CallSite(receiver, fun, pos, strict_mode) {
SET_PRIVATE(this, CallSiteReceiverKey, receiver);
@@ -1115,16 +1115,21 @@ function GetTypeName(receiver, requireConstructor) {
var stack_trace_symbol; // Set during bootstrapping.
-var formatted_stack_trace_symbol = NEW_PRIVATE("formatted stack trace");
+var formatted_stack_trace_symbol = NEW_PRIVATE_OWN("formatted stack
trace");
// Format the stack trace if not yet done, and return it.
// Cache the formatted stack trace on the holder.
var StackTraceGetter = function() {
- var formatted_stack_trace = GET_PRIVATE(this,
formatted_stack_trace_symbol);
+ var formatted_stack_trace = UNDEFINED;
+ var holder = this;
+ while (holder && IS_UNDEFINED(formatted_stack_trace)) {
+ formatted_stack_trace = GET_PRIVATE(holder,
formatted_stack_trace_symbol);
+ holder = %GetPrototype(holder);
+ }
if (IS_UNDEFINED(formatted_stack_trace)) {
- var holder = this;
- while (!HAS_PRIVATE(holder, stack_trace_symbol)) {
+ holder = this;
+ while (!HAS_DEFINED_PRIVATE(holder, stack_trace_symbol)) {
holder = %GetPrototype(holder);
if (!holder) return UNDEFINED;
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.