Index: src/runtime.cc |
diff --git a/src/runtime.cc b/src/runtime.cc |
index 78efc8dbe42727523fc04467884c86fe3658f38e..c5258d6749b1eef8e64a6146997d5e4ac3c2eb69 100644 |
--- a/src/runtime.cc |
+++ b/src/runtime.cc |
@@ -3898,6 +3898,33 @@ MaybeObject* Runtime::GetElementOrCharAt(Isolate* isolate, |
} |
+MaybeObject* Runtime::HasObjectProperty(Isolate* isolate, |
+ Handle<JSReceiver> object, |
+ Handle<Object> key) { |
+ HandleScope scope(isolate); |
+ |
+ // Check if the given key is an array index. |
+ uint32_t index; |
+ if (key->ToArrayIndex(&index)) { |
+ return isolate->heap()->ToBoolean(object->HasElement(index)); |
+ } |
+ |
+ // Convert the key to a name - possibly by calling back into JavaScript. |
+ Handle<Name> name; |
+ if (key->IsName()) { |
+ name = Handle<Name>::cast(key); |
+ } else { |
+ bool has_pending_exception = false; |
+ Handle<Object> converted = |
+ Execution::ToString(key, &has_pending_exception); |
+ if (has_pending_exception) return Failure::Exception(); |
+ name = Handle<Name>::cast(converted); |
+ } |
+ |
+ return isolate->heap()->ToBoolean(object->HasProperty(*name)); |
+} |
+ |
+ |
MaybeObject* Runtime::GetObjectProperty(Isolate* isolate, |
Handle<Object> object, |
Handle<Object> key) { |
@@ -4323,9 +4350,10 @@ MaybeObject* Runtime::ForceSetObjectProperty(Isolate* isolate, |
} |
-MaybeObject* Runtime::ForceDeleteObjectProperty(Isolate* isolate, |
- Handle<JSReceiver> receiver, |
- Handle<Object> key) { |
+MaybeObject* Runtime::DeleteObjectProperty(Isolate* isolate, |
+ Handle<JSReceiver> receiver, |
+ Handle<Object> key, |
+ JSReceiver::DeleteMode mode) { |
HandleScope scope(isolate); |
// Check if the given key is an array index. |
@@ -4341,7 +4369,7 @@ MaybeObject* Runtime::ForceDeleteObjectProperty(Isolate* isolate, |
return isolate->heap()->true_value(); |
} |
- return receiver->DeleteElement(index, JSReceiver::FORCE_DELETION); |
+ return receiver->DeleteElement(index, mode); |
} |
Handle<Name> name; |
@@ -4356,7 +4384,7 @@ MaybeObject* Runtime::ForceDeleteObjectProperty(Isolate* isolate, |
} |
if (name->IsString()) Handle<String>::cast(name)->TryFlatten(); |
- return receiver->DeleteProperty(*name, JSReceiver::FORCE_DELETION); |
+ return receiver->DeleteProperty(*name, mode); |
} |