Author: [EMAIL PROTECTED]
Date: Fri Oct 10 03:27:44 2008
New Revision: 487
Modified:
branches/bleeding_edge/src/ic-ia32.cc
branches/bleeding_edge/src/objects-inl.h
branches/bleeding_edge/src/objects.cc
branches/bleeding_edge/src/objects.h
branches/bleeding_edge/src/property.h
branches/bleeding_edge/src/runtime.cc
branches/bleeding_edge/src/runtime.h
Log:
- Inlined JSArray::SetContent.
- Implemented Runtime_KeyedGetProperty to make slow case faster.
Review URL: http://codereview.chromium.org/7226
Modified: branches/bleeding_edge/src/ic-ia32.cc
==============================================================================
--- branches/bleeding_edge/src/ic-ia32.cc (original)
+++ branches/bleeding_edge/src/ic-ia32.cc Fri Oct 10 03:27:44 2008
@@ -245,7 +245,7 @@
// 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));
Modified: branches/bleeding_edge/src/objects-inl.h
==============================================================================
--- branches/bleeding_edge/src/objects-inl.h (original)
+++ branches/bleeding_edge/src/objects-inl.h Fri Oct 10 03:27:44 2008
@@ -2240,6 +2240,12 @@
}
+void JSArray::SetContent(FixedArray* storage) {
+ set_length(Smi::FromInt(storage->length()));
+ set_elements(storage);
+}
+
+
#undef CAST_ACCESSOR
#undef INT_ACCESSORS
#undef SMI_ACCESSORS
Modified: branches/bleeding_edge/src/objects.cc
==============================================================================
--- branches/bleeding_edge/src/objects.cc (original)
+++ branches/bleeding_edge/src/objects.cc Fri Oct 10 03:27:44 2008
@@ -4381,12 +4381,6 @@
}
-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
Modified: branches/bleeding_edge/src/objects.h
==============================================================================
--- branches/bleeding_edge/src/objects.h (original)
+++ branches/bleeding_edge/src/objects.h Fri Oct 10 03:27:44 2008
@@ -3534,7 +3534,7 @@
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();
Modified: branches/bleeding_edge/src/property.h
==============================================================================
--- branches/bleeding_edge/src/property.h (original)
+++ branches/bleeding_edge/src/property.h Fri Oct 10 03:27:44 2008
@@ -198,7 +198,6 @@
lookup_type_ = NOT_FOUND;
}
-
JSObject* holder() {
ASSERT(IsValid());
return holder_;
Modified: branches/bleeding_edge/src/runtime.cc
==============================================================================
--- branches/bleeding_edge/src/runtime.cc (original)
+++ branches/bleeding_edge/src/runtime.cc Fri Oct 10 03:27:44 2008
@@ -1453,6 +1453,29 @@
}
+
+// 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,
Modified: branches/bleeding_edge/src/runtime.h
==============================================================================
--- branches/bleeding_edge/src/runtime.h (original)
+++ branches/bleeding_edge/src/runtime.h Fri Oct 10 03:27:44 2008
@@ -40,6 +40,7 @@
#define RUNTIME_FUNCTION_LIST_ALWAYS(F) \
/* Property access */ \
F(GetProperty, 2) \
+ F(KeyedGetProperty, 2) \
F(DeleteProperty, 2) \
F(HasLocalProperty, 2) \
F(HasProperty, 2) \
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---