diff options
author | Chris Dickinson <christopher.s.dickinson@gmail.com> | 2015-05-05 13:48:55 -0700 |
---|---|---|
committer | Rod Vagg <rod@vagg.org> | 2015-08-04 11:56:09 -0700 |
commit | d58e780504bdba6c5897c48428fd984c5b5f96fe (patch) | |
tree | 033f1568ae3f9f077aceb843b42eb1ed1739ce0f /deps/v8/src/runtime/runtime-object.cc | |
parent | 21d31c08e7d0b6865e52452750b20b05e6dca443 (diff) | |
download | android-node-v8-d58e780504bdba6c5897c48428fd984c5b5f96fe.tar.gz android-node-v8-d58e780504bdba6c5897c48428fd984c5b5f96fe.tar.bz2 android-node-v8-d58e780504bdba6c5897c48428fd984c5b5f96fe.zip |
deps: update v8 to 4.3.61.21
* @indutny's SealHandleScope patch (484bebc38319fc7c622478037922ad73b2edcbf9)
has been cherry picked onto the top of V8 to make it compile.
* There's some test breakage in contextify.
* This was merged at the request of the TC.
PR-URL: https://github.com/iojs/io.js/pull/1632
Diffstat (limited to 'deps/v8/src/runtime/runtime-object.cc')
-rw-r--r-- | deps/v8/src/runtime/runtime-object.cc | 108 |
1 files changed, 61 insertions, 47 deletions
diff --git a/deps/v8/src/runtime/runtime-object.cc b/deps/v8/src/runtime/runtime-object.cc index 96d9331038..c387b370fa 100644 --- a/deps/v8/src/runtime/runtime-object.cc +++ b/deps/v8/src/runtime/runtime-object.cc @@ -249,12 +249,10 @@ MaybeHandle<Object> Runtime::GetPrototype(Isolate* isolate, PrototypeIterator iter(isolate, obj, PrototypeIterator::START_AT_RECEIVER); do { if (PrototypeIterator::GetCurrent(iter)->IsAccessCheckNeeded() && - !isolate->MayNamedAccess( - Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)), - isolate->factory()->proto_string(), v8::ACCESS_GET)) { + !isolate->MayAccess( + Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)))) { isolate->ReportFailedAccessCheck( - Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)), - v8::ACCESS_GET); + Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter))); RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); return isolate->factory()->undefined_value(); } @@ -297,10 +295,8 @@ RUNTIME_FUNCTION(Runtime_SetPrototype) { DCHECK(args.length() == 2); CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); - if (obj->IsAccessCheckNeeded() && - !isolate->MayNamedAccess(obj, isolate->factory()->proto_string(), - v8::ACCESS_SET)) { - isolate->ReportFailedAccessCheck(obj, v8::ACCESS_SET); + if (obj->IsAccessCheckNeeded() && !isolate->MayAccess(obj)) { + isolate->ReportFailedAccessCheck(obj); RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); return isolate->heap()->undefined_value(); } @@ -372,8 +368,8 @@ MUST_USE_RESULT static MaybeHandle<Object> GetOwnProperty(Isolate* isolate, // Get attributes. Maybe<PropertyAttributes> maybe = JSReceiver::GetOwnElementAttribute(obj, index); - if (!maybe.has_value) return MaybeHandle<Object>(); - attrs = maybe.value; + if (!maybe.IsJust()) return MaybeHandle<Object>(); + attrs = maybe.FromJust(); if (attrs == ABSENT) return factory->undefined_value(); // Get AccessorPair if present. @@ -389,8 +385,8 @@ MUST_USE_RESULT static MaybeHandle<Object> GetOwnProperty(Isolate* isolate, // Get attributes. LookupIterator it(obj, name, LookupIterator::HIDDEN); Maybe<PropertyAttributes> maybe = JSObject::GetPropertyAttributes(&it); - if (!maybe.has_value) return MaybeHandle<Object>(); - attrs = maybe.value; + if (!maybe.IsJust()) return MaybeHandle<Object>(); + attrs = maybe.FromJust(); if (attrs == ABSENT) return factory->undefined_value(); // Get AccessorPair if present. @@ -609,6 +605,7 @@ RUNTIME_FUNCTION(Runtime_KeyedGetProperty) { (dictionary->DetailsAt(entry).type() == DATA)) { Object* value = dictionary->ValueAt(entry); if (!receiver->IsGlobalObject()) return value; + DCHECK(value->IsPropertyCell()); value = PropertyCell::cast(value)->value(); if (!value->IsTheHole()) return value; // If value is the hole (meaning, absent) do the general lookup. @@ -671,7 +668,7 @@ RUNTIME_FUNCTION(Runtime_AddNamedProperty) { DCHECK(!key->ToArrayIndex(&index)); LookupIterator it(object, key, LookupIterator::OWN_SKIP_INTERCEPTOR); Maybe<PropertyAttributes> maybe = JSReceiver::GetPropertyAttributes(&it); - if (!maybe.has_value) return isolate->heap()->exception(); + if (!maybe.IsJust()) return isolate->heap()->exception(); RUNTIME_ASSERT(!it.IsFound()); #endif @@ -740,8 +737,8 @@ static Object* HasOwnPropertyImplementation(Isolate* isolate, Handle<JSObject> object, Handle<Name> key) { Maybe<bool> maybe = JSReceiver::HasOwnProperty(object, key); - if (!maybe.has_value) return isolate->heap()->exception(); - if (maybe.value) return isolate->heap()->true_value(); + if (!maybe.IsJust()) return isolate->heap()->exception(); + if (maybe.FromJust()) return isolate->heap()->true_value(); // Handle hidden prototypes. If there's a hidden prototype above this thing // then we have to check it for properties, because they are supposed to // look like they are on this object. @@ -776,15 +773,15 @@ RUNTIME_FUNCTION(Runtime_HasOwnProperty) { // Fast case: either the key is a real named property or it is not // an array index and there are no interceptors or hidden // prototypes. - Maybe<bool> maybe; + Maybe<bool> maybe = Nothing<bool>(); if (key_is_array_index) { maybe = JSObject::HasOwnElement(js_obj, index); } else { maybe = JSObject::HasRealNamedProperty(js_obj, key); } - if (!maybe.has_value) return isolate->heap()->exception(); + if (!maybe.IsJust()) return isolate->heap()->exception(); DCHECK(!isolate->has_pending_exception()); - if (maybe.value) { + if (maybe.FromJust()) { return isolate->heap()->true_value(); } Map* map = js_obj->map(); @@ -813,8 +810,8 @@ RUNTIME_FUNCTION(Runtime_HasProperty) { CONVERT_ARG_HANDLE_CHECKED(Name, key, 1); Maybe<bool> maybe = JSReceiver::HasProperty(receiver, key); - if (!maybe.has_value) return isolate->heap()->exception(); - return isolate->heap()->ToBoolean(maybe.value); + if (!maybe.IsJust()) return isolate->heap()->exception(); + return isolate->heap()->ToBoolean(maybe.FromJust()); } @@ -825,8 +822,8 @@ RUNTIME_FUNCTION(Runtime_HasElement) { CONVERT_SMI_ARG_CHECKED(index, 1); Maybe<bool> maybe = JSReceiver::HasElement(receiver, index); - if (!maybe.has_value) return isolate->heap()->exception(); - return isolate->heap()->ToBoolean(maybe.value); + if (!maybe.IsJust()) return isolate->heap()->exception(); + return isolate->heap()->ToBoolean(maybe.FromJust()); } @@ -839,9 +836,9 @@ RUNTIME_FUNCTION(Runtime_IsPropertyEnumerable) { Maybe<PropertyAttributes> maybe = JSReceiver::GetOwnPropertyAttributes(object, key); - if (!maybe.has_value) return isolate->heap()->exception(); - if (maybe.value == ABSENT) maybe.value = DONT_ENUM; - return isolate->heap()->ToBoolean((maybe.value & DONT_ENUM) == 0); + if (!maybe.IsJust()) return isolate->heap()->exception(); + if (maybe.FromJust() == ABSENT) maybe = Just(DONT_ENUM); + return isolate->heap()->ToBoolean((maybe.FromJust() & DONT_ENUM) == 0); } @@ -917,10 +914,8 @@ RUNTIME_FUNCTION(Runtime_GetOwnPropertyNames) { // real global object. if (obj->IsJSGlobalProxy()) { // Only collect names if access is permitted. - if (obj->IsAccessCheckNeeded() && - !isolate->MayNamedAccess(obj, isolate->factory()->undefined_value(), - v8::ACCESS_KEYS)) { - isolate->ReportFailedAccessCheck(obj, v8::ACCESS_KEYS); + if (obj->IsAccessCheckNeeded() && !isolate->MayAccess(obj)) { + isolate->ReportFailedAccessCheck(obj); RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); return *isolate->factory()->NewJSArray(0); } @@ -941,11 +936,8 @@ RUNTIME_FUNCTION(Runtime_GetOwnPropertyNames) { Handle<JSObject> jsproto = Handle<JSObject>::cast(PrototypeIterator::GetCurrent(iter)); // Only collect names if access is permitted. - if (jsproto->IsAccessCheckNeeded() && - !isolate->MayNamedAccess(jsproto, - isolate->factory()->undefined_value(), - v8::ACCESS_KEYS)) { - isolate->ReportFailedAccessCheck(jsproto, v8::ACCESS_KEYS); + if (jsproto->IsAccessCheckNeeded() && !isolate->MayAccess(jsproto)) { + isolate->ReportFailedAccessCheck(jsproto); RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); return *isolate->factory()->NewJSArray(0); } @@ -1094,10 +1086,8 @@ RUNTIME_FUNCTION(Runtime_OwnKeys) { if (object->IsJSGlobalProxy()) { // Do access checks before going to the global object. - if (object->IsAccessCheckNeeded() && - !isolate->MayNamedAccess(object, isolate->factory()->undefined_value(), - v8::ACCESS_KEYS)) { - isolate->ReportFailedAccessCheck(object, v8::ACCESS_KEYS); + if (object->IsAccessCheckNeeded() && !isolate->MayAccess(object)) { + isolate->ReportFailedAccessCheck(object); RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); return *isolate->factory()->NewJSArray(0); } @@ -1442,7 +1432,7 @@ RUNTIME_FUNCTION(Runtime_DefineDataPropertyUnchecked) { LookupIterator it(js_object, name, LookupIterator::OWN_SKIP_INTERCEPTOR); if (it.IsFound() && it.state() == LookupIterator::ACCESS_CHECK) { - if (!isolate->MayNamedAccess(js_object, name, v8::ACCESS_SET)) { + if (!isolate->MayAccess(js_object)) { return isolate->heap()->undefined_value(); } it.Next(); @@ -1488,7 +1478,7 @@ RUNTIME_FUNCTION(Runtime_HasFastPackedElements) { } -RUNTIME_FUNCTION(RuntimeReference_ValueOf) { +RUNTIME_FUNCTION(Runtime_ValueOf) { SealHandleScope shs(isolate); DCHECK(args.length() == 1); CONVERT_ARG_CHECKED(Object, obj, 0); @@ -1497,7 +1487,7 @@ RUNTIME_FUNCTION(RuntimeReference_ValueOf) { } -RUNTIME_FUNCTION(RuntimeReference_SetValueOf) { +RUNTIME_FUNCTION(Runtime_SetValueOf) { SealHandleScope shs(isolate); DCHECK(args.length() == 2); CONVERT_ARG_CHECKED(Object, obj, 0); @@ -1508,7 +1498,31 @@ RUNTIME_FUNCTION(RuntimeReference_SetValueOf) { } -RUNTIME_FUNCTION(RuntimeReference_ObjectEquals) { +RUNTIME_FUNCTION(Runtime_JSValueGetValue) { + SealHandleScope shs(isolate); + DCHECK(args.length() == 1); + CONVERT_ARG_CHECKED(JSValue, obj, 0); + return JSValue::cast(obj)->value(); +} + + +RUNTIME_FUNCTION(Runtime_HeapObjectGetMap) { + SealHandleScope shs(isolate); + DCHECK(args.length() == 1); + CONVERT_ARG_CHECKED(HeapObject, obj, 0); + return obj->map(); +} + + +RUNTIME_FUNCTION(Runtime_MapGetInstanceType) { + SealHandleScope shs(isolate); + DCHECK(args.length() == 1); + CONVERT_ARG_CHECKED(Map, map, 0); + return Smi::FromInt(map->instance_type()); +} + + +RUNTIME_FUNCTION(Runtime_ObjectEquals) { SealHandleScope shs(isolate); DCHECK(args.length() == 2); CONVERT_ARG_CHECKED(Object, obj1, 0); @@ -1517,7 +1531,7 @@ RUNTIME_FUNCTION(RuntimeReference_ObjectEquals) { } -RUNTIME_FUNCTION(RuntimeReference_IsObject) { +RUNTIME_FUNCTION(Runtime_IsObject) { SealHandleScope shs(isolate); DCHECK(args.length() == 1); CONVERT_ARG_CHECKED(Object, obj, 0); @@ -1532,7 +1546,7 @@ RUNTIME_FUNCTION(RuntimeReference_IsObject) { } -RUNTIME_FUNCTION(RuntimeReference_IsUndetectableObject) { +RUNTIME_FUNCTION(Runtime_IsUndetectableObject) { SealHandleScope shs(isolate); DCHECK(args.length() == 1); CONVERT_ARG_CHECKED(Object, obj, 0); @@ -1540,7 +1554,7 @@ RUNTIME_FUNCTION(RuntimeReference_IsUndetectableObject) { } -RUNTIME_FUNCTION(RuntimeReference_IsSpecObject) { +RUNTIME_FUNCTION(Runtime_IsSpecObject) { SealHandleScope shs(isolate); DCHECK(args.length() == 1); CONVERT_ARG_CHECKED(Object, obj, 0); @@ -1548,7 +1562,7 @@ RUNTIME_FUNCTION(RuntimeReference_IsSpecObject) { } -RUNTIME_FUNCTION(RuntimeReference_ClassOf) { +RUNTIME_FUNCTION(Runtime_ClassOf) { SealHandleScope shs(isolate); DCHECK(args.length() == 1); CONVERT_ARG_CHECKED(Object, obj, 0); |