Add support for dictionary elements to polymorphic crankshaft code.
Review URL: http://codereview.chromium.org/7285001 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8479 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
7d189d848e
commit
39b06d8850
@ -3917,8 +3917,6 @@ HValue* HGraphBuilder::HandlePolymorphicElementAccess(HValue* object,
|
||||
todo_external_array = true;
|
||||
}
|
||||
}
|
||||
// We can't treat dictionary elements here (need to deopt instead).
|
||||
type_todo[JSObject::DICTIONARY_ELEMENTS] = false;
|
||||
// Support for FAST_DOUBLE_ELEMENTS isn't implemented yet, so we deopt.
|
||||
type_todo[JSObject::FAST_DOUBLE_ELEMENTS] = false;
|
||||
|
||||
@ -3936,9 +3934,12 @@ HValue* HGraphBuilder::HandlePolymorphicElementAccess(HValue* object,
|
||||
for (JSObject::ElementsKind elements_kind = JSObject::FAST_ELEMENTS;
|
||||
elements_kind <= JSObject::LAST_ELEMENTS_KIND;
|
||||
elements_kind = JSObject::ElementsKind(elements_kind + 1)) {
|
||||
// After having handled FAST_ELEMENTS in the first run of the loop, we
|
||||
// need to add some code that's executed for all other cases.
|
||||
if (elements_kind == 1 && todo_external_array) {
|
||||
// After having handled FAST_ELEMENTS and DICTIONARY_ELEMENTS, we
|
||||
// need to add some code that's executed for all external array cases.
|
||||
STATIC_ASSERT(JSObject::LAST_EXTERNAL_ARRAY_ELEMENTS_KIND ==
|
||||
JSObject::LAST_ELEMENTS_KIND);
|
||||
if (elements_kind == JSObject::FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND
|
||||
&& todo_external_array) {
|
||||
elements = AddInstruction(new(zone()) HLoadElements(object));
|
||||
// We need to forcibly prevent some ElementsKind-dependent instructions
|
||||
// from being hoisted out of any loops they might occur in, because
|
||||
@ -4007,6 +4008,12 @@ HValue* HGraphBuilder::HandlePolymorphicElementAccess(HValue* object,
|
||||
access = AddInstruction(
|
||||
new(zone()) HLoadKeyedFastElement(elements, checked_key));
|
||||
}
|
||||
} else if (elements_kind == JSObject::DICTIONARY_ELEMENTS) {
|
||||
if (is_store) {
|
||||
access = AddInstruction(BuildStoreKeyedGeneric(object, key, val));
|
||||
} else {
|
||||
access = AddInstruction(BuildLoadKeyedGeneric(object, key));
|
||||
}
|
||||
} else { // External array elements.
|
||||
access = AddInstruction(BuildExternalArrayElementAccess(
|
||||
external_elements, checked_key, val, elements_kind, is_store));
|
||||
|
@ -1745,7 +1745,8 @@ MaybeObject* KeyedIC::ComputeMonomorphicStub(JSObject* receiver,
|
||||
Code* generic_stub) {
|
||||
Code* result = NULL;
|
||||
if (receiver->HasFastElements() ||
|
||||
receiver->HasExternalArrayElements()) {
|
||||
receiver->HasExternalArrayElements() ||
|
||||
receiver->HasDictionaryElements()) {
|
||||
MaybeObject* maybe_stub =
|
||||
isolate()->stub_cache()->ComputeKeyedLoadOrStoreElement(
|
||||
receiver, is_store, strict_mode);
|
||||
|
@ -3946,6 +3946,10 @@ class Map: public HeapObject {
|
||||
kind <= JSObject::LAST_EXTERNAL_ARRAY_ELEMENTS_KIND;
|
||||
}
|
||||
|
||||
inline bool has_dictionary_elements() {
|
||||
return elements_kind() == JSObject::DICTIONARY_ELEMENTS;
|
||||
}
|
||||
|
||||
// Tells whether the map is attached to SharedFunctionInfo
|
||||
// (for inobject slack tracking).
|
||||
inline void set_attached_to_shared_function_info(bool value);
|
||||
|
@ -1694,6 +1694,8 @@ MaybeObject* KeyedLoadStubCompiler::ComputeSharedKeyedLoadElementStub(
|
||||
} else if (receiver_map->has_external_array_elements()) {
|
||||
JSObject::ElementsKind elements_kind = receiver_map->elements_kind();
|
||||
maybe_stub = KeyedLoadExternalArrayStub(elements_kind).TryGetCode();
|
||||
} else if (receiver_map->has_dictionary_elements()) {
|
||||
maybe_stub = isolate()->builtins()->builtin(Builtins::kKeyedLoadIC_Slow);
|
||||
} else {
|
||||
UNREACHABLE();
|
||||
}
|
||||
@ -1746,6 +1748,8 @@ MaybeObject* KeyedStoreStubCompiler::ComputeSharedKeyedStoreElementStub(
|
||||
} else if (receiver_map->has_external_array_elements()) {
|
||||
JSObject::ElementsKind elements_kind = receiver_map->elements_kind();
|
||||
maybe_stub = KeyedStoreExternalArrayStub(elements_kind).TryGetCode();
|
||||
} else if (receiver_map->has_dictionary_elements()) {
|
||||
maybe_stub = isolate()->builtins()->builtin(Builtins::kKeyedStoreIC_Slow);
|
||||
} else {
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user