| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 } else { | 149 } else { |
| 150 result->isolate()->PushStackTraceAndDie( | 150 result->isolate()->PushStackTraceAndDie( |
| 151 0xDEAD0000, this, JSReceiver::cast(this)->map(), 0xDEAD0001); | 151 0xDEAD0000, this, JSReceiver::cast(this)->map(), 0xDEAD0001); |
| 152 } | 152 } |
| 153 } | 153 } |
| 154 ASSERT(holder != NULL); // Cannot handle null or undefined. | 154 ASSERT(holder != NULL); // Cannot handle null or undefined. |
| 155 JSReceiver::cast(holder)->Lookup(name, result); | 155 JSReceiver::cast(holder)->Lookup(name, result); |
| 156 } | 156 } |
| 157 | 157 |
| 158 | 158 |
| 159 Handle<Object> Object::GetPropertyWithReceiver( | 159 MaybeHandle<Object> Object::GetPropertyWithReceiver( |
| 160 Handle<Object> object, | 160 Handle<Object> object, |
| 161 Handle<Object> receiver, | 161 Handle<Object> receiver, |
| 162 Handle<Name> name, | 162 Handle<Name> name, |
| 163 PropertyAttributes* attributes) { | 163 PropertyAttributes* attributes) { |
| 164 LookupResult lookup(name->GetIsolate()); | 164 LookupResult lookup(name->GetIsolate()); |
| 165 object->Lookup(*name, &lookup); | 165 object->Lookup(*name, &lookup); |
| 166 Handle<Object> result = | 166 MaybeHandle<Object> result = |
| 167 GetProperty(object, receiver, &lookup, name, attributes); | 167 GetProperty(object, receiver, &lookup, name, attributes); |
| 168 ASSERT(*attributes <= ABSENT); | 168 ASSERT(*attributes <= ABSENT); |
| 169 return result; | 169 return result; |
| 170 } | 170 } |
| 171 | 171 |
| 172 | 172 |
| 173 MaybeObject* Object::GetPropertyWithReceiver(Object* receiver, | 173 MaybeObject* Object::GetPropertyWithReceiver(Object* receiver, |
| 174 Name* name, | 174 Name* name, |
| 175 PropertyAttributes* attributes) { | 175 PropertyAttributes* attributes) { |
| 176 LookupResult result(name->GetIsolate()); | 176 LookupResult result(name->GetIsolate()); |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 | 382 |
| 383 | 383 |
| 384 Handle<FixedArray> JSObject::EnsureWritableFastElements( | 384 Handle<FixedArray> JSObject::EnsureWritableFastElements( |
| 385 Handle<JSObject> object) { | 385 Handle<JSObject> object) { |
| 386 CALL_HEAP_FUNCTION(object->GetIsolate(), | 386 CALL_HEAP_FUNCTION(object->GetIsolate(), |
| 387 object->EnsureWritableFastElements(), | 387 object->EnsureWritableFastElements(), |
| 388 FixedArray); | 388 FixedArray); |
| 389 } | 389 } |
| 390 | 390 |
| 391 | 391 |
| 392 Handle<Object> JSObject::GetPropertyWithCallback(Handle<JSObject> object, | 392 MaybeHandle<Object> JSObject::GetPropertyWithCallback(Handle<JSObject> object, |
| 393 Handle<Object> receiver, | 393 Handle<Object> receiver, |
| 394 Handle<Object> structure, | 394 Handle<Object> structure, |
| 395 Handle<Name> name) { | 395 Handle<Name> name) { |
| 396 Isolate* isolate = name->GetIsolate(); | 396 Isolate* isolate = name->GetIsolate(); |
| 397 // To accommodate both the old and the new api we switch on the | 397 // To accommodate both the old and the new api we switch on the |
| 398 // data structure used to store the callbacks. Eventually foreign | 398 // data structure used to store the callbacks. Eventually foreign |
| 399 // callbacks should be phased out. | 399 // callbacks should be phased out. |
| 400 if (structure->IsForeign()) { | 400 if (structure->IsForeign()) { |
| 401 AccessorDescriptor* callback = | 401 AccessorDescriptor* callback = |
| 402 reinterpret_cast<AccessorDescriptor*>( | 402 reinterpret_cast<AccessorDescriptor*>( |
| 403 Handle<Foreign>::cast(structure)->foreign_address()); | 403 Handle<Foreign>::cast(structure)->foreign_address()); |
| 404 CALL_HEAP_FUNCTION(isolate, | 404 CALL_HEAP_FUNCTION(isolate, |
| 405 (callback->getter)(isolate, *receiver, callback->data), | 405 (callback->getter)(isolate, *receiver, callback->data), |
| 406 Object); | 406 Object); |
| 407 } | 407 } |
| 408 | 408 |
| 409 // api style callbacks. | 409 // api style callbacks. |
| 410 if (structure->IsAccessorInfo()) { | 410 if (structure->IsAccessorInfo()) { |
| 411 Handle<AccessorInfo> accessor_info = Handle<AccessorInfo>::cast(structure); | 411 Handle<AccessorInfo> accessor_info = Handle<AccessorInfo>::cast(structure); |
| 412 if (!accessor_info->IsCompatibleReceiver(*receiver)) { | 412 if (!accessor_info->IsCompatibleReceiver(*receiver)) { |
| 413 Handle<Object> args[2] = { name, receiver }; | 413 Handle<Object> args[2] = { name, receiver }; |
| 414 Handle<Object> error = | 414 Handle<Object> error = |
| 415 isolate->factory()->NewTypeError("incompatible_method_receiver", | 415 isolate->factory()->NewTypeError("incompatible_method_receiver", |
| 416 HandleVector(args, | 416 HandleVector(args, |
| 417 ARRAY_SIZE(args))); | 417 ARRAY_SIZE(args))); |
| 418 isolate->Throw(*error); | 418 return isolate->Throw<Object>(error); |
| 419 return Handle<Object>::null(); | |
| 420 } | 419 } |
| 421 // TODO(rossberg): Handling symbols in the API requires changing the API, | 420 // TODO(rossberg): Handling symbols in the API requires changing the API, |
| 422 // so we do not support it for now. | 421 // so we do not support it for now. |
| 423 if (name->IsSymbol()) return isolate->factory()->undefined_value(); | 422 if (name->IsSymbol()) return isolate->factory()->undefined_value(); |
| 424 if (structure->IsDeclaredAccessorInfo()) { | 423 if (structure->IsDeclaredAccessorInfo()) { |
| 425 CALL_HEAP_FUNCTION( | 424 CALL_HEAP_FUNCTION( |
| 426 isolate, | 425 isolate, |
| 427 GetDeclaredAccessorProperty(*receiver, | 426 GetDeclaredAccessorProperty(*receiver, |
| 428 DeclaredAccessorInfo::cast(*structure), | 427 DeclaredAccessorInfo::cast(*structure), |
| 429 isolate), | 428 isolate), |
| 430 Object); | 429 Object); |
| 431 } | 430 } |
| 432 | 431 |
| 433 Handle<ExecutableAccessorInfo> data = | 432 Handle<ExecutableAccessorInfo> data = |
| 434 Handle<ExecutableAccessorInfo>::cast(structure); | 433 Handle<ExecutableAccessorInfo>::cast(structure); |
| 435 v8::AccessorGetterCallback call_fun = | 434 v8::AccessorGetterCallback call_fun = |
| 436 v8::ToCData<v8::AccessorGetterCallback>(data->getter()); | 435 v8::ToCData<v8::AccessorGetterCallback>(data->getter()); |
| 437 if (call_fun == NULL) return isolate->factory()->undefined_value(); | 436 if (call_fun == NULL) return isolate->factory()->undefined_value(); |
| 438 | 437 |
| 439 HandleScope scope(isolate); | 438 HandleScope scope(isolate); |
| 440 Handle<JSObject> self = Handle<JSObject>::cast(receiver); | 439 Handle<JSObject> self = Handle<JSObject>::cast(receiver); |
| 441 Handle<String> key = Handle<String>::cast(name); | 440 Handle<String> key = Handle<String>::cast(name); |
| 442 LOG(isolate, ApiNamedPropertyAccess("load", *self, *name)); | 441 LOG(isolate, ApiNamedPropertyAccess("load", *self, *name)); |
| 443 PropertyCallbackArguments args(isolate, data->data(), *self, *object); | 442 PropertyCallbackArguments args(isolate, data->data(), *self, *object); |
| 444 v8::Handle<v8::Value> result = | 443 v8::Handle<v8::Value> result = |
| 445 args.Call(call_fun, v8::Utils::ToLocal(key)); | 444 args.Call(call_fun, v8::Utils::ToLocal(key)); |
| 446 RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object); | 445 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); |
| 447 if (result.IsEmpty()) { | 446 if (result.IsEmpty()) { |
| 448 return isolate->factory()->undefined_value(); | 447 return isolate->factory()->undefined_value(); |
| 449 } | 448 } |
| 450 Handle<Object> return_value = v8::Utils::OpenHandle(*result); | 449 Handle<Object> return_value = v8::Utils::OpenHandle(*result); |
| 451 return_value->VerifyApiCallResultType(); | 450 return_value->VerifyApiCallResultType(); |
| 452 return scope.CloseAndEscape(return_value); | 451 return scope.CloseAndEscape(return_value); |
| 453 } | 452 } |
| 454 | 453 |
| 455 // __defineGetter__ callback | 454 // __defineGetter__ callback |
| 456 Handle<Object> getter(Handle<AccessorPair>::cast(structure)->getter(), | 455 Handle<Object> getter(Handle<AccessorPair>::cast(structure)->getter(), |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 bool has_pending_exception; | 548 bool has_pending_exception; |
| 550 Handle<Object> result = Execution::Call( | 549 Handle<Object> result = Execution::Call( |
| 551 isolate, fun, self, 0, NULL, &has_pending_exception, true); | 550 isolate, fun, self, 0, NULL, &has_pending_exception, true); |
| 552 // Check for pending exception and return the result. | 551 // Check for pending exception and return the result. |
| 553 if (has_pending_exception) return Failure::Exception(); | 552 if (has_pending_exception) return Failure::Exception(); |
| 554 return *result; | 553 return *result; |
| 555 } | 554 } |
| 556 | 555 |
| 557 | 556 |
| 558 // Only deal with CALLBACKS and INTERCEPTOR | 557 // Only deal with CALLBACKS and INTERCEPTOR |
| 559 Handle<Object> JSObject::GetPropertyWithFailedAccessCheck( | 558 MaybeHandle<Object> JSObject::GetPropertyWithFailedAccessCheck( |
| 560 Handle<JSObject> object, | 559 Handle<JSObject> object, |
| 561 Handle<Object> receiver, | 560 Handle<Object> receiver, |
| 562 LookupResult* result, | 561 LookupResult* result, |
| 563 Handle<Name> name, | 562 Handle<Name> name, |
| 564 PropertyAttributes* attributes) { | 563 PropertyAttributes* attributes) { |
| 565 Isolate* isolate = name->GetIsolate(); | 564 Isolate* isolate = name->GetIsolate(); |
| 566 if (result->IsProperty()) { | 565 if (result->IsProperty()) { |
| 567 switch (result->type()) { | 566 switch (result->type()) { |
| 568 case CALLBACKS: { | 567 case CALLBACKS: { |
| 569 // Only allow API accessors. | 568 // Only allow API accessors. |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 if (!fun->shared()->IsApiFunction()) | 821 if (!fun->shared()->IsApiFunction()) |
| 823 return true; | 822 return true; |
| 824 // If the object is fully fast case and has the same map it was | 823 // If the object is fully fast case and has the same map it was |
| 825 // created with then no changes can have been made to it. | 824 // created with then no changes can have been made to it. |
| 826 return map() != fun->initial_map() | 825 return map() != fun->initial_map() |
| 827 || !HasFastObjectElements() | 826 || !HasFastObjectElements() |
| 828 || !HasFastProperties(); | 827 || !HasFastProperties(); |
| 829 } | 828 } |
| 830 | 829 |
| 831 | 830 |
| 832 Handle<Object> Object::GetProperty(Handle<Object> object, | 831 MaybeHandle<Object> Object::GetProperty(Handle<Object> object, |
| 833 Handle<Object> receiver, | 832 Handle<Object> receiver, |
| 834 LookupResult* result, | 833 LookupResult* result, |
| 835 Handle<Name> key, | 834 Handle<Name> key, |
| 836 PropertyAttributes* attributes) { | 835 PropertyAttributes* attributes) { |
| 837 Isolate* isolate = result->isolate(); | 836 Isolate* isolate = result->isolate(); |
| 838 CALL_HEAP_FUNCTION( | 837 CALL_HEAP_FUNCTION( |
| 839 isolate, | 838 isolate, |
| 840 object->GetProperty(*receiver, result, *key, attributes), | 839 object->GetProperty(*receiver, result, *key, attributes), |
| 841 Object); | 840 Object); |
| 842 } | 841 } |
| 843 | 842 |
| 844 | 843 |
| 845 // TODO(yangguo): handlify this and get rid of. | 844 // TODO(yangguo): handlify this and get rid of. |
| 846 MaybeObject* Object::GetProperty(Object* receiver, | 845 MaybeObject* Object::GetProperty(Object* receiver, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 876 true; | 875 true; |
| 877 current = current->GetPrototype(isolate)) { | 876 current = current->GetPrototype(isolate)) { |
| 878 if (current->IsAccessCheckNeeded()) { | 877 if (current->IsAccessCheckNeeded()) { |
| 879 // Check if we're allowed to read from the current object. Note | 878 // Check if we're allowed to read from the current object. Note |
| 880 // that even though we may not actually end up loading the named | 879 // that even though we may not actually end up loading the named |
| 881 // property from the current object, we still check that we have | 880 // property from the current object, we still check that we have |
| 882 // access to it. | 881 // access to it. |
| 883 JSObject* checked = JSObject::cast(current); | 882 JSObject* checked = JSObject::cast(current); |
| 884 if (!isolate->MayNamedAccess(checked, name, v8::ACCESS_GET)) { | 883 if (!isolate->MayNamedAccess(checked, name, v8::ACCESS_GET)) { |
| 885 HandleScope scope(isolate); | 884 HandleScope scope(isolate); |
| 886 Handle<Object> value = JSObject::GetPropertyWithFailedAccessCheck( | 885 Handle<Object> value; |
| 887 handle(checked, isolate), | 886 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 888 handle(receiver, isolate), | 887 isolate, value, |
| 889 result, | 888 JSObject::GetPropertyWithFailedAccessCheck( |
| 890 handle(name, isolate), | 889 handle(checked, isolate), |
| 891 attributes); | 890 handle(receiver, isolate), |
| 892 RETURN_IF_EMPTY_HANDLE(isolate, value); | 891 result, |
| 892 handle(name, isolate), |
| 893 attributes)); |
| 893 return *value; | 894 return *value; |
| 894 } | 895 } |
| 895 } | 896 } |
| 896 // Stop traversing the chain once we reach the last object in the | 897 // Stop traversing the chain once we reach the last object in the |
| 897 // chain; either the holder of the result or null in case of an | 898 // chain; either the holder of the result or null in case of an |
| 898 // absent property. | 899 // absent property. |
| 899 if (current == last) break; | 900 if (current == last) break; |
| 900 } | 901 } |
| 901 } | 902 } |
| 902 | 903 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 916 result->representation(), | 917 result->representation(), |
| 917 result->GetFieldIndex().field_index()); | 918 result->GetFieldIndex().field_index()); |
| 918 if (!maybe_result->To(&value)) return maybe_result; | 919 if (!maybe_result->To(&value)) return maybe_result; |
| 919 ASSERT(!value->IsTheHole() || result->IsReadOnly()); | 920 ASSERT(!value->IsTheHole() || result->IsReadOnly()); |
| 920 return value->IsTheHole() ? heap->undefined_value() : value; | 921 return value->IsTheHole() ? heap->undefined_value() : value; |
| 921 } | 922 } |
| 922 case CONSTANT: | 923 case CONSTANT: |
| 923 return result->GetConstant(); | 924 return result->GetConstant(); |
| 924 case CALLBACKS: { | 925 case CALLBACKS: { |
| 925 HandleScope scope(isolate); | 926 HandleScope scope(isolate); |
| 926 Handle<Object> value = JSObject::GetPropertyWithCallback( | 927 Handle<Object> value; |
| 927 handle(result->holder(), isolate), | 928 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 928 handle(receiver, isolate), | 929 isolate, value, |
| 929 handle(result->GetCallbackObject(), isolate), | 930 JSObject::GetPropertyWithCallback( |
| 930 handle(name, isolate)); | 931 handle(result->holder(), isolate), |
| 931 RETURN_IF_EMPTY_HANDLE(isolate, value); | 932 handle(receiver, isolate), |
| 933 handle(result->GetCallbackObject(), isolate), |
| 934 handle(name, isolate))); |
| 932 return *value; | 935 return *value; |
| 933 } | 936 } |
| 934 case HANDLER: | 937 case HANDLER: |
| 935 return result->proxy()->GetPropertyWithHandler(receiver, name); | 938 return result->proxy()->GetPropertyWithHandler(receiver, name); |
| 936 case INTERCEPTOR: { | 939 case INTERCEPTOR: { |
| 937 HandleScope scope(isolate); | 940 HandleScope scope(isolate); |
| 938 Handle<Object> value = JSObject::GetPropertyWithInterceptor( | 941 Handle<Object> value; |
| 939 handle(result->holder(), isolate), | 942 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 940 handle(receiver, isolate), | 943 isolate, value, |
| 941 handle(name, isolate), | 944 JSObject::GetPropertyWithInterceptor( |
| 942 attributes); | 945 handle(result->holder(), isolate), |
| 943 RETURN_IF_EMPTY_HANDLE(isolate, value); | 946 handle(receiver, isolate), |
| 947 handle(name, isolate), |
| 948 attributes)); |
| 944 return *value; | 949 return *value; |
| 945 } | 950 } |
| 946 case NONEXISTENT: | 951 case NONEXISTENT: |
| 947 UNREACHABLE(); | 952 UNREACHABLE(); |
| 948 break; | 953 break; |
| 949 } | 954 } |
| 950 UNREACHABLE(); | 955 UNREACHABLE(); |
| 951 return NULL; | 956 return NULL; |
| 952 } | 957 } |
| 953 | 958 |
| (...skipping 12245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13199 InterceptorInfo* JSObject::GetIndexedInterceptor() { | 13204 InterceptorInfo* JSObject::GetIndexedInterceptor() { |
| 13200 ASSERT(map()->has_indexed_interceptor()); | 13205 ASSERT(map()->has_indexed_interceptor()); |
| 13201 JSFunction* constructor = JSFunction::cast(map()->constructor()); | 13206 JSFunction* constructor = JSFunction::cast(map()->constructor()); |
| 13202 ASSERT(constructor->shared()->IsApiFunction()); | 13207 ASSERT(constructor->shared()->IsApiFunction()); |
| 13203 Object* result = | 13208 Object* result = |
| 13204 constructor->shared()->get_api_func_data()->indexed_property_handler(); | 13209 constructor->shared()->get_api_func_data()->indexed_property_handler(); |
| 13205 return InterceptorInfo::cast(result); | 13210 return InterceptorInfo::cast(result); |
| 13206 } | 13211 } |
| 13207 | 13212 |
| 13208 | 13213 |
| 13209 Handle<Object> JSObject::GetPropertyPostInterceptor( | 13214 MaybeHandle<Object> JSObject::GetPropertyPostInterceptor( |
| 13210 Handle<JSObject> object, | 13215 Handle<JSObject> object, |
| 13211 Handle<Object> receiver, | 13216 Handle<Object> receiver, |
| 13212 Handle<Name> name, | 13217 Handle<Name> name, |
| 13213 PropertyAttributes* attributes) { | 13218 PropertyAttributes* attributes) { |
| 13214 // Check local property in holder, ignore interceptor. | 13219 // Check local property in holder, ignore interceptor. |
| 13215 Isolate* isolate = object->GetIsolate(); | 13220 Isolate* isolate = object->GetIsolate(); |
| 13216 LookupResult lookup(isolate); | 13221 LookupResult lookup(isolate); |
| 13217 object->LocalLookupRealNamedProperty(*name, &lookup); | 13222 object->LocalLookupRealNamedProperty(*name, &lookup); |
| 13218 Handle<Object> result; | |
| 13219 if (lookup.IsFound()) { | 13223 if (lookup.IsFound()) { |
| 13220 result = GetProperty(object, receiver, &lookup, name, attributes); | 13224 return GetProperty(object, receiver, &lookup, name, attributes); |
| 13221 } else { | 13225 } else { |
| 13222 // Continue searching via the prototype chain. | 13226 // Continue searching via the prototype chain. |
| 13223 Handle<Object> prototype(object->GetPrototype(), isolate); | 13227 Handle<Object> prototype(object->GetPrototype(), isolate); |
| 13224 *attributes = ABSENT; | 13228 *attributes = ABSENT; |
| 13225 if (prototype->IsNull()) return isolate->factory()->undefined_value(); | 13229 if (prototype->IsNull()) return isolate->factory()->undefined_value(); |
| 13226 result = GetPropertyWithReceiver(prototype, receiver, name, attributes); | 13230 return GetPropertyWithReceiver(prototype, receiver, name, attributes); |
| 13227 } | 13231 } |
| 13228 return result; | |
| 13229 } | 13232 } |
| 13230 | 13233 |
| 13231 | 13234 |
| 13232 MaybeObject* JSObject::GetLocalPropertyPostInterceptor( | 13235 MaybeObject* JSObject::GetLocalPropertyPostInterceptor( |
| 13233 Object* receiver, | 13236 Object* receiver, |
| 13234 Name* name, | 13237 Name* name, |
| 13235 PropertyAttributes* attributes) { | 13238 PropertyAttributes* attributes) { |
| 13236 // Check local property in holder, ignore interceptor. | 13239 // Check local property in holder, ignore interceptor. |
| 13237 LookupResult result(GetIsolate()); | 13240 LookupResult result(GetIsolate()); |
| 13238 LocalLookupRealNamedProperty(name, &result); | 13241 LocalLookupRealNamedProperty(name, &result); |
| 13239 if (result.IsFound()) { | 13242 if (result.IsFound()) { |
| 13240 return GetProperty(receiver, &result, name, attributes); | 13243 return GetProperty(receiver, &result, name, attributes); |
| 13241 } | 13244 } |
| 13242 return GetHeap()->undefined_value(); | 13245 return GetHeap()->undefined_value(); |
| 13243 } | 13246 } |
| 13244 | 13247 |
| 13245 | 13248 |
| 13246 Handle<Object> JSObject::GetPropertyWithInterceptor( | 13249 MaybeHandle<Object> JSObject::GetPropertyWithInterceptor( |
| 13247 Handle<JSObject> object, | 13250 Handle<JSObject> object, |
| 13248 Handle<Object> receiver, | 13251 Handle<Object> receiver, |
| 13249 Handle<Name> name, | 13252 Handle<Name> name, |
| 13250 PropertyAttributes* attributes) { | 13253 PropertyAttributes* attributes) { |
| 13251 Isolate* isolate = object->GetIsolate(); | 13254 Isolate* isolate = object->GetIsolate(); |
| 13252 | 13255 |
| 13253 // TODO(rossberg): Support symbols in the API. | 13256 // TODO(rossberg): Support symbols in the API. |
| 13254 if (name->IsSymbol()) return isolate->factory()->undefined_value(); | 13257 if (name->IsSymbol()) return isolate->factory()->undefined_value(); |
| 13255 | 13258 |
| 13256 Handle<InterceptorInfo> interceptor(object->GetNamedInterceptor(), isolate); | 13259 Handle<InterceptorInfo> interceptor(object->GetNamedInterceptor(), isolate); |
| 13257 Handle<String> name_string = Handle<String>::cast(name); | 13260 Handle<String> name_string = Handle<String>::cast(name); |
| 13258 | 13261 |
| 13259 if (!interceptor->getter()->IsUndefined()) { | 13262 if (!interceptor->getter()->IsUndefined()) { |
| 13260 v8::NamedPropertyGetterCallback getter = | 13263 v8::NamedPropertyGetterCallback getter = |
| 13261 v8::ToCData<v8::NamedPropertyGetterCallback>(interceptor->getter()); | 13264 v8::ToCData<v8::NamedPropertyGetterCallback>(interceptor->getter()); |
| 13262 LOG(isolate, | 13265 LOG(isolate, |
| 13263 ApiNamedPropertyAccess("interceptor-named-get", *object, *name)); | 13266 ApiNamedPropertyAccess("interceptor-named-get", *object, *name)); |
| 13264 PropertyCallbackArguments | 13267 PropertyCallbackArguments |
| 13265 args(isolate, interceptor->data(), *receiver, *object); | 13268 args(isolate, interceptor->data(), *receiver, *object); |
| 13266 v8::Handle<v8::Value> result = | 13269 v8::Handle<v8::Value> result = |
| 13267 args.Call(getter, v8::Utils::ToLocal(name_string)); | 13270 args.Call(getter, v8::Utils::ToLocal(name_string)); |
| 13268 RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object); | 13271 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); |
| 13269 if (!result.IsEmpty()) { | 13272 if (!result.IsEmpty()) { |
| 13270 *attributes = NONE; | 13273 *attributes = NONE; |
| 13271 Handle<Object> result_internal = v8::Utils::OpenHandle(*result); | 13274 Handle<Object> result_internal = v8::Utils::OpenHandle(*result); |
| 13272 result_internal->VerifyApiCallResultType(); | 13275 result_internal->VerifyApiCallResultType(); |
| 13273 // Rebox handle to escape this scope. | 13276 // Rebox handle to escape this scope. |
| 13274 return handle(*result_internal, isolate); | 13277 return handle(*result_internal, isolate); |
| 13275 } | 13278 } |
| 13276 } | 13279 } |
| 13277 | 13280 |
| 13278 return GetPropertyPostInterceptor(object, receiver, name, attributes); | 13281 return GetPropertyPostInterceptor(object, receiver, name, attributes); |
| (...skipping 3198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16477 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16480 #define ERROR_MESSAGES_TEXTS(C, T) T, |
| 16478 static const char* error_messages_[] = { | 16481 static const char* error_messages_[] = { |
| 16479 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16482 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
| 16480 }; | 16483 }; |
| 16481 #undef ERROR_MESSAGES_TEXTS | 16484 #undef ERROR_MESSAGES_TEXTS |
| 16482 return error_messages_[reason]; | 16485 return error_messages_[reason]; |
| 16483 } | 16486 } |
| 16484 | 16487 |
| 16485 | 16488 |
| 16486 } } // namespace v8::internal | 16489 } } // namespace v8::internal |
| OLD | NEW |