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

Side by Side Diff: src/api.cc

Issue 364923006: add GetOwnPropertyDescriptor to api (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/api.h" 5 #include "src/api.h"
6 6
7 #include <string.h> // For memcpy, strlen. 7 #include <string.h> // For memcpy, strlen.
8 #ifdef V8_USE_ADDRESS_SANITIZER 8 #ifdef V8_USE_ADDRESS_SANITIZER
9 #include <sanitizer/asan_interface.h> 9 #include <sanitizer/asan_interface.h>
10 #endif // V8_USE_ADDRESS_SANITIZER 10 #endif // V8_USE_ADDRESS_SANITIZER
(...skipping 3187 matching lines...) Expand 10 before | Expand all | Expand 10 after
3198 EXCEPTION_BAILOUT_CHECK(isolate, static_cast<PropertyAttribute>(NONE)); 3198 EXCEPTION_BAILOUT_CHECK(isolate, static_cast<PropertyAttribute>(NONE));
3199 } 3199 }
3200 i::Handle<i::Name> key_name = i::Handle<i::Name>::cast(key_obj); 3200 i::Handle<i::Name> key_name = i::Handle<i::Name>::cast(key_obj);
3201 PropertyAttributes result = 3201 PropertyAttributes result =
3202 i::JSReceiver::GetPropertyAttributes(self, key_name); 3202 i::JSReceiver::GetPropertyAttributes(self, key_name);
3203 if (result == ABSENT) return static_cast<PropertyAttribute>(NONE); 3203 if (result == ABSENT) return static_cast<PropertyAttribute>(NONE);
3204 return static_cast<PropertyAttribute>(result); 3204 return static_cast<PropertyAttribute>(result);
3205 } 3205 }
3206 3206
3207 3207
3208 Local<Value> v8::Object::GetOwnPropertyDescriptor(Local<String> key) {
3209 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3210 ON_BAILOUT(isolate, "v8::Object::GetOwnPropertyDescriptor()",
3211 return Local<Value>());
3212 ENTER_V8(isolate);
3213 i::Handle<i::JSObject> obj = Utils::OpenHandle(this);
3214 i::Handle<i::Name> key_name = Utils::OpenHandle(*key);
3215 i::Handle<i::Object> args[] = { obj, key_name };
3216 EXCEPTION_PREAMBLE(isolate);
3217 i::Handle<i::Object> result;
3218 has_pending_exception = !CallV8HeapFunction(
3219 "ObjectGetOwnPropertyDescriptor",
3220 isolate->factory()->undefined_value(),
3221 ARRAY_SIZE(args),
3222 args).ToHandle(&result);
3223 EXCEPTION_BAILOUT_CHECK(isolate, Local<Value>());
3224 return Utils::ToLocal(result);
3225 }
3226
3227
3208 Local<Value> v8::Object::GetPrototype() { 3228 Local<Value> v8::Object::GetPrototype() {
3209 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3229 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3210 ON_BAILOUT(isolate, "v8::Object::GetPrototype()", return Local<v8::Value>()); 3230 ON_BAILOUT(isolate, "v8::Object::GetPrototype()", return Local<v8::Value>());
3211 ENTER_V8(isolate); 3231 ENTER_V8(isolate);
3212 i::Handle<i::Object> self = Utils::OpenHandle(this); 3232 i::Handle<i::Object> self = Utils::OpenHandle(this);
3213 i::Handle<i::Object> result(self->GetPrototype(isolate), isolate); 3233 i::Handle<i::Object> result(self->GetPrototype(isolate), isolate);
3214 return Utils::ToLocal(result); 3234 return Utils::ToLocal(result);
3215 } 3235 }
3216 3236
3217 3237
(...skipping 4440 matching lines...) Expand 10 before | Expand all | Expand 10 after
7658 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7678 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7659 Address callback_address = 7679 Address callback_address =
7660 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7680 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7661 VMState<EXTERNAL> state(isolate); 7681 VMState<EXTERNAL> state(isolate);
7662 ExternalCallbackScope call_scope(isolate, callback_address); 7682 ExternalCallbackScope call_scope(isolate, callback_address);
7663 callback(info); 7683 callback(info);
7664 } 7684 }
7665 7685
7666 7686
7667 } } // namespace v8::internal 7687 } } // namespace v8::internal
OLDNEW
« include/v8.h ('K') | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698