Index: src/runtime.cc |
diff --git a/src/runtime.cc b/src/runtime.cc |
index 81c03657c63f6940f8adacd4a5733ccd293daaa6..36d85c502cac7a7e1f85826066f0deb5d5b5eb75 100644 |
--- a/src/runtime.cc |
+++ b/src/runtime.cc |
@@ -4193,6 +4193,14 @@ MaybeObject* Runtime::SetObjectProperty(Isolate* isolate, |
return isolate->Throw(*error); |
} |
+ if (object->IsJSProxy()) { |
+ bool has_pending_exception = false; |
+ Handle<Object> name = Execution::ToString(key, &has_pending_exception); |
+ if (has_pending_exception) return Failure::Exception(); |
+ return JSProxy::cast(*object)->SetProperty( |
+ String::cast(*name), *value, attr, strict_mode); |
+ } |
+ |
// If the object isn't a JavaScript object, we ignore the store. |
if (!object->IsJSObject()) return *value; |
@@ -4312,7 +4320,7 @@ MaybeObject* Runtime::ForceDeleteObjectProperty(Isolate* isolate, |
// Check if the given key is an array index. |
uint32_t index; |
- if (receiver->IsJSObject() && key->ToArrayIndex(&index)) { |
+ if (key->ToArrayIndex(&index)) { |
// In Firefox/SpiderMonkey, Safari and Opera you can access the |
// characters of a string using [] notation. In the case of a |
// String object we just need to redirect the deletion to the |
@@ -4323,8 +4331,7 @@ MaybeObject* Runtime::ForceDeleteObjectProperty(Isolate* isolate, |
return isolate->heap()->true_value(); |
} |
- return JSObject::cast(*receiver)->DeleteElement( |
- index, JSReceiver::FORCE_DELETION); |
+ return receiver->DeleteElement(index, JSReceiver::FORCE_DELETION); |
} |
Handle<String> key_string; |
@@ -4486,31 +4493,24 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_HasLocalProperty) { |
RUNTIME_FUNCTION(MaybeObject*, Runtime_HasProperty) { |
NoHandleAllocation na; |
ASSERT(args.length() == 2); |
+ CONVERT_CHECKED(JSReceiver, receiver, args[0]); |
+ CONVERT_CHECKED(String, key, args[1]); |
- // Only JS receivers can have properties. |
- if (args[0]->IsJSReceiver()) { |
- JSReceiver* receiver = JSReceiver::cast(args[0]); |
- CONVERT_CHECKED(String, key, args[1]); |
- bool result = receiver->HasProperty(key); |
- if (isolate->has_pending_exception()) return Failure::Exception(); |
- return isolate->heap()->ToBoolean(result); |
- } |
- return isolate->heap()->false_value(); |
+ bool result = receiver->HasProperty(key); |
+ if (isolate->has_pending_exception()) return Failure::Exception(); |
+ return isolate->heap()->ToBoolean(result); |
} |
RUNTIME_FUNCTION(MaybeObject*, Runtime_HasElement) { |
NoHandleAllocation na; |
ASSERT(args.length() == 2); |
+ CONVERT_CHECKED(JSReceiver, receiver, args[0]); |
+ CONVERT_CHECKED(Smi, index, args[1]); |
- // Only JS objects can have elements. |
- if (args[0]->IsJSObject()) { |
- JSObject* object = JSObject::cast(args[0]); |
- CONVERT_CHECKED(Smi, index_obj, args[1]); |
- uint32_t index = index_obj->value(); |
- if (object->HasElement(index)) return isolate->heap()->true_value(); |
- } |
- return isolate->heap()->false_value(); |
+ bool result = receiver->HasElement(index->value()); |
+ if (isolate->has_pending_exception()) return Failure::Exception(); |
+ return isolate->heap()->ToBoolean(result); |
} |