Revert "Use trampoline or handlified JSObject::SetLocalPropertyIgnoreAttributes".

This was reverted due to performance regressions on Sunspider and other
benchmarks due to double GCs caused by the trampoline.

R=verwaest@chromium.org

Review URL: https://codereview.chromium.org/23435006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16659 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ea43b5ea
...@@ -113,7 +113,7 @@ MaybeObject* Accessors::ArraySetLength(Isolate* isolate, ...@@ -113,7 +113,7 @@ MaybeObject* Accessors::ArraySetLength(Isolate* isolate,
// object does not have a 'length' property. Calling SetProperty // object does not have a 'length' property. Calling SetProperty
// causes an infinite loop. // causes an infinite loop.
if (!object->IsJSArray()) { if (!object->IsJSArray()) {
return object->SetLocalPropertyIgnoreAttributesTrampoline( return object->SetLocalPropertyIgnoreAttributes(
isolate->heap()->length_string(), value, NONE); isolate->heap()->length_string(), value, NONE);
} }
...@@ -531,8 +531,9 @@ MaybeObject* Accessors::FunctionSetPrototype(Isolate* isolate, ...@@ -531,8 +531,9 @@ MaybeObject* Accessors::FunctionSetPrototype(Isolate* isolate,
if (function_raw == NULL) return heap->undefined_value(); if (function_raw == NULL) return heap->undefined_value();
if (!function_raw->should_have_prototype()) { if (!function_raw->should_have_prototype()) {
// Since we hit this accessor, object will have no prototype property. // Since we hit this accessor, object will have no prototype property.
return object->SetLocalPropertyIgnoreAttributesTrampoline( return object->SetLocalPropertyIgnoreAttributes(heap->prototype_string(),
heap->prototype_string(), value_raw, NONE); value_raw,
NONE);
} }
HandleScope scope(isolate); HandleScope scope(isolate);
......
...@@ -4371,7 +4371,7 @@ MaybeObject* Heap::AllocateFunctionPrototype(JSFunction* function) { ...@@ -4371,7 +4371,7 @@ MaybeObject* Heap::AllocateFunctionPrototype(JSFunction* function) {
if (!function->shared()->is_generator()) { if (!function->shared()->is_generator()) {
MaybeObject* maybe_failure = MaybeObject* maybe_failure =
JSObject::cast(prototype)->SetLocalPropertyIgnoreAttributesTrampoline( JSObject::cast(prototype)->SetLocalPropertyIgnoreAttributes(
constructor_string(), function, DONT_ENUM); constructor_string(), function, DONT_ENUM);
if (maybe_failure->IsFailure()) return maybe_failure; if (maybe_failure->IsFailure()) return maybe_failure;
} }
......
...@@ -2188,6 +2188,13 @@ class JSObject: public JSReceiver { ...@@ -2188,6 +2188,13 @@ class JSObject: public JSReceiver {
inline MUST_USE_RESULT MaybeObject* TryMigrateInstance(); inline MUST_USE_RESULT MaybeObject* TryMigrateInstance();
// Can cause GC. // Can cause GC.
MUST_USE_RESULT MaybeObject* SetLocalPropertyIgnoreAttributes(
Name* key,
Object* value,
PropertyAttributes attributes,
ValueType value_type = OPTIMAL_REPRESENTATION,
StoreMode mode = ALLOW_AS_CONSTANT,
ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK);
MUST_USE_RESULT MaybeObject* SetLocalPropertyIgnoreAttributesTrampoline( MUST_USE_RESULT MaybeObject* SetLocalPropertyIgnoreAttributesTrampoline(
Name* key, Name* key,
Object* value, Object* value,
...@@ -2729,15 +2736,6 @@ class JSObject: public JSReceiver { ...@@ -2729,15 +2736,6 @@ class JSObject: public JSReceiver {
friend class DictionaryElementsAccessor; friend class DictionaryElementsAccessor;
friend class JSReceiver; friend class JSReceiver;
// TODO(mstarzinger): Soon to be handlified.
MUST_USE_RESULT MaybeObject* SetLocalPropertyIgnoreAttributes(
Name* key,
Object* value,
PropertyAttributes attributes,
ValueType value_type = OPTIMAL_REPRESENTATION,
StoreMode mode = ALLOW_AS_CONSTANT,
ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK);
MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver, MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver,
Object* structure, Object* structure,
uint32_t index, uint32_t index,
......
...@@ -2276,13 +2276,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeConstGlobal) { ...@@ -2276,13 +2276,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeConstGlobal) {
LookupResult lookup(isolate); LookupResult lookup(isolate);
global->LocalLookup(*name, &lookup); global->LocalLookup(*name, &lookup);
if (!lookup.IsFound()) { if (!lookup.IsFound()) {
HandleScope handle_scope(isolate); return global->SetLocalPropertyIgnoreAttributes(*name,
Handle<GlobalObject> global(isolate->context()->global_object()); *value,
RETURN_IF_EMPTY_HANDLE( attributes);
isolate,
JSObject::SetLocalPropertyIgnoreAttributes(global, name, value,
attributes));
return *value;
} }
if (!lookup.IsReadOnly()) { if (!lookup.IsReadOnly()) {
...@@ -2499,41 +2495,41 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpConstructResult) { ...@@ -2499,41 +2495,41 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpConstructResult) {
RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpInitializeObject) { RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpInitializeObject) {
HandleScope scope(isolate); SealHandleScope shs(isolate);
DisallowHeapAllocation no_allocation; DisallowHeapAllocation no_allocation;
ASSERT(args.length() == 5); ASSERT(args.length() == 5);
CONVERT_ARG_HANDLE_CHECKED(JSRegExp, regexp, 0); CONVERT_ARG_CHECKED(JSRegExp, regexp, 0);
CONVERT_ARG_HANDLE_CHECKED(String, source, 1); CONVERT_ARG_CHECKED(String, source, 1);
// If source is the empty string we set it to "(?:)" instead as // If source is the empty string we set it to "(?:)" instead as
// suggested by ECMA-262, 5th, section 15.10.4.1. // suggested by ECMA-262, 5th, section 15.10.4.1.
if (source->length() == 0) source = isolate->factory()->query_colon_string(); if (source->length() == 0) source = isolate->heap()->query_colon_string();
CONVERT_ARG_HANDLE_CHECKED(Object, global, 2); Object* global = args[2];
if (!global->IsTrue()) global = isolate->factory()->false_value(); if (!global->IsTrue()) global = isolate->heap()->false_value();
CONVERT_ARG_HANDLE_CHECKED(Object, ignoreCase, 3); Object* ignoreCase = args[3];
if (!ignoreCase->IsTrue()) ignoreCase = isolate->factory()->false_value(); if (!ignoreCase->IsTrue()) ignoreCase = isolate->heap()->false_value();
CONVERT_ARG_HANDLE_CHECKED(Object, multiline, 4); Object* multiline = args[4];
if (!multiline->IsTrue()) multiline = isolate->factory()->false_value(); if (!multiline->IsTrue()) multiline = isolate->heap()->false_value();
Map* map = regexp->map(); Map* map = regexp->map();
Object* constructor = map->constructor(); Object* constructor = map->constructor();
if (constructor->IsJSFunction() && if (constructor->IsJSFunction() &&
JSFunction::cast(constructor)->initial_map() == map) { JSFunction::cast(constructor)->initial_map() == map) {
// If we still have the original map, set in-object properties directly. // If we still have the original map, set in-object properties directly.
regexp->InObjectPropertyAtPut(JSRegExp::kSourceFieldIndex, *source); regexp->InObjectPropertyAtPut(JSRegExp::kSourceFieldIndex, source);
// Both true and false are immovable immortal objects so no need for write // Both true and false are immovable immortal objects so no need for write
// barrier. // barrier.
regexp->InObjectPropertyAtPut( regexp->InObjectPropertyAtPut(
JSRegExp::kGlobalFieldIndex, *global, SKIP_WRITE_BARRIER); JSRegExp::kGlobalFieldIndex, global, SKIP_WRITE_BARRIER);
regexp->InObjectPropertyAtPut( regexp->InObjectPropertyAtPut(
JSRegExp::kIgnoreCaseFieldIndex, *ignoreCase, SKIP_WRITE_BARRIER); JSRegExp::kIgnoreCaseFieldIndex, ignoreCase, SKIP_WRITE_BARRIER);
regexp->InObjectPropertyAtPut( regexp->InObjectPropertyAtPut(
JSRegExp::kMultilineFieldIndex, *multiline, SKIP_WRITE_BARRIER); JSRegExp::kMultilineFieldIndex, multiline, SKIP_WRITE_BARRIER);
regexp->InObjectPropertyAtPut( regexp->InObjectPropertyAtPut(
JSRegExp::kLastIndexFieldIndex, Smi::FromInt(0), SKIP_WRITE_BARRIER); JSRegExp::kLastIndexFieldIndex, Smi::FromInt(0), SKIP_WRITE_BARRIER);
return *regexp; return regexp;
} }
// Map has changed, so use generic, but slower, method. // Map has changed, so use generic, but slower, method.
...@@ -2541,19 +2537,34 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpInitializeObject) { ...@@ -2541,19 +2537,34 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpInitializeObject) {
static_cast<PropertyAttributes>(READ_ONLY | DONT_ENUM | DONT_DELETE); static_cast<PropertyAttributes>(READ_ONLY | DONT_ENUM | DONT_DELETE);
PropertyAttributes writable = PropertyAttributes writable =
static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE); static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE);
Handle<Object> zero(Smi::FromInt(0), isolate); Heap* heap = isolate->heap();
Factory* factory = isolate->factory(); MaybeObject* result;
CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetLocalPropertyIgnoreAttributes( result = regexp->SetLocalPropertyIgnoreAttributes(heap->source_string(),
regexp, factory->source_string(), source, final)); source,
CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetLocalPropertyIgnoreAttributes( final);
regexp, factory->global_string(), global, final)); // TODO(jkummerow): Turn these back into ASSERTs when we can be certain
CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetLocalPropertyIgnoreAttributes( // that it never fires in Release mode in the wild.
regexp, factory->ignore_case_string(), ignoreCase, final)); CHECK(!result->IsFailure());
CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetLocalPropertyIgnoreAttributes( result = regexp->SetLocalPropertyIgnoreAttributes(heap->global_string(),
regexp, factory->multiline_string(), multiline, final)); global,
CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetLocalPropertyIgnoreAttributes( final);
regexp, factory->last_index_string(), zero, writable)); CHECK(!result->IsFailure());
return *regexp; result =
regexp->SetLocalPropertyIgnoreAttributes(heap->ignore_case_string(),
ignoreCase,
final);
CHECK(!result->IsFailure());
result = regexp->SetLocalPropertyIgnoreAttributes(heap->multiline_string(),
multiline,
final);
CHECK(!result->IsFailure());
result =
regexp->SetLocalPropertyIgnoreAttributes(heap->last_index_string(),
Smi::FromInt(0),
writable);
CHECK(!result->IsFailure());
USE(result);
return regexp;
} }
...@@ -5053,10 +5064,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DefineOrRedefineDataProperty) { ...@@ -5053,10 +5064,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DefineOrRedefineDataProperty) {
JSObject::NormalizeProperties(js_object, CLEAR_INOBJECT_PROPERTIES, 0); JSObject::NormalizeProperties(js_object, CLEAR_INOBJECT_PROPERTIES, 0);
// Use IgnoreAttributes version since a readonly property may be // Use IgnoreAttributes version since a readonly property may be
// overridden and SetProperty does not allow this. // overridden and SetProperty does not allow this.
Handle<Object> result = JSObject::SetLocalPropertyIgnoreAttributes( return js_object->SetLocalPropertyIgnoreAttributes(*name,
js_object, name, obj_value, attr); *obj_value,
RETURN_IF_EMPTY_HANDLE(isolate, result); attr);
return *result;
} }
return Runtime::ForceSetObjectProperty(isolate, return Runtime::ForceSetObjectProperty(isolate,
...@@ -5242,10 +5252,7 @@ MaybeObject* Runtime::ForceSetObjectProperty(Isolate* isolate, ...@@ -5242,10 +5252,7 @@ MaybeObject* Runtime::ForceSetObjectProperty(Isolate* isolate,
index, *value, attr, kNonStrictMode, false, DEFINE_PROPERTY); index, *value, attr, kNonStrictMode, false, DEFINE_PROPERTY);
} else { } else {
if (name->IsString()) Handle<String>::cast(name)->TryFlatten(); if (name->IsString()) Handle<String>::cast(name)->TryFlatten();
Handle<Object> result = JSObject::SetLocalPropertyIgnoreAttributes( return js_object->SetLocalPropertyIgnoreAttributes(*name, *value, attr);
js_object, name, value, attr);
RETURN_IF_EMPTY_HANDLE(isolate, result);
return *result;
} }
} }
...@@ -5260,10 +5267,7 @@ MaybeObject* Runtime::ForceSetObjectProperty(Isolate* isolate, ...@@ -5260,10 +5267,7 @@ MaybeObject* Runtime::ForceSetObjectProperty(Isolate* isolate,
return js_object->SetElement( return js_object->SetElement(
index, *value, attr, kNonStrictMode, false, DEFINE_PROPERTY); index, *value, attr, kNonStrictMode, false, DEFINE_PROPERTY);
} else { } else {
Handle<Object> result = JSObject::SetLocalPropertyIgnoreAttributes( return js_object->SetLocalPropertyIgnoreAttributes(*name, *value, attr);
js_object, name, value, attr);
RETURN_IF_EMPTY_HANDLE(isolate, result);
return *result;
} }
} }
...@@ -5466,11 +5470,10 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugPrepareStepInIfStepping) { ...@@ -5466,11 +5470,10 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugPrepareStepInIfStepping) {
// Set a local property, even if it is READ_ONLY. If the property does not // Set a local property, even if it is READ_ONLY. If the property does not
// exist, it will be added with attributes NONE. // exist, it will be added with attributes NONE.
RUNTIME_FUNCTION(MaybeObject*, Runtime_IgnoreAttributesAndSetProperty) { RUNTIME_FUNCTION(MaybeObject*, Runtime_IgnoreAttributesAndSetProperty) {
HandleScope scope(isolate); SealHandleScope shs(isolate);
RUNTIME_ASSERT(args.length() == 3 || args.length() == 4); RUNTIME_ASSERT(args.length() == 3 || args.length() == 4);
CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0); CONVERT_ARG_CHECKED(JSObject, object, 0);
CONVERT_ARG_HANDLE_CHECKED(Name, name, 1); CONVERT_ARG_CHECKED(Name, name, 1);
CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
// Compute attributes. // Compute attributes.
PropertyAttributes attributes = NONE; PropertyAttributes attributes = NONE;
if (args.length() == 4) { if (args.length() == 4) {
...@@ -5480,10 +5483,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_IgnoreAttributesAndSetProperty) { ...@@ -5480,10 +5483,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_IgnoreAttributesAndSetProperty) {
(unchecked_value & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0); (unchecked_value & ~(READ_ONLY | DONT_ENUM | DONT_DELETE)) == 0);
attributes = static_cast<PropertyAttributes>(unchecked_value); attributes = static_cast<PropertyAttributes>(unchecked_value);
} }
Handle<Object> result = JSObject::SetLocalPropertyIgnoreAttributes(
object, name, value, attributes); return object->
RETURN_IF_EMPTY_HANDLE(isolate, result); SetLocalPropertyIgnoreAttributes(name, args[2], attributes);
return *result;
} }
......
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