- 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
// 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));
}
+void JSArray::SetContent(FixedArray* storage) {
+ set_length(Smi::FromInt(storage->length()));
+ set_elements(storage);
+}
+
+
#undef CAST_ACCESSOR
#undef INT_ACCESSORS
#undef SMI_ACCESSORS
}
-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
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();
lookup_type_ = NOT_FOUND;
}
-
JSObject* holder() {
ASSERT(IsValid());
return holder_;
}
+
+// 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,
#define RUNTIME_FUNCTION_LIST_ALWAYS(F) \
/* Property access */ \
F(GetProperty, 2) \
+ F(KeyedGetProperty, 2) \
F(DeleteProperty, 2) \
F(HasLocalProperty, 2) \
F(HasProperty, 2) \