Commit 7e21f858 authored by dslomov@chromium.org's avatar dslomov@chromium.org

Change all V8 internal private symbols to be private own symbols.

R=yangguo@chromium.org

Review URL: https://codereview.chromium.org/598603002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24168 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 6fd04d82
......@@ -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 =
......
......@@ -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]));
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment