Commit 80098968 authored by bak@chromium.org's avatar bak@chromium.org

- Inlined JSArray::SetContent.

- Implemented Runtime_KeyedGetProperty to make slow case faster.

Review URL: http://codereview.chromium.org/7226

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@487 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 8df739da
......@@ -245,7 +245,7 @@ void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) {
// Slow case: Load name and receiver from stack and jump to runtime.
__ bind(&slow);
__ IncrementCounter(&Counters::keyed_load_generic_slow, 1);
KeyedLoadIC::Generate(masm, ExternalReference(Runtime::kGetProperty));
KeyedLoadIC::Generate(masm, ExternalReference(Runtime::kKeyedGetProperty));
// Check if the key is a symbol that is not an array index.
__ bind(&check_string);
__ mov(ebx, FieldOperand(eax, HeapObject::kMapOffset));
......
......@@ -2240,6 +2240,12 @@ void Map::ClearCodeCache() {
}
void JSArray::SetContent(FixedArray* storage) {
set_length(Smi::FromInt(storage->length()));
set_elements(storage);
}
#undef CAST_ACCESSOR
#undef INT_ACCESSORS
#undef SMI_ACCESSORS
......
......@@ -4381,12 +4381,6 @@ Object* JSArray::Initialize(int capacity) {
}
void JSArray::SetContent(FixedArray* storage) {
set_length(Smi::FromInt(storage->length()));
set_elements(storage);
}
// Computes the new capacity when expanding the elements of a JSObject.
static int NewElementsCapacity(int old_capacity) {
// (old_capacity + 50%) + 16
......
......@@ -3534,7 +3534,7 @@ class JSArray: public JSObject {
Object* Initialize(int capacity);
// Set the content of the array to the content of storage.
void SetContent(FixedArray* storage);
inline void SetContent(FixedArray* storage);
// Support for sorting
Object* RemoveHoles();
......
......@@ -198,7 +198,6 @@ class LookupResult BASE_EMBEDDED {
lookup_type_ = NOT_FOUND;
}
JSObject* holder() {
ASSERT(IsValid());
return holder_;
......
......@@ -1453,6 +1453,29 @@ static Object* Runtime_GetProperty(Arguments args) {
}
// KeyedStringGetProperty is called from KeyedLoadIC::GenerateGeneric
static Object* Runtime_KeyedGetProperty(Arguments args) {
NoHandleAllocation ha;
ASSERT(args.length() == 2);
Object* receiver = args[0];
Object* key = args[1];
if (receiver->IsJSObject() &&
key->IsString() &&
!JSObject::cast(receiver)->HasFastProperties()) {
Dictionary* dictionary = JSObject::cast(receiver)->property_dictionary();
int entry = dictionary->FindStringEntry(String::cast(key));
if ((entry != DescriptorArray::kNotFound)
&& (dictionary->DetailsAt(entry).type() == NORMAL)) {
return dictionary->ValueAt(entry);
}
}
return Runtime::GetObjectProperty(args.at<Object>(0),
args.at<Object>(1));
}
Object* Runtime::SetObjectProperty(Handle<Object> object,
Handle<Object> key,
Handle<Object> value,
......
......@@ -40,6 +40,7 @@ namespace v8 { namespace internal {
#define RUNTIME_FUNCTION_LIST_ALWAYS(F) \
/* Property access */ \
F(GetProperty, 2) \
F(KeyedGetProperty, 2) \
F(DeleteProperty, 2) \
F(HasLocalProperty, 2) \
F(HasProperty, 2) \
......
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