Commit 63851465 authored by yangguo@chromium.org's avatar yangguo@chromium.org

Revert "Use symbols instead of hidden properties for i18n markers."

This reverts r24345.

TBR=bmeurer@chromium.org

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24346 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 153ec032
...@@ -5904,7 +5904,7 @@ class Internals { ...@@ -5904,7 +5904,7 @@ class Internals {
static const int kNullValueRootIndex = 7; static const int kNullValueRootIndex = 7;
static const int kTrueValueRootIndex = 8; static const int kTrueValueRootIndex = 8;
static const int kFalseValueRootIndex = 9; static const int kFalseValueRootIndex = 9;
static const int kEmptyStringRootIndex = 152; static const int kEmptyStringRootIndex = 166;
// The external allocation limit should be below 256 MB on all architectures // The external allocation limit should be below 256 MB on all architectures
// to avoid that resource-constrained embedders run low on memory. // to avoid that resource-constrained embedders run low on memory.
......
...@@ -588,14 +588,6 @@ class Factory FINAL { ...@@ -588,14 +588,6 @@ class Factory FINAL {
INTERNALIZED_STRING_LIST(STRING_ACCESSOR) INTERNALIZED_STRING_LIST(STRING_ACCESSOR)
#undef STRING_ACCESSOR #undef STRING_ACCESSOR
#define SYMBOL_ACCESSOR(name) \
inline Handle<Symbol> name() { \
return Handle<Symbol>(bit_cast<Symbol**>( \
&isolate()->heap()->roots_[Heap::k##name##RootIndex])); \
}
PRIVATE_SYMBOL_LIST(SYMBOL_ACCESSOR)
#undef SYMBOL_ACCESSOR
inline void set_string_table(Handle<StringTable> table) { inline void set_string_table(Handle<StringTable> table) {
isolate()->heap()->set_string_table(*table); isolate()->heap()->set_string_table(*table);
} }
......
...@@ -2164,9 +2164,6 @@ const char* V8HeapExplorer::GetStrongGcSubrootName(Object* object) { ...@@ -2164,9 +2164,6 @@ const char* V8HeapExplorer::GetStrongGcSubrootName(Object* object) {
#define STRING_NAME(name, str) NAME_ENTRY(name) #define STRING_NAME(name, str) NAME_ENTRY(name)
INTERNALIZED_STRING_LIST(STRING_NAME) INTERNALIZED_STRING_LIST(STRING_NAME)
#undef STRING_NAME #undef STRING_NAME
#define SYMBOL_NAME(name) NAME_ENTRY(name)
PRIVATE_SYMBOL_LIST(SYMBOL_NAME)
#undef SYMBOL_NAME
#undef NAME_ENTRY #undef NAME_ENTRY
CHECK(!strong_gc_subroot_names_.is_empty()); CHECK(!strong_gc_subroot_names_.is_empty());
} }
......
...@@ -2868,10 +2868,20 @@ void Heap::CreateInitialObjects() { ...@@ -2868,10 +2868,20 @@ void Heap::CreateInitialObjects() {
// Number of queued microtasks stored in Isolate::pending_microtask_count(). // Number of queued microtasks stored in Isolate::pending_microtask_count().
set_microtask_queue(empty_fixed_array()); set_microtask_queue(empty_fixed_array());
#define SYMBOL_INIT(name) \ set_detailed_stack_trace_symbol(*factory->NewPrivateOwnSymbol());
roots_[k##name##RootIndex] = *factory->NewPrivateOwnSymbol(); set_elements_transition_symbol(*factory->NewPrivateOwnSymbol());
PRIVATE_SYMBOL_LIST(SYMBOL_INIT) set_frozen_symbol(*factory->NewPrivateOwnSymbol());
#undef SYMBOL_INIT 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());
set_promise_debug_marker_symbol(*factory->NewPrivateOwnSymbol());
set_promise_has_handler_symbol(*factory->NewPrivateOwnSymbol());
Handle<SeededNumberDictionary> slow_element_dictionary = Handle<SeededNumberDictionary> slow_element_dictionary =
SeededNumberDictionary::New(isolate(), 0, TENURED); SeededNumberDictionary::New(isolate(), 0, TENURED);
......
...@@ -175,8 +175,22 @@ namespace internal { ...@@ -175,8 +175,22 @@ namespace internal {
V(JSObject, observation_state, ObservationState) \ V(JSObject, observation_state, ObservationState) \
V(Map, external_map, ExternalMap) \ V(Map, external_map, ExternalMap) \
V(Object, symbol_registry, SymbolRegistry) \ V(Object, symbol_registry, SymbolRegistry) \
V(Symbol, frozen_symbol, FrozenSymbol) \
V(Symbol, nonexistent_symbol, NonExistentSymbol) \
V(Symbol, elements_transition_symbol, ElementsTransitionSymbol) \
V(SeededNumberDictionary, empty_slow_element_dictionary, \ V(SeededNumberDictionary, empty_slow_element_dictionary, \
EmptySlowElementDictionary) \ EmptySlowElementDictionary) \
V(Symbol, observed_symbol, ObservedSymbol) \
V(Symbol, uninitialized_symbol, UninitializedSymbol) \
V(Symbol, megamorphic_symbol, MegamorphicSymbol) \
V(Symbol, premonomorphic_symbol, PremonomorphicSymbol) \
V(Symbol, generic_symbol, GenericSymbol) \
V(Symbol, stack_trace_symbol, StackTraceSymbol) \
V(Symbol, detailed_stack_trace_symbol, DetailedStackTraceSymbol) \
V(Symbol, normal_ic_symbol, NormalICSymbol) \
V(Symbol, home_object_symbol, HomeObjectSymbol) \
V(Symbol, promise_debug_marker_symbol, PromiseDebugMarkerSymbol) \
V(Symbol, promise_has_handler_symbol, PromiseHasHandlerSymbol) \
V(FixedArray, materialized_objects, MaterializedObjects) \ V(FixedArray, materialized_objects, MaterializedObjects) \
V(FixedArray, allocation_sites_scratchpad, AllocationSitesScratchpad) \ V(FixedArray, allocation_sites_scratchpad, AllocationSitesScratchpad) \
V(FixedArray, microtask_queue, MicrotaskQueue) V(FixedArray, microtask_queue, MicrotaskQueue)
...@@ -321,25 +335,9 @@ namespace internal { ...@@ -321,25 +335,9 @@ namespace internal {
V(value_string, "value") \ V(value_string, "value") \
V(next_string, "next") \ V(next_string, "next") \
V(byte_length_string, "byteLength") \ V(byte_length_string, "byteLength") \
V(byte_offset_string, "byteOffset") V(byte_offset_string, "byteOffset") \
V(intl_initialized_marker_string, "v8::intl_initialized_marker") \
#define PRIVATE_SYMBOL_LIST(V) \ V(intl_impl_object_string, "v8::intl_object")
V(frozen_symbol) \
V(nonexistent_symbol) \
V(elements_transition_symbol) \
V(observed_symbol) \
V(uninitialized_symbol) \
V(megamorphic_symbol) \
V(premonomorphic_symbol) \
V(generic_symbol) \
V(stack_trace_symbol) \
V(detailed_stack_trace_symbol) \
V(normal_ic_symbol) \
V(home_object_symbol) \
V(intl_initialized_marker_symbol) \
V(intl_impl_object_symbol) \
V(promise_debug_marker_symbol) \
V(promise_has_handler_symbol)
// Forward declarations. // Forward declarations.
class HeapStats; class HeapStats;
...@@ -787,11 +785,6 @@ class Heap { ...@@ -787,11 +785,6 @@ class Heap {
INTERNALIZED_STRING_LIST(STRING_ACCESSOR) INTERNALIZED_STRING_LIST(STRING_ACCESSOR)
#undef STRING_ACCESSOR #undef STRING_ACCESSOR
#define SYMBOL_ACCESSOR(name) \
Symbol* name() { return Symbol::cast(roots_[k##name##RootIndex]); }
PRIVATE_SYMBOL_LIST(SYMBOL_ACCESSOR)
#undef SYMBOL_ACCESSOR
// The hidden_string is special because it is the empty string, but does // The hidden_string is special because it is the empty string, but does
// not match the empty string. // not match the empty string.
String* hidden_string() { return hidden_string_; } String* hidden_string() { return hidden_string_; }
...@@ -1069,10 +1062,6 @@ class Heap { ...@@ -1069,10 +1062,6 @@ class Heap {
INTERNALIZED_STRING_LIST(STRING_INDEX_DECLARATION) INTERNALIZED_STRING_LIST(STRING_INDEX_DECLARATION)
#undef STRING_DECLARATION #undef STRING_DECLARATION
#define SYMBOL_INDEX_DECLARATION(name) k##name##RootIndex,
PRIVATE_SYMBOL_LIST(SYMBOL_INDEX_DECLARATION)
#undef SYMBOL_INDEX_DECLARATION
// Utility type maps // Utility type maps
#define DECLARE_STRUCT_MAP(NAME, Name, name) k##Name##MapRootIndex, #define DECLARE_STRUCT_MAP(NAME, Name, name) k##Name##MapRootIndex,
STRUCT_LIST(DECLARE_STRUCT_MAP) STRUCT_LIST(DECLARE_STRUCT_MAP)
......
...@@ -2873,9 +2873,6 @@ bool HConstant::ImmortalImmovable() const { ...@@ -2873,9 +2873,6 @@ bool HConstant::ImmortalImmovable() const {
object_.IsKnownGlobal(heap->name##_map()) || object_.IsKnownGlobal(heap->name##_map()) ||
STRING_TYPE_LIST(STRING_TYPE) STRING_TYPE_LIST(STRING_TYPE)
#undef STRING_TYPE #undef STRING_TYPE
#define SYMBOL(name) object_.IsKnownGlobal(heap->name()) ||
PRIVATE_SYMBOL_LIST(SYMBOL)
#undef SYMBOL
false; false;
} }
......
...@@ -233,9 +233,9 @@ RUNTIME_FUNCTION(Runtime_IsInitializedIntlObject) { ...@@ -233,9 +233,9 @@ RUNTIME_FUNCTION(Runtime_IsInitializedIntlObject) {
if (!input->IsJSObject()) return isolate->heap()->false_value(); if (!input->IsJSObject()) return isolate->heap()->false_value();
Handle<JSObject> obj = Handle<JSObject>::cast(input); Handle<JSObject> obj = Handle<JSObject>::cast(input);
Handle<Symbol> marker = isolate->factory()->intl_initialized_marker_symbol(); Handle<String> marker = isolate->factory()->intl_initialized_marker_string();
Handle<Object> tag = JSObject::GetDataProperty(obj, marker); Handle<Object> tag(obj->GetHiddenProperty(marker), isolate);
return isolate->heap()->ToBoolean(!tag->IsUndefined()); return isolate->heap()->ToBoolean(!tag->IsTheHole());
} }
...@@ -250,8 +250,8 @@ RUNTIME_FUNCTION(Runtime_IsInitializedIntlObjectOfType) { ...@@ -250,8 +250,8 @@ RUNTIME_FUNCTION(Runtime_IsInitializedIntlObjectOfType) {
if (!input->IsJSObject()) return isolate->heap()->false_value(); if (!input->IsJSObject()) return isolate->heap()->false_value();
Handle<JSObject> obj = Handle<JSObject>::cast(input); Handle<JSObject> obj = Handle<JSObject>::cast(input);
Handle<Symbol> marker = isolate->factory()->intl_initialized_marker_symbol(); Handle<String> marker = isolate->factory()->intl_initialized_marker_string();
Handle<Object> tag = JSObject::GetDataProperty(obj, marker); Handle<Object> tag(obj->GetHiddenProperty(marker), isolate);
return isolate->heap()->ToBoolean(tag->IsString() && return isolate->heap()->ToBoolean(tag->IsString() &&
String::cast(*tag)->Equals(*expected_type)); String::cast(*tag)->Equals(*expected_type));
} }
...@@ -266,11 +266,11 @@ RUNTIME_FUNCTION(Runtime_MarkAsInitializedIntlObjectOfType) { ...@@ -266,11 +266,11 @@ RUNTIME_FUNCTION(Runtime_MarkAsInitializedIntlObjectOfType) {
CONVERT_ARG_HANDLE_CHECKED(String, type, 1); CONVERT_ARG_HANDLE_CHECKED(String, type, 1);
CONVERT_ARG_HANDLE_CHECKED(JSObject, impl, 2); CONVERT_ARG_HANDLE_CHECKED(JSObject, impl, 2);
Handle<Symbol> marker = isolate->factory()->intl_initialized_marker_symbol(); Handle<String> marker = isolate->factory()->intl_initialized_marker_string();
JSObject::SetProperty(input, marker, type, STRICT).Assert(); JSObject::SetHiddenProperty(input, marker, type);
marker = isolate->factory()->intl_impl_object_symbol(); marker = isolate->factory()->intl_impl_object_string();
JSObject::SetProperty(input, marker, impl, STRICT).Assert(); JSObject::SetHiddenProperty(input, marker, impl);
return isolate->heap()->undefined_value(); return isolate->heap()->undefined_value();
} }
...@@ -291,9 +291,8 @@ RUNTIME_FUNCTION(Runtime_GetImplFromInitializedIntlObject) { ...@@ -291,9 +291,8 @@ RUNTIME_FUNCTION(Runtime_GetImplFromInitializedIntlObject) {
Handle<JSObject> obj = Handle<JSObject>::cast(input); Handle<JSObject> obj = Handle<JSObject>::cast(input);
Handle<Symbol> marker = isolate->factory()->intl_impl_object_symbol(); Handle<String> marker = isolate->factory()->intl_impl_object_string();
Handle<Object> impl(obj->GetHiddenProperty(marker), isolate);
Handle<Object> impl = JSObject::GetDataProperty(obj, marker);
if (impl->IsTheHole()) { if (impl->IsTheHole()) {
Vector<Handle<Object> > arguments = HandleVector(&obj, 1); Vector<Handle<Object> > arguments = HandleVector(&obj, 1);
THROW_NEW_ERROR_RETURN_FAILURE(isolate, THROW_NEW_ERROR_RETURN_FAILURE(isolate,
......
...@@ -1040,6 +1040,18 @@ MaybeHandle<Object> Runtime::DeleteObjectProperty(Isolate* isolate, ...@@ -1040,6 +1040,18 @@ MaybeHandle<Object> Runtime::DeleteObjectProperty(Isolate* isolate,
} }
RUNTIME_FUNCTION(Runtime_SetHiddenProperty) {
HandleScope scope(isolate);
RUNTIME_ASSERT(args.length() == 3);
CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
CONVERT_ARG_HANDLE_CHECKED(String, key, 1);
CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
RUNTIME_ASSERT(key->IsUniqueName());
return *JSObject::SetHiddenProperty(object, key, value);
}
RUNTIME_FUNCTION(Runtime_AddNamedProperty) { RUNTIME_FUNCTION(Runtime_AddNamedProperty) {
HandleScope scope(isolate); HandleScope scope(isolate);
RUNTIME_ASSERT(args.length() == 4); RUNTIME_ASSERT(args.length() == 4);
......
...@@ -256,6 +256,7 @@ namespace internal { ...@@ -256,6 +256,7 @@ namespace internal {
F(DefineDataPropertyUnchecked, 4, 1) \ F(DefineDataPropertyUnchecked, 4, 1) \
F(DefineAccessorPropertyUnchecked, 5, 1) \ F(DefineAccessorPropertyUnchecked, 5, 1) \
F(GetDataProperty, 2, 1) \ F(GetDataProperty, 2, 1) \
F(SetHiddenProperty, 3, 1) \
\ \
/* Arrays */ \ /* Arrays */ \
F(RemoveArrayHoles, 2, 1) \ F(RemoveArrayHoles, 2, 1) \
......
// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax
var o = {};
%SetHiddenProperty(o, "test", 1);
// Create non-internalized ""
var empty = "a".substring(1, 1);
assertEquals(undefined, o[empty]);
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