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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 value = result->holder()->FastPropertyAt(result->GetFieldIndex()); | 643 value = result->holder()->FastPropertyAt(result->GetFieldIndex()); |
644 ASSERT(!value->IsTheHole() || result->IsReadOnly()); | 644 ASSERT(!value->IsTheHole() || result->IsReadOnly()); |
645 return value->IsTheHole() ? heap->undefined_value() : value; | 645 return value->IsTheHole() ? heap->undefined_value() : value; |
646 case CONSTANT_FUNCTION: | 646 case CONSTANT_FUNCTION: |
647 return result->GetConstantFunction(); | 647 return result->GetConstantFunction(); |
648 case CALLBACKS: | 648 case CALLBACKS: |
649 return result->holder()->GetPropertyWithCallback( | 649 return result->holder()->GetPropertyWithCallback( |
650 receiver, result->GetCallbackObject(), name); | 650 receiver, result->GetCallbackObject(), name); |
651 case HANDLER: | 651 case HANDLER: |
652 return result->proxy()->GetPropertyWithHandler(receiver, name); | 652 return result->proxy()->GetPropertyWithHandler(receiver, name); |
653 case INTERCEPTOR: | 653 case INTERCEPTOR: { |
| 654 JSObject* recvr = JSObject::cast(receiver); |
654 return result->holder()->GetPropertyWithInterceptor( | 655 return result->holder()->GetPropertyWithInterceptor( |
655 receiver, name, attributes); | 656 recvr, name, attributes); |
| 657 } |
656 case TRANSITION: | 658 case TRANSITION: |
657 case NONEXISTENT: | 659 case NONEXISTENT: |
658 UNREACHABLE(); | 660 UNREACHABLE(); |
659 break; | 661 break; |
660 } | 662 } |
661 UNREACHABLE(); | 663 UNREACHABLE(); |
662 return NULL; | 664 return NULL; |
663 } | 665 } |
664 | 666 |
665 | 667 |
(...skipping 9564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10230 ASSERT(map()->has_indexed_interceptor()); | 10232 ASSERT(map()->has_indexed_interceptor()); |
10231 JSFunction* constructor = JSFunction::cast(map()->constructor()); | 10233 JSFunction* constructor = JSFunction::cast(map()->constructor()); |
10232 ASSERT(constructor->shared()->IsApiFunction()); | 10234 ASSERT(constructor->shared()->IsApiFunction()); |
10233 Object* result = | 10235 Object* result = |
10234 constructor->shared()->get_api_func_data()->indexed_property_handler(); | 10236 constructor->shared()->get_api_func_data()->indexed_property_handler(); |
10235 return InterceptorInfo::cast(result); | 10237 return InterceptorInfo::cast(result); |
10236 } | 10238 } |
10237 | 10239 |
10238 | 10240 |
10239 MaybeObject* JSObject::GetPropertyPostInterceptor( | 10241 MaybeObject* JSObject::GetPropertyPostInterceptor( |
10240 Object* receiver, | 10242 JSReceiver* receiver, |
10241 String* name, | 10243 String* name, |
10242 PropertyAttributes* attributes) { | 10244 PropertyAttributes* attributes) { |
10243 // Check local property in holder, ignore interceptor. | 10245 // Check local property in holder, ignore interceptor. |
10244 LookupResult result(GetIsolate()); | 10246 LookupResult result(GetIsolate()); |
10245 LocalLookupRealNamedProperty(name, &result); | 10247 LocalLookupRealNamedProperty(name, &result); |
10246 if (result.IsFound()) { | 10248 if (result.IsFound()) { |
10247 return GetProperty(receiver, &result, name, attributes); | 10249 return GetProperty(receiver, &result, name, attributes); |
10248 } | 10250 } |
10249 // Continue searching via the prototype chain. | 10251 // Continue searching via the prototype chain. |
10250 Object* pt = GetPrototype(); | 10252 Object* pt = GetPrototype(); |
10251 *attributes = ABSENT; | 10253 *attributes = ABSENT; |
10252 if (pt->IsNull()) return GetHeap()->undefined_value(); | 10254 if (pt->IsNull()) return GetHeap()->undefined_value(); |
10253 return pt->GetPropertyWithReceiver(receiver, name, attributes); | 10255 return pt->GetPropertyWithReceiver(receiver, name, attributes); |
10254 } | 10256 } |
10255 | 10257 |
10256 | 10258 |
10257 MaybeObject* JSObject::GetLocalPropertyPostInterceptor( | 10259 MaybeObject* JSObject::GetLocalPropertyPostInterceptor( |
10258 Object* receiver, | 10260 JSReceiver* receiver, |
10259 String* name, | 10261 String* name, |
10260 PropertyAttributes* attributes) { | 10262 PropertyAttributes* attributes) { |
10261 // Check local property in holder, ignore interceptor. | 10263 // Check local property in holder, ignore interceptor. |
10262 LookupResult result(GetIsolate()); | 10264 LookupResult result(GetIsolate()); |
10263 LocalLookupRealNamedProperty(name, &result); | 10265 LocalLookupRealNamedProperty(name, &result); |
10264 if (result.IsFound()) { | 10266 if (result.IsFound()) { |
10265 return GetProperty(receiver, &result, name, attributes); | 10267 return GetProperty(receiver, &result, name, attributes); |
10266 } | 10268 } |
10267 return GetHeap()->undefined_value(); | 10269 return GetHeap()->undefined_value(); |
10268 } | 10270 } |
10269 | 10271 |
10270 | 10272 |
10271 MaybeObject* JSObject::GetPropertyWithInterceptor( | 10273 MaybeObject* JSObject::GetPropertyWithInterceptor( |
10272 Object* receiver, | 10274 JSReceiver* receiver, |
10273 String* name, | 10275 String* name, |
10274 PropertyAttributes* attributes) { | 10276 PropertyAttributes* attributes) { |
10275 Isolate* isolate = GetIsolate(); | 10277 Isolate* isolate = GetIsolate(); |
10276 InterceptorInfo* interceptor = GetNamedInterceptor(); | 10278 InterceptorInfo* interceptor = GetNamedInterceptor(); |
10277 HandleScope scope(isolate); | 10279 HandleScope scope(isolate); |
10278 Handle<Object> receiver_handle(receiver); | 10280 Handle<JSReceiver> receiver_handle(receiver); |
10279 Handle<JSObject> holder_handle(this); | 10281 Handle<JSObject> holder_handle(this); |
10280 Handle<String> name_handle(name); | 10282 Handle<String> name_handle(name); |
10281 | 10283 |
10282 if (!interceptor->getter()->IsUndefined()) { | 10284 if (!interceptor->getter()->IsUndefined()) { |
10283 v8::NamedPropertyGetter getter = | 10285 v8::NamedPropertyGetter getter = |
10284 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter()); | 10286 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter()); |
10285 LOG(isolate, | 10287 LOG(isolate, |
10286 ApiNamedPropertyAccess("interceptor-named-get", *holder_handle, name)); | 10288 ApiNamedPropertyAccess("interceptor-named-get", *holder_handle, name)); |
10287 CustomArguments args(isolate, interceptor->data(), receiver, this); | 10289 CustomArguments args(isolate, interceptor->data(), receiver, this); |
10288 v8::AccessorInfo info(args.end()); | 10290 v8::AccessorInfo info(args.end()); |
(...skipping 2906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13195 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 13197 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
13196 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 13198 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
13197 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 13199 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
13198 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 13200 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
13199 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 13201 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
13200 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 13202 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
13201 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 13203 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
13202 } | 13204 } |
13203 | 13205 |
13204 } } // namespace v8::internal | 13206 } } // namespace v8::internal |
OLD | NEW |