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

Unified Diff: src/objects.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
« src/api.cc ('K') | « src/assembler.h ('k') | src/stub-cache.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index aa9984000086e372087aeb1adc52613d5fcff29b..ed05749f135d3a8e90b9e71d1cf9a5fc56711ac9 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -418,9 +418,6 @@ MaybeHandle<Object> Object::GetPropertyWithAccessor(Handle<Object> receiver,
ARRAY_SIZE(args)));
return isolate->Throw<Object>(error);
}
- // TODO(rossberg): Handling symbols in the API requires changing the API,
- // so we do not support it for now.
- if (name->IsSymbol()) return isolate->factory()->undefined_value();
if (structure->IsDeclaredAccessorInfo()) {
return GetDeclaredAccessorProperty(
receiver,
@@ -430,15 +427,14 @@ MaybeHandle<Object> Object::GetPropertyWithAccessor(Handle<Object> receiver,
Handle<ExecutableAccessorInfo> data =
Handle<ExecutableAccessorInfo>::cast(structure);
- v8::AccessorGetterCallback call_fun =
- v8::ToCData<v8::AccessorGetterCallback>(data->getter());
+ v8::AccessorNameGetterCallback call_fun =
+ v8::ToCData<v8::AccessorNameGetterCallback>(data->getter());
if (call_fun == NULL) return isolate->factory()->undefined_value();
- Handle<String> key = Handle<String>::cast(name);
LOG(isolate, ApiNamedPropertyAccess("load", *holder, *name));
PropertyCallbackArguments args(isolate, data->data(), *receiver, *holder);
v8::Handle<v8::Value> result =
- args.Call(call_fun, v8::Utils::ToLocal(key));
+ args.Call(call_fun, v8::Utils::ToLocal(name));
RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
if (result.IsEmpty()) {
return isolate->factory()->undefined_value();
@@ -494,17 +490,14 @@ MaybeHandle<Object> Object::SetPropertyWithAccessor(
ARRAY_SIZE(args)));
return isolate->Throw<Object>(error);
}
- // TODO(rossberg): Support symbols in the API.
- if (name->IsSymbol()) return value;
Object* call_obj = info->setter();
- v8::AccessorSetterCallback call_fun =
- v8::ToCData<v8::AccessorSetterCallback>(call_obj);
+ v8::AccessorNameSetterCallback call_fun =
+ v8::ToCData<v8::AccessorNameSetterCallback>(call_obj);
if (call_fun == NULL) return value;
- Handle<String> key = Handle<String>::cast(name);
LOG(isolate, ApiNamedPropertyAccess("store", *holder, *name));
PropertyCallbackArguments args(isolate, info->data(), *receiver, *holder);
args.Call(call_fun,
- v8::Utils::ToLocal(key),
+ v8::Utils::ToLocal(name),
v8::Utils::ToLocal(value));
RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
return value;
@@ -12285,8 +12278,8 @@ MaybeHandle<Object> JSObject::GetElementWithCallback(
Handle<ExecutableAccessorInfo> data =
Handle<ExecutableAccessorInfo>::cast(structure);
Object* fun_obj = data->getter();
- v8::AccessorGetterCallback call_fun =
- v8::ToCData<v8::AccessorGetterCallback>(fun_obj);
+ v8::AccessorNameGetterCallback call_fun =
+ v8::ToCData<v8::AccessorNameGetterCallback>(fun_obj);
if (call_fun == NULL) return isolate->factory()->undefined_value();
Handle<JSObject> holder_handle = Handle<JSObject>::cast(holder);
Handle<Object> number = isolate->factory()->NewNumberFromUint(index);
@@ -12343,8 +12336,8 @@ MaybeHandle<Object> JSObject::SetElementWithCallback(Handle<JSObject> object,
Handle<ExecutableAccessorInfo> data =
Handle<ExecutableAccessorInfo>::cast(structure);
Object* call_obj = data->setter();
- v8::AccessorSetterCallback call_fun =
- v8::ToCData<v8::AccessorSetterCallback>(call_obj);
+ v8::AccessorNameSetterCallback call_fun =
+ v8::ToCData<v8::AccessorNameSetterCallback>(call_obj);
if (call_fun == NULL) return value;
Handle<Object> number = isolate->factory()->NewNumberFromUint(index);
Handle<String> key(isolate->factory()->NumberToString(number));
« src/api.cc ('K') | « src/assembler.h ('k') | src/stub-cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698