Commit cd98b0c8 authored by verwaest@chromium.org's avatar verwaest@chromium.org

Removed CopyAppendForeignDescriptor.

Use descriptor array preallocation + appending instead.

Review URL: https://chromiumcodereview.appspot.com/10782033

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12133 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 25d4eeaf
This diff is collapsed.
...@@ -886,29 +886,6 @@ Handle<Code> Factory::CopyCode(Handle<Code> code, Vector<byte> reloc_info) { ...@@ -886,29 +886,6 @@ Handle<Code> Factory::CopyCode(Handle<Code> code, Vector<byte> reloc_info) {
} }
MUST_USE_RESULT static inline MaybeObject* DoCopyAdd(
DescriptorArray* array,
String* key,
Object* value,
PropertyAttributes attributes) {
CallbacksDescriptor desc(key, value, attributes);
MaybeObject* obj = array->CopyAdd(&desc);
return obj;
}
// Allocate the new array.
Handle<DescriptorArray> Factory::CopyAppendForeignDescriptor(
Handle<DescriptorArray> array,
Handle<String> key,
Handle<Object> value,
PropertyAttributes attributes) {
CALL_HEAP_FUNCTION(isolate(),
DoCopyAdd(*array, *key, *value, attributes),
DescriptorArray);
}
Handle<String> Factory::SymbolFromString(Handle<String> value) { Handle<String> Factory::SymbolFromString(Handle<String> value) {
CALL_HEAP_FUNCTION(isolate(), CALL_HEAP_FUNCTION(isolate(),
isolate()->heap()->LookupSymbol(*value), String); isolate()->heap()->LookupSymbol(*value), String);
......
...@@ -385,12 +385,6 @@ class Factory { ...@@ -385,12 +385,6 @@ class Factory {
Handle<JSFunction> NewFunctionWithoutPrototype(Handle<String> name, Handle<JSFunction> NewFunctionWithoutPrototype(Handle<String> name,
Handle<Code> code); Handle<Code> code);
Handle<DescriptorArray> CopyAppendForeignDescriptor(
Handle<DescriptorArray> array,
Handle<String> key,
Handle<Object> value,
PropertyAttributes attributes);
Handle<String> NumberToString(Handle<Object> number); Handle<String> NumberToString(Handle<Object> number);
Handle<String> Uint32ToString(uint32_t value); Handle<String> Uint32ToString(uint32_t value);
......
...@@ -151,12 +151,22 @@ TEST(StressJS) { ...@@ -151,12 +151,22 @@ TEST(StressJS) {
Handle<Map> map(function->initial_map()); Handle<Map> map(function->initial_map());
Handle<DescriptorArray> instance_descriptors(map->instance_descriptors()); Handle<DescriptorArray> instance_descriptors(map->instance_descriptors());
Handle<Foreign> foreign = FACTORY->NewForeign(&kDescriptor); Handle<Foreign> foreign = FACTORY->NewForeign(&kDescriptor);
instance_descriptors = FACTORY->CopyAppendForeignDescriptor( Handle<String> name =
instance_descriptors, FACTORY->NewStringFromAscii(Vector<const char>("get", 3));
FACTORY->NewStringFromAscii(Vector<const char>("get", 3)), ASSERT(instance_descriptors->IsEmpty());
foreign,
static_cast<PropertyAttributes>(0)); Handle<DescriptorArray> new_descriptors = FACTORY->NewDescriptorArray(1);
map->set_instance_descriptors(*instance_descriptors);
v8::internal::DescriptorArray::WhitenessWitness witness(*new_descriptors);
CallbacksDescriptor d(*name,
*foreign,
static_cast<PropertyAttributes>(0),
v8::internal::PropertyDetails::kInitialIndex);
new_descriptors->Set(0, &d, witness);
new_descriptors->SetLastAdded(0);
map->set_instance_descriptors(*new_descriptors);
// Add the Foo constructor the global object. // Add the Foo constructor the global object.
env->Global()->Set(v8::String::New("Foo"), v8::Utils::ToLocal(function)); env->Global()->Set(v8::String::New("Foo"), v8::Utils::ToLocal(function));
// Call the accessor through JavaScript. // Call the accessor through JavaScript.
......
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