Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(184)

Side by Side Diff: src/api.cc

Issue 7331035: Implement API functions for handling the AccessorDescriptor (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/v8.h ('k') | src/handles.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2901 matching lines...) Expand 10 before | Expand all | Expand 10 after
2912 ENTER_V8(isolate); 2912 ENTER_V8(isolate);
2913 i::HandleScope scope(isolate); 2913 i::HandleScope scope(isolate);
2914 i::Handle<i::AccessorInfo> info = MakeAccessorInfo(name, 2914 i::Handle<i::AccessorInfo> info = MakeAccessorInfo(name,
2915 getter, setter, data, 2915 getter, setter, data,
2916 settings, attributes); 2916 settings, attributes);
2917 i::Handle<i::Object> result = i::SetAccessor(Utils::OpenHandle(this), info); 2917 i::Handle<i::Object> result = i::SetAccessor(Utils::OpenHandle(this), info);
2918 return !result.is_null() && !result->IsUndefined(); 2918 return !result.is_null() && !result->IsUndefined();
2919 } 2919 }
2920 2920
2921 2921
2922 bool v8::Object::DefineGetter(Handle<String> name, Handle<Value> fun) {
2923 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2924 ON_BAILOUT(isolate, "v8::Object::DefineGetter()", return false);
2925 ENTER_V8(isolate);
2926 i::HandleScope scope(isolate);
2927 i::Handle<i::Object> result = i::SetAccessor(Utils::OpenHandle(this),
2928 Utils::OpenHandle(*name),
2929 true,
2930 Utils::OpenHandle(*fun),
2931 NONE);
2932 return !result.is_null() && !result->IsUndefined();
2933 }
2934
2935
2936 bool v8::Object::DefineSetter(Handle<String> name, Handle<Value> fun) {
2937 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2938 ON_BAILOUT(isolate, "v8::Object::DefineSetter()", return false);
2939 ENTER_V8(isolate);
2940 i::HandleScope scope(isolate);
2941 i::Handle<i::Object> result = i::SetAccessor(Utils::OpenHandle(this),
2942 Utils::OpenHandle(*name),
2943 false,
2944 Utils::OpenHandle(*fun),
2945 NONE);
2946 return !result.is_null() && !result->IsUndefined();
2947 }
2948
2949
2950 Local<v8::Value> v8::Object::LookupGetter(Handle<String> name) {
2951 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2952 ON_BAILOUT(isolate, "v8::Object::LookupGetter()",
2953 return Local<v8::Value>());
2954 ENTER_V8(isolate);
2955 i::HandleScope scope(isolate);
2956 i::Handle<i::Object> result = i::GetAccessor(Utils::OpenHandle(this),
2957 Utils::OpenHandle(*name),
2958 true);
2959 return v8::Utils::ToLocal(scope.CloseAndEscape(result));
2960 }
2961
2962
2963 Local<v8::Value> v8::Object::LookupSetter(Handle<String> name) {
2964 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2965 ON_BAILOUT(isolate, "v8::Object::LookupSetter()",
2966 return Local<v8::Value>());
2967 ENTER_V8(isolate);
2968 i::HandleScope scope(isolate);
2969 i::Handle<i::Object> result = i::GetAccessor(Utils::OpenHandle(this),
2970 Utils::OpenHandle(*name),
2971 false);
2972 return v8::Utils::ToLocal(scope.CloseAndEscape(result));
2973 }
2974
2975
2922 bool v8::Object::HasOwnProperty(Handle<String> key) { 2976 bool v8::Object::HasOwnProperty(Handle<String> key) {
2923 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 2977 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
2924 ON_BAILOUT(isolate, "v8::Object::HasOwnProperty()", 2978 ON_BAILOUT(isolate, "v8::Object::HasOwnProperty()",
2925 return false); 2979 return false);
2926 return Utils::OpenHandle(this)->HasLocalProperty( 2980 return Utils::OpenHandle(this)->HasLocalProperty(
2927 *Utils::OpenHandle(*key)); 2981 *Utils::OpenHandle(*key));
2928 } 2982 }
2929 2983
2930 2984
2931 bool v8::Object::HasRealNamedProperty(Handle<String> key) { 2985 bool v8::Object::HasRealNamedProperty(Handle<String> key) {
(...skipping 3166 matching lines...) Expand 10 before | Expand all | Expand 10 after
6098 6152
6099 6153
6100 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 6154 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
6101 HandleScopeImplementer* scope_implementer = 6155 HandleScopeImplementer* scope_implementer =
6102 reinterpret_cast<HandleScopeImplementer*>(storage); 6156 reinterpret_cast<HandleScopeImplementer*>(storage);
6103 scope_implementer->IterateThis(v); 6157 scope_implementer->IterateThis(v);
6104 return storage + ArchiveSpacePerThread(); 6158 return storage + ArchiveSpacePerThread();
6105 } 6159 }
6106 6160
6107 } } // namespace v8::internal 6161 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | src/handles.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698