diff --git a/src/accessors.cc b/src/accessors.cc index e11738cc39..2e3bfb80a4 100644 --- a/src/accessors.cc +++ b/src/accessors.cc @@ -478,19 +478,36 @@ Handle Accessors::ScriptLineOffsetInfo( // -MaybeObject* Accessors::ScriptGetType(Isolate* isolate, - Object* object, - void*) { - Object* script = JSValue::cast(object)->value(); - return Script::cast(script)->type(); +void Accessors::ScriptTypeGetter( + v8::Local name, + const v8::PropertyCallbackInfo& info) { + i::Isolate* isolate = reinterpret_cast(info.GetIsolate()); + DisallowHeapAllocation no_allocation; + HandleScope scope(isolate); + Object* object = *Utils::OpenHandle(*info.This()); + Object* res = Script::cast(JSValue::cast(object)->value())->type(); + info.GetReturnValue().Set(Utils::ToLocal(Handle(res, isolate))); } -const AccessorDescriptor Accessors::ScriptType = { - ScriptGetType, - IllegalSetter, - 0 -}; +void Accessors::ScriptTypeSetter( + v8::Local name, + v8::Local value, + const v8::PropertyCallbackInfo& info) { + UNREACHABLE(); +} + + +Handle Accessors::ScriptTypeInfo( + Isolate* isolate, PropertyAttributes attributes) { + Handle name(isolate->factory()->InternalizeOneByteString( + STATIC_ASCII_VECTOR("type"))); + return MakeAccessor(isolate, + name, + &ScriptTypeGetter, + &ScriptTypeSetter, + attributes); +} // @@ -498,19 +515,37 @@ const AccessorDescriptor Accessors::ScriptType = { // -MaybeObject* Accessors::ScriptGetCompilationType(Isolate* isolate, - Object* object, - void*) { - Object* script = JSValue::cast(object)->value(); - return Smi::FromInt(Script::cast(script)->compilation_type()); +void Accessors::ScriptCompilationTypeGetter( + v8::Local name, + const v8::PropertyCallbackInfo& info) { + i::Isolate* isolate = reinterpret_cast(info.GetIsolate()); + DisallowHeapAllocation no_allocation; + HandleScope scope(isolate); + Object* object = *Utils::OpenHandle(*info.This()); + Object* res = Smi::FromInt( + Script::cast(JSValue::cast(object)->value())->compilation_type()); + info.GetReturnValue().Set(Utils::ToLocal(Handle(res, isolate))); } -const AccessorDescriptor Accessors::ScriptCompilationType = { - ScriptGetCompilationType, - IllegalSetter, - 0 -}; +void Accessors::ScriptCompilationTypeSetter( + v8::Local name, + v8::Local value, + const v8::PropertyCallbackInfo& info) { + UNREACHABLE(); +} + + +Handle Accessors::ScriptCompilationTypeInfo( + Isolate* isolate, PropertyAttributes attributes) { + Handle name(isolate->factory()->InternalizeOneByteString( + STATIC_ASCII_VECTOR("compilation_type"))); + return MakeAccessor(isolate, + name, + &ScriptCompilationTypeGetter, + &ScriptCompilationTypeSetter, + attributes); +} // @@ -518,12 +553,14 @@ const AccessorDescriptor Accessors::ScriptCompilationType = { // -MaybeObject* Accessors::ScriptGetLineEnds(Isolate* isolate, - Object* object, - void*) { - JSValue* wrapper = JSValue::cast(object); +void Accessors::ScriptLineEndsGetter( + v8::Local name, + const v8::PropertyCallbackInfo& info) { + i::Isolate* isolate = reinterpret_cast(info.GetIsolate()); HandleScope scope(isolate); - Handle