OLD | NEW |
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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
9 #include "src/ast.h" | 9 #include "src/ast.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 Handle<JSObject> receiver = args.at<JSObject>(0); | 496 Handle<JSObject> receiver = args.at<JSObject>(0); |
497 Handle<JSObject> holder = args.at<JSObject>(1); | 497 Handle<JSObject> holder = args.at<JSObject>(1); |
498 Handle<ExecutableAccessorInfo> callback = args.at<ExecutableAccessorInfo>(2); | 498 Handle<ExecutableAccessorInfo> callback = args.at<ExecutableAccessorInfo>(2); |
499 Handle<Name> name = args.at<Name>(3); | 499 Handle<Name> name = args.at<Name>(3); |
500 Handle<Object> value = args.at<Object>(4); | 500 Handle<Object> value = args.at<Object>(4); |
501 HandleScope scope(isolate); | 501 HandleScope scope(isolate); |
502 | 502 |
503 DCHECK(callback->IsCompatibleReceiver(*receiver)); | 503 DCHECK(callback->IsCompatibleReceiver(*receiver)); |
504 | 504 |
505 Address setter_address = v8::ToCData<Address>(callback->setter()); | 505 Address setter_address = v8::ToCData<Address>(callback->setter()); |
506 v8::AccessorSetterCallback fun = | 506 v8::AccessorNameSetterCallback fun = |
507 FUNCTION_CAST<v8::AccessorSetterCallback>(setter_address); | 507 FUNCTION_CAST<v8::AccessorNameSetterCallback>(setter_address); |
508 DCHECK(fun != NULL); | 508 DCHECK(fun != NULL); |
509 | 509 |
510 // TODO(rossberg): Support symbols in the API. | |
511 if (name->IsSymbol()) return *value; | |
512 Handle<String> str = Handle<String>::cast(name); | |
513 | |
514 LOG(isolate, ApiNamedPropertyAccess("store", *receiver, *name)); | 510 LOG(isolate, ApiNamedPropertyAccess("store", *receiver, *name)); |
515 PropertyCallbackArguments custom_args(isolate, callback->data(), *receiver, | 511 PropertyCallbackArguments custom_args(isolate, callback->data(), *receiver, |
516 *holder); | 512 *holder); |
517 custom_args.Call(fun, v8::Utils::ToLocal(str), v8::Utils::ToLocal(value)); | 513 custom_args.Call(fun, v8::Utils::ToLocal(name), v8::Utils::ToLocal(value)); |
518 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); | 514 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); |
519 return *value; | 515 return *value; |
520 } | 516 } |
521 | 517 |
522 | 518 |
523 /** | 519 /** |
524 * Attempts to load a property with an interceptor (which must be present), | 520 * Attempts to load a property with an interceptor (which must be present), |
525 * but doesn't search the prototype chain. | 521 * but doesn't search the prototype chain. |
526 * | 522 * |
527 * Returns |Heap::no_interceptor_result_sentinel()| if interceptor doesn't | 523 * Returns |Heap::no_interceptor_result_sentinel()| if interceptor doesn't |
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1284 Handle<FunctionTemplateInfo>( | 1280 Handle<FunctionTemplateInfo>( |
1285 FunctionTemplateInfo::cast(signature->receiver())); | 1281 FunctionTemplateInfo::cast(signature->receiver())); |
1286 } | 1282 } |
1287 } | 1283 } |
1288 | 1284 |
1289 is_simple_api_call_ = true; | 1285 is_simple_api_call_ = true; |
1290 } | 1286 } |
1291 | 1287 |
1292 | 1288 |
1293 } } // namespace v8::internal | 1289 } } // namespace v8::internal |
OLD | NEW |