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

Side by Side Diff: src/api.cc

Issue 209853002: add setaccessorproperty to object (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: gcc fix Created 6 years, 9 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') | test/cctest/test-api.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 3470 matching lines...) Expand 10 before | Expand all | Expand 10 after
3481 bool Object::SetDeclaredAccessor(Local<String> name, 3481 bool Object::SetDeclaredAccessor(Local<String> name,
3482 Local<DeclaredAccessorDescriptor> descriptor, 3482 Local<DeclaredAccessorDescriptor> descriptor,
3483 PropertyAttribute attributes, 3483 PropertyAttribute attributes,
3484 AccessControl settings) { 3484 AccessControl settings) {
3485 void* null = NULL; 3485 void* null = NULL;
3486 return ObjectSetAccessor( 3486 return ObjectSetAccessor(
3487 this, name, descriptor, null, null, settings, attributes); 3487 this, name, descriptor, null, null, settings, attributes);
3488 } 3488 }
3489 3489
3490 3490
3491 void Object::SetAccessorProperty(Local<String> name,
3492 Local<Function> getter,
3493 Handle<Function> setter,
3494 PropertyAttribute attribute,
3495 AccessControl settings) {
3496 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3497 ON_BAILOUT(isolate, "v8::Object::SetAccessorProperty()", return);
3498 ENTER_V8(isolate);
3499 i::HandleScope scope(isolate);
3500 i::Handle<i::Object> getter_i = v8::Utils::OpenHandle(*getter);
3501 i::Handle<i::Object> setter_i = v8::Utils::OpenHandle(*setter, true);
3502 if (setter_i.is_null()) setter_i = isolate->factory()->null_value();
3503 i::JSObject::DefineAccessor(v8::Utils::OpenHandle(this),
3504 v8::Utils::OpenHandle(*name),
3505 getter_i,
3506 setter_i,
3507 static_cast<PropertyAttributes>(attribute),
3508 settings);
3509 }
3510
3511
3491 bool v8::Object::HasOwnProperty(Handle<String> key) { 3512 bool v8::Object::HasOwnProperty(Handle<String> key) {
3492 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); 3513 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
3493 ON_BAILOUT(isolate, "v8::Object::HasOwnProperty()", 3514 ON_BAILOUT(isolate, "v8::Object::HasOwnProperty()",
3494 return false); 3515 return false);
3495 return i::JSReceiver::HasLocalProperty( 3516 return i::JSReceiver::HasLocalProperty(
3496 Utils::OpenHandle(this), Utils::OpenHandle(*key)); 3517 Utils::OpenHandle(this), Utils::OpenHandle(*key));
3497 } 3518 }
3498 3519
3499 3520
3500 bool v8::Object::HasRealNamedProperty(Handle<String> key) { 3521 bool v8::Object::HasRealNamedProperty(Handle<String> key) {
(...skipping 4096 matching lines...) Expand 10 before | Expand all | Expand 10 after
7597 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); 7618 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
7598 Address callback_address = 7619 Address callback_address =
7599 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); 7620 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback));
7600 VMState<EXTERNAL> state(isolate); 7621 VMState<EXTERNAL> state(isolate);
7601 ExternalCallbackScope call_scope(isolate, callback_address); 7622 ExternalCallbackScope call_scope(isolate, callback_address);
7602 callback(info); 7623 callback(info);
7603 } 7624 }
7604 7625
7605 7626
7606 } } // namespace v8::internal 7627 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698