Use raw-to-handle trampoline in [Get/Set]HiddenPropertiesHashTable.

R=danno@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16623 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
mstarzinger@chromium.org 2013-09-10 14:33:06 +00:00
parent 47e86b889e
commit 448d98e19d
3 changed files with 67 additions and 17 deletions

View File

@ -639,6 +639,24 @@ class IdempotentPointerToHandleCodeTrampoline {
: reinterpret_cast<MaybeObject*>(Failure::RetryAfterGC()); : reinterpret_cast<MaybeObject*>(Failure::RetryAfterGC());
} }
template<typename R, typename P1, typename P2, typename P3, typename P4,
typename P5, typename P6, typename P7>
MUST_USE_RESULT MaybeObject* CallWithReturnValue(
R (*function)(P1, P2, P3, P4, P5, P6, P7),
P1 p1,
P2 p2,
P3 p3,
P4 p4,
P5 p5,
P6 p6,
P7 p7) {
int collections = isolate_->heap()->gc_count();
Handle<Object> result = (*function)(p1, p2, p3, p4, p5, p6, p7);
return (collections == isolate_->heap()->gc_count())
? *result
: reinterpret_cast<MaybeObject*>(Failure::RetryAfterGC());
}
private: private:
Isolate* isolate_; Isolate* isolate_;
}; };

View File

@ -4029,6 +4029,29 @@ MaybeObject* JSObject::SetPropertyForResult(LookupResult* lookup,
} }
MaybeObject* JSObject::SetLocalPropertyIgnoreAttributesTrampoline(
Name* key,
Object* value,
PropertyAttributes attributes,
ValueType value_type,
StoreMode mode,
ExtensibilityCheck extensibility_check) {
// TODO(mstarzinger): The trampoline is a giant hack, don't use it anywhere
// else or handlification people will start hating you for all eternity.
HandleScope scope(GetIsolate());
IdempotentPointerToHandleCodeTrampoline trampoline(GetIsolate());
return trampoline.CallWithReturnValue(
&JSObject::SetLocalPropertyIgnoreAttributes,
Handle<JSObject>(this),
Handle<Name>(key),
Handle<Object>(value, GetIsolate()),
attributes,
value_type,
mode,
extensibility_check);
}
// Set a real local property, even if it is READ_ONLY. If the property is not // Set a real local property, even if it is READ_ONLY. If the property is not
// present, add it with attributes NONE. This code is an exact clone of // present, add it with attributes NONE. This code is an exact clone of
// SetProperty, with the check for IsReadOnly and the check for a // SetProperty, with the check for IsReadOnly and the check for a
@ -4044,11 +4067,12 @@ Handle<Object> JSObject::SetLocalPropertyIgnoreAttributes(
Handle<Object> value, Handle<Object> value,
PropertyAttributes attributes, PropertyAttributes attributes,
ValueType value_type, ValueType value_type,
StoreMode mode) { StoreMode mode,
ExtensibilityCheck extensibility_check) {
CALL_HEAP_FUNCTION( CALL_HEAP_FUNCTION(
object->GetIsolate(), object->GetIsolate(),
object->SetLocalPropertyIgnoreAttributes( object->SetLocalPropertyIgnoreAttributes(
*key, *value, attributes, value_type, mode), *key, *value, attributes, value_type, mode, extensibility_check),
Object); Object);
} }
@ -4951,8 +4975,8 @@ MaybeObject* JSObject::GetHiddenPropertiesHashTable(
ASSERT_EQ(hashtable, new_table); ASSERT_EQ(hashtable, new_table);
} }
MaybeObject* store_result = MaybeObject* store_result = SetLocalPropertyIgnoreAttributesTrampoline(
SetLocalPropertyIgnoreAttributes(GetHeap()->hidden_string(), GetHeap()->hidden_string(),
hashtable, hashtable,
DONT_ENUM, DONT_ENUM,
OPTIMAL_REPRESENTATION, OPTIMAL_REPRESENTATION,
@ -4984,8 +5008,8 @@ MaybeObject* JSObject::SetHiddenPropertiesHashTable(Object* value) {
} }
} }
} }
MaybeObject* store_result = MaybeObject* store_result = SetLocalPropertyIgnoreAttributesTrampoline(
SetLocalPropertyIgnoreAttributes(GetHeap()->hidden_string(), GetHeap()->hidden_string(),
value, value,
DONT_ENUM, DONT_ENUM,
OPTIMAL_REPRESENTATION, OPTIMAL_REPRESENTATION,

View File

@ -2163,7 +2163,8 @@ class JSObject: public JSReceiver {
Handle<Object> value, Handle<Object> value,
PropertyAttributes attributes, PropertyAttributes attributes,
ValueType value_type = OPTIMAL_REPRESENTATION, ValueType value_type = OPTIMAL_REPRESENTATION,
StoreMode mode = ALLOW_AS_CONSTANT); StoreMode mode = ALLOW_AS_CONSTANT,
ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK);
static inline Handle<String> ExpectedTransitionKey(Handle<Map> map); static inline Handle<String> ExpectedTransitionKey(Handle<Map> map);
static inline Handle<Map> ExpectedTransitionTarget(Handle<Map> map); static inline Handle<Map> ExpectedTransitionTarget(Handle<Map> map);
@ -2194,6 +2195,13 @@ class JSObject: public JSReceiver {
ValueType value_type = OPTIMAL_REPRESENTATION, ValueType value_type = OPTIMAL_REPRESENTATION,
StoreMode mode = ALLOW_AS_CONSTANT, StoreMode mode = ALLOW_AS_CONSTANT,
ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK); ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK);
MUST_USE_RESULT MaybeObject* SetLocalPropertyIgnoreAttributesTrampoline(
Name* key,
Object* value,
PropertyAttributes attributes,
ValueType value_type = OPTIMAL_REPRESENTATION,
StoreMode mode = ALLOW_AS_CONSTANT,
ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK);
// Retrieve a value in a normalized object given a lookup result. // Retrieve a value in a normalized object given a lookup result.
// Handles the special representation of JS global objects. // Handles the special representation of JS global objects.