OLD | NEW |
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 926 matching lines...) Loading... |
937 | 937 |
938 | 938 |
939 RUNTIME_FUNCTION(MaybeObject*, LoadCallbackProperty) { | 939 RUNTIME_FUNCTION(MaybeObject*, LoadCallbackProperty) { |
940 ASSERT(args[0]->IsJSObject()); | 940 ASSERT(args[0]->IsJSObject()); |
941 ASSERT(args[1]->IsJSObject()); | 941 ASSERT(args[1]->IsJSObject()); |
942 ASSERT(args[3]->IsSmi()); | 942 ASSERT(args[3]->IsSmi()); |
943 AccessorInfo* callback = AccessorInfo::cast(args[4]); | 943 AccessorInfo* callback = AccessorInfo::cast(args[4]); |
944 Address getter_address = v8::ToCData<Address>(callback->getter()); | 944 Address getter_address = v8::ToCData<Address>(callback->getter()); |
945 v8::AccessorGetter fun = FUNCTION_CAST<v8::AccessorGetter>(getter_address); | 945 v8::AccessorGetter fun = FUNCTION_CAST<v8::AccessorGetter>(getter_address); |
946 ASSERT(fun != NULL); | 946 ASSERT(fun != NULL); |
| 947 ASSERT(callback->IsCompatibleReceiver(args[0])); |
947 v8::AccessorInfo info(&args[0]); | 948 v8::AccessorInfo info(&args[0]); |
948 HandleScope scope(isolate); | 949 HandleScope scope(isolate); |
949 v8::Handle<v8::Value> result; | 950 v8::Handle<v8::Value> result; |
950 { | 951 { |
951 // Leaving JavaScript. | 952 // Leaving JavaScript. |
952 VMState state(isolate, EXTERNAL); | 953 VMState state(isolate, EXTERNAL); |
953 ExternalCallbackScope call_scope(isolate, getter_address); | 954 ExternalCallbackScope call_scope(isolate, getter_address); |
954 result = fun(v8::Utils::ToLocal(args.at<String>(5)), info); | 955 result = fun(v8::Utils::ToLocal(args.at<String>(5)), info); |
955 } | 956 } |
956 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 957 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
957 if (result.IsEmpty()) return HEAP->undefined_value(); | 958 if (result.IsEmpty()) return HEAP->undefined_value(); |
958 return *v8::Utils::OpenHandle(*result); | 959 return *v8::Utils::OpenHandle(*result); |
959 } | 960 } |
960 | 961 |
961 | 962 |
962 RUNTIME_FUNCTION(MaybeObject*, StoreCallbackProperty) { | 963 RUNTIME_FUNCTION(MaybeObject*, StoreCallbackProperty) { |
963 JSObject* recv = JSObject::cast(args[0]); | 964 JSObject* recv = JSObject::cast(args[0]); |
964 AccessorInfo* callback = AccessorInfo::cast(args[1]); | 965 AccessorInfo* callback = AccessorInfo::cast(args[1]); |
965 Address setter_address = v8::ToCData<Address>(callback->setter()); | 966 Address setter_address = v8::ToCData<Address>(callback->setter()); |
966 v8::AccessorSetter fun = FUNCTION_CAST<v8::AccessorSetter>(setter_address); | 967 v8::AccessorSetter fun = FUNCTION_CAST<v8::AccessorSetter>(setter_address); |
967 ASSERT(fun != NULL); | 968 ASSERT(fun != NULL); |
| 969 ASSERT(callback->IsCompatibleReceiver(recv)); |
968 Handle<String> name = args.at<String>(2); | 970 Handle<String> name = args.at<String>(2); |
969 Handle<Object> value = args.at<Object>(3); | 971 Handle<Object> value = args.at<Object>(3); |
970 HandleScope scope(isolate); | 972 HandleScope scope(isolate); |
971 LOG(isolate, ApiNamedPropertyAccess("store", recv, *name)); | 973 LOG(isolate, ApiNamedPropertyAccess("store", recv, *name)); |
972 CustomArguments custom_args(isolate, callback->data(), recv, recv); | 974 CustomArguments custom_args(isolate, callback->data(), recv, recv); |
973 v8::AccessorInfo info(custom_args.end()); | 975 v8::AccessorInfo info(custom_args.end()); |
974 { | 976 { |
975 // Leaving JavaScript. | 977 // Leaving JavaScript. |
976 VMState state(isolate, EXTERNAL); | 978 VMState state(isolate, EXTERNAL); |
977 ExternalCallbackScope call_scope(isolate, setter_address); | 979 ExternalCallbackScope call_scope(isolate, setter_address); |
(...skipping 547 matching lines...) Loading... |
1525 Handle<FunctionTemplateInfo>( | 1527 Handle<FunctionTemplateInfo>( |
1526 FunctionTemplateInfo::cast(signature->receiver())); | 1528 FunctionTemplateInfo::cast(signature->receiver())); |
1527 } | 1529 } |
1528 } | 1530 } |
1529 | 1531 |
1530 is_simple_api_call_ = true; | 1532 is_simple_api_call_ = true; |
1531 } | 1533 } |
1532 | 1534 |
1533 | 1535 |
1534 } } // namespace v8::internal | 1536 } } // namespace v8::internal |
OLD | NEW |