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

Unified Diff: src/api.cc

Issue 459413002: Support symbol-named properties in API (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Include a bit that was missing from the previous patch Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/api.h ('k') | src/arguments.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 4a6345910f978176c56c6476f232dd0e58e496c8..fd79941b9dbd29d1a4314bc1d605310d73be48ce 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -828,7 +828,7 @@ static void TemplateSet(i::Isolate* isolate,
}
-void Template::Set(v8::Handle<String> name,
+void Template::Set(v8::Handle<Name> name,
v8::Handle<Data> value,
v8::PropertyAttribute attribute) {
i::Isolate* isolate = i::Isolate::Current();
@@ -845,7 +845,7 @@ void Template::Set(v8::Handle<String> name,
void Template::SetAccessorProperty(
- v8::Local<v8::String> name,
+ v8::Local<v8::Name> name,
v8::Local<FunctionTemplate> getter,
v8::Local<FunctionTemplate> setter,
v8::PropertyAttribute attribute,
@@ -1156,7 +1156,7 @@ void FunctionTemplate::SetCallHandler(FunctionCallback callback,
static i::Handle<i::AccessorInfo> SetAccessorInfoProperties(
i::Handle<i::AccessorInfo> obj,
- v8::Handle<String> name,
+ v8::Handle<Name> name,
v8::AccessControl settings,
v8::PropertyAttribute attributes,
v8::Handle<AccessorSignature> signature) {
@@ -1173,7 +1173,7 @@ static i::Handle<i::AccessorInfo> SetAccessorInfoProperties(
template<typename Getter, typename Setter>
static i::Handle<i::AccessorInfo> MakeAccessorInfo(
- v8::Handle<String> name,
+ v8::Handle<Name> name,
Getter getter,
Setter setter,
v8::Handle<Value> data,
@@ -1194,7 +1194,7 @@ static i::Handle<i::AccessorInfo> MakeAccessorInfo(
static i::Handle<i::AccessorInfo> MakeAccessorInfo(
- v8::Handle<String> name,
+ v8::Handle<Name> name,
v8::Handle<v8::DeclaredAccessorDescriptor> descriptor,
void* setter_ignored,
void* data_ignored,
@@ -1345,10 +1345,10 @@ static inline i::Handle<i::TemplateInfo> GetTemplateInfo(
}
-template<typename Setter, typename Getter, typename Data, typename Template>
+template<typename Getter, typename Setter, typename Data, typename Template>
static bool TemplateSetAccessor(
Template* template_obj,
- v8::Local<String> name,
+ v8::Local<Name> name,
Getter getter,
Setter setter,
Data data,
@@ -1368,7 +1368,7 @@ static bool TemplateSetAccessor(
bool Template::SetDeclaredAccessor(
- Local<String> name,
+ Local<Name> name,
Local<DeclaredAccessorDescriptor> descriptor,
PropertyAttribute attribute,
Local<AccessorSignature> signature,
@@ -1391,6 +1391,18 @@ void Template::SetNativeDataProperty(v8::Local<String> name,
}
+void Template::SetNativeDataProperty(v8::Local<Name> name,
+ AccessorNameGetterCallback getter,
+ AccessorNameSetterCallback setter,
+ v8::Handle<Value> data,
+ PropertyAttribute attribute,
+ v8::Local<AccessorSignature> signature,
+ AccessControl settings) {
+ TemplateSetAccessor(
+ this, name, getter, setter, data, settings, attribute, signature);
+}
+
+
void ObjectTemplate::SetAccessor(v8::Handle<String> name,
AccessorGetterCallback getter,
AccessorSetterCallback setter,
@@ -1403,6 +1415,18 @@ void ObjectTemplate::SetAccessor(v8::Handle<String> name,
}
+void ObjectTemplate::SetAccessor(v8::Handle<Name> name,
+ AccessorNameGetterCallback getter,
+ AccessorNameSetterCallback setter,
+ v8::Handle<Value> data,
+ AccessControl settings,
+ PropertyAttribute attribute,
+ v8::Handle<AccessorSignature> signature) {
+ TemplateSetAccessor(
+ this, name, getter, setter, data, settings, attribute, signature);
+}
+
+
void ObjectTemplate::SetNamedPropertyHandler(
NamedPropertyGetterCallback getter,
NamedPropertySetterCallback setter,
@@ -2324,6 +2348,11 @@ bool Value::IsFunction() const {
}
+bool Value::IsName() const {
+ return Utils::OpenHandle(this)->IsName();
+}
+
+
bool Value::FullIsString() const {
bool result = Utils::OpenHandle(this)->IsString();
DCHECK_EQ(result, QuickIsString());
@@ -2632,6 +2661,14 @@ void v8::Function::CheckCast(Value* that) {
}
+void v8::Name::CheckCast(v8::Value* that) {
+ i::Handle<i::Object> obj = Utils::OpenHandle(that);
+ Utils::ApiCheck(obj->IsName(),
+ "v8::Name::Cast()",
+ "Could not convert to name");
+}
+
+
void v8::String::CheckCast(v8::Value* that) {
i::Handle<i::Object> obj = Utils::OpenHandle(that);
Utils::ApiCheck(obj->IsString(),
@@ -3414,11 +3451,11 @@ bool v8::Object::Has(uint32_t index) {
}
-template<typename Setter, typename Getter, typename Data>
+template<typename Getter, typename Setter, typename Data>
static inline bool ObjectSetAccessor(Object* obj,
- Handle<String> name,
- Setter getter,
rossberg 2014/08/19 11:19:27 OMG...
- Getter setter,
+ Handle<Name> name,
+ Getter getter,
+ Setter setter,
Data data,
AccessControl settings,
PropertyAttribute attributes) {
@@ -3453,7 +3490,18 @@ bool Object::SetAccessor(Handle<String> name,
}
-bool Object::SetDeclaredAccessor(Local<String> name,
+bool Object::SetAccessor(Handle<Name> name,
+ AccessorNameGetterCallback getter,
+ AccessorNameSetterCallback setter,
+ v8::Handle<Value> data,
+ AccessControl settings,
+ PropertyAttribute attributes) {
+ return ObjectSetAccessor(
+ this, name, getter, setter, data, settings, attributes);
+}
+
+
+bool Object::SetDeclaredAccessor(Local<Name> name,
Local<DeclaredAccessorDescriptor> descriptor,
PropertyAttribute attributes,
AccessControl settings) {
@@ -3463,7 +3511,7 @@ bool Object::SetDeclaredAccessor(Local<String> name,
}
-void Object::SetAccessorProperty(Local<String> name,
+void Object::SetAccessorProperty(Local<Name> name,
Local<Function> getter,
Handle<Function> setter,
PropertyAttribute attribute,
@@ -7613,9 +7661,9 @@ void DeferredHandles::Iterate(ObjectVisitor* v) {
void InvokeAccessorGetterCallback(
- v8::Local<v8::String> property,
+ v8::Local<v8::Name> property,
const v8::PropertyCallbackInfo<v8::Value>& info,
- v8::AccessorGetterCallback getter) {
+ v8::AccessorNameGetterCallback getter) {
// Leaving JavaScript.
Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate());
Address getter_address = reinterpret_cast<Address>(reinterpret_cast<intptr_t>(
« no previous file with comments | « src/api.h ('k') | src/arguments.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698