Revision: 19648
Author: [email protected]
Date: Tue Mar 4 12:43:05 2014 UTC
Log: Allow objects with "" properties to stay fast.
[email protected]
Review URL: https://codereview.chromium.org/184453003
http://code.google.com/p/v8/source/detail?r=19648
Added:
/branches/bleeding_edge/test/mjsunit/test-hidden-string.js
Modified:
/branches/bleeding_edge/include/v8.h
/branches/bleeding_edge/src/heap.cc
/branches/bleeding_edge/src/heap.h
/branches/bleeding_edge/src/objects.cc
/branches/bleeding_edge/src/runtime.cc
/branches/bleeding_edge/src/runtime.h
/branches/bleeding_edge/src/stub-cache.cc
=======================================
--- /dev/null
+++ /branches/bleeding_edge/test/mjsunit/test-hidden-string.js Tue Mar 4
12:43:05 2014 UTC
@@ -0,0 +1,11 @@
+// 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]);
=======================================
--- /branches/bleeding_edge/include/v8.h Fri Feb 28 14:09:52 2014 UTC
+++ /branches/bleeding_edge/include/v8.h Tue Mar 4 12:43:05 2014 UTC
@@ -5414,7 +5414,7 @@
static const int kNullValueRootIndex = 7;
static const int kTrueValueRootIndex = 8;
static const int kFalseValueRootIndex = 9;
- static const int kEmptyStringRootIndex = 141;
+ static const int kEmptyStringRootIndex = 142;
static const int kNodeClassIdOffset = 1 * kApiPointerSize;
static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3;
=======================================
--- /branches/bleeding_edge/src/heap.cc Tue Feb 18 16:34:52 2014 UTC
+++ /branches/bleeding_edge/src/heap.cc Tue Mar 4 12:43:05 2014 UTC
@@ -3303,6 +3303,12 @@
Symbol::cast(obj)->set_is_private(true);
set_frozen_symbol(Symbol::cast(obj));
+ { MaybeObject* maybe_obj = AllocateSymbol();
+ if (!maybe_obj->ToObject(&obj)) return false;
+ }
+ Symbol::cast(obj)->set_is_private(true);
+ set_nonexistent_symbol(Symbol::cast(obj));
+
{ MaybeObject* maybe_obj = AllocateSymbol();
if (!maybe_obj->ToObject(&obj)) return false;
}
=======================================
--- /branches/bleeding_edge/src/heap.h Tue Feb 18 16:34:52 2014 UTC
+++ /branches/bleeding_edge/src/heap.h Tue Mar 4 12:43:05 2014 UTC
@@ -191,6 +191,7 @@
V(JSObject, observation_state,
ObservationState) \
V(Map, external_map,
ExternalMap) \
V(Symbol, frozen_symbol,
FrozenSymbol) \
+ V(Symbol, nonexistent_symbol,
NonExistentSymbol) \
V(Symbol, elements_transition_symbol,
ElementsTransitionSymbol) \
V(SeededNumberDictionary,
empty_slow_element_dictionary, \
EmptySlowElementDictionary) \
=======================================
--- /branches/bleeding_edge/src/objects.cc Mon Mar 3 13:12:31 2014 UTC
+++ /branches/bleeding_edge/src/objects.cc Tue Mar 4 12:43:05 2014 UTC
@@ -8242,7 +8242,7 @@
// Checks whether the buffer contains an identifier (no escape).
if (!name->IsString()) return false;
String* string = String::cast(name);
- if (string->length() == 0) return false;
+ if (string->length() == 0) return true;
ConsStringIteratorOp op;
StringCharacterStream stream(string, &op);
if (!cache->IsIdentifierStart(stream.GetNext())) {
@@ -8258,9 +8258,7 @@
bool Name::IsCacheable(Isolate* isolate) {
- return IsSymbol() ||
- IsIdentifier(isolate->unicode_cache(), this) ||
- this == isolate->heap()->hidden_string();
+ return IsSymbol() || IsIdentifier(isolate->unicode_cache(), this);
}
@@ -15728,7 +15726,6 @@
// instance descriptor.
MaybeObject* maybe_key = heap->InternalizeString(String::cast(k));
if (!maybe_key->To(&key)) return maybe_key;
- if (key->Equals(heap->empty_string())) return this;
}
PropertyDetails details = DetailsAt(i);
=======================================
--- /branches/bleeding_edge/src/runtime.cc Mon Mar 3 11:11:39 2014 UTC
+++ /branches/bleeding_edge/src/runtime.cc Tue Mar 4 12:43:05 2014 UTC
@@ -5354,6 +5354,17 @@
RETURN_IF_EMPTY_HANDLE(isolate, result);
return *result;
}
+
+
+RUNTIME_FUNCTION(MaybeObject*, 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);
+ return *JSObject::SetHiddenProperty(object, key, value);
+}
RUNTIME_FUNCTION(MaybeObject*, Runtime_SetProperty) {
=======================================
--- /branches/bleeding_edge/src/runtime.h Wed Feb 19 14:19:42 2014 UTC
+++ /branches/bleeding_edge/src/runtime.h Tue Mar 4 12:43:05 2014 UTC
@@ -285,6 +285,7 @@
F(DefineOrRedefineAccessorProperty, 5, 1) \
F(IgnoreAttributesAndSetProperty, -1 /* 3 or 4 */, 1) \
F(GetDataProperty, 2, 1) \
+ F(SetHiddenProperty, 3, 1) \
\
/* Arrays */ \
F(RemoveArrayHoles, 2, 1) \
=======================================
--- /branches/bleeding_edge/src/stub-cache.cc Thu Feb 20 21:55:45 2014 UTC
+++ /branches/bleeding_edge/src/stub-cache.cc Tue Mar 4 12:43:05 2014 UTC
@@ -179,7 +179,7 @@
// therefore the stub will be specific to the name.
Handle<Map> current_map = stub_holder;
Handle<Name> cache_name = current_map->is_dictionary_map()
- ? name : Handle<Name>::cast(isolate()->factory()->empty_string());
+ ? name :
Handle<Name>::cast(isolate()->factory()->nonexistent_symbol());
Handle<Object> next(current_map->prototype(), isolate());
Handle<JSObject> last = Handle<JSObject>::null();
while (!next->IsNull()) {
--
--
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/groups/opt_out.