Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/include/v8.h b/include/v8.h
- index c3bccdc..8ecaf68 100644
- --- a/include/v8.h
- +++ b/include/v8.h
- @@ -1435,6 +1435,9 @@ class Object : public Value {
- V8EXPORT Local<Value> Get(uint32_t index);
- + V8EXPORT PropertyAttribute GetPropertyAttribute(Handle<Value> key);
- + V8EXPORT void Tipli(v8::Handle<Value> key);
- +
- // TODO(1245389): Replace the type-specific versions of these
- // functions with generic ones that accept a Handle<Value> key.
- V8EXPORT bool Has(Handle<String> key);
- diff --git a/src/api.cc b/src/api.cc
- index 3fe5621..f576112 100644
- --- a/src/api.cc
- +++ b/src/api.cc
- @@ -2698,6 +2698,33 @@ Local<Value> v8::Object::Get(uint32_t index) {
- }
- +PropertyAttribute v8::Object::GetPropertyAttribute(v8::Handle<Value> key) {
- + i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
- + ON_BAILOUT(isolate, "v8::Object::GetPropertyAttribute()",
- + return static_cast<PropertyAttribute>(NONE));
- + ENTER_V8(isolate);
- + i::Handle<i::JSObject> self = Utils::OpenHandle(this);
- + i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
- + EXCEPTION_PREAMBLE(isolate);
- + i::Handle<i::String> name = i::Handle<i::String>::cast(key_obj);
- + PropertyAttributes result = self->GetPropertyAttribute(*name);
- + has_pending_exception = (result == ABSENT);
- + EXCEPTION_BAILOUT_CHECK(isolate, static_cast<PropertyAttribute>(NONE));
- + return static_cast<PropertyAttribute>(result);
- +}
- +
- +void v8::Object::Tipli(v8::Handle<Value> key) {
- + i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
- + ON_BAILOUT(isolate, "v8::Object::Tipli()", return);
- + ENTER_V8(isolate);
- + i::Handle<i::JSObject> self = Utils::OpenHandle(this);
- + i::Handle<i::Object> key_obj = Utils::OpenHandle(*key);
- +
- + i::Handle<i::String> name = i::Handle<i::String>::cast(key_obj);
- + self->getGet(*name);
- +}
- +
- +
- Local<Value> v8::Object::GetPrototype() {
- i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
- ON_BAILOUT(isolate, "v8::Object::GetPrototype()",
- diff --git a/src/objects.cc b/src/objects.cc
- index 6c9f52b..b3835d8 100644
- --- a/src/objects.cc
- +++ b/src/objects.cc
- @@ -3348,6 +3348,35 @@ MaybeObject* JSObject::PreventExtensions() {
- }
- +void JSObject::getGet(String* name) {
- + Object* obj = this;
- + LookupResult result;
- + JSObject::cast(obj)->LocalLookup(name, &result);
- + if (result.IsProperty()) {
- + if (result.IsReadOnly()) {
- + printf("read only\n");
- + } else if (result.type() == CALLBACKS) {
- + Object* obj = result.GetCallbackObject();
- + if (obj->IsFixedArray()) {
- + printf("HEJ!\n");
- + Object* getter = FixedArray::cast(obj)->get(kGetterIndex);
- +
- + Handle<JSFunction> fun(JSFunction::cast(getter));
- + Handle<Object> self(obj);
- + bool has_pending_exception;
- + Handle<Object> result = Execution::Call(fun, self, 0, NULL, &has_pending_exception);
- + } else {
- + printf("obj isn't FixedArray\n");
- + }
- + } else {
- + printf("result.type = %d\n", result.type());
- + }
- + } else {
- + printf("result isn't property\n");
- + }
- +}
- +
- +
- // Tests for the fast common case for property enumeration:
- // - This object and all prototypes has an enum cache (which means that it has
- // no interceptors and needs no access checks).
- diff --git a/src/objects.h b/src/objects.h
- index 4d1f68d..e7cdca4 100644
- --- a/src/objects.h
- +++ b/src/objects.h
- @@ -1894,6 +1894,7 @@ class JSObject: public JSReceiver {
- // Disalow further properties to be added to the object.
- MUST_USE_RESULT MaybeObject* PreventExtensions();
- + void getGet(String* name);
- // Dispatched behavior.
- void JSObjectShortPrint(StringStream* accumulator);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement