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 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 value = result->holder()->FastPropertyAt(result->GetFieldIndex()); | 644 value = result->holder()->FastPropertyAt(result->GetFieldIndex()); |
645 ASSERT(!value->IsTheHole() || result->IsReadOnly()); | 645 ASSERT(!value->IsTheHole() || result->IsReadOnly()); |
646 return value->IsTheHole() ? heap->undefined_value() : value; | 646 return value->IsTheHole() ? heap->undefined_value() : value; |
647 case CONSTANT_FUNCTION: | 647 case CONSTANT_FUNCTION: |
648 return result->GetConstantFunction(); | 648 return result->GetConstantFunction(); |
649 case CALLBACKS: | 649 case CALLBACKS: |
650 return result->holder()->GetPropertyWithCallback( | 650 return result->holder()->GetPropertyWithCallback( |
651 receiver, result->GetCallbackObject(), name); | 651 receiver, result->GetCallbackObject(), name); |
652 case HANDLER: | 652 case HANDLER: |
653 return result->proxy()->GetPropertyWithHandler(receiver, name); | 653 return result->proxy()->GetPropertyWithHandler(receiver, name); |
654 case INTERCEPTOR: { | 654 case INTERCEPTOR: |
655 JSObject* recvr = JSObject::cast(receiver); | |
656 return result->holder()->GetPropertyWithInterceptor( | 655 return result->holder()->GetPropertyWithInterceptor( |
657 recvr, name, attributes); | 656 receiver, name, attributes); |
658 } | |
659 case TRANSITION: | 657 case TRANSITION: |
660 case NONEXISTENT: | 658 case NONEXISTENT: |
661 UNREACHABLE(); | 659 UNREACHABLE(); |
662 break; | 660 break; |
663 } | 661 } |
664 UNREACHABLE(); | 662 UNREACHABLE(); |
665 return NULL; | 663 return NULL; |
666 } | 664 } |
667 | 665 |
668 | 666 |
(...skipping 9528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10197 ASSERT(map()->has_indexed_interceptor()); | 10195 ASSERT(map()->has_indexed_interceptor()); |
10198 JSFunction* constructor = JSFunction::cast(map()->constructor()); | 10196 JSFunction* constructor = JSFunction::cast(map()->constructor()); |
10199 ASSERT(constructor->shared()->IsApiFunction()); | 10197 ASSERT(constructor->shared()->IsApiFunction()); |
10200 Object* result = | 10198 Object* result = |
10201 constructor->shared()->get_api_func_data()->indexed_property_handler(); | 10199 constructor->shared()->get_api_func_data()->indexed_property_handler(); |
10202 return InterceptorInfo::cast(result); | 10200 return InterceptorInfo::cast(result); |
10203 } | 10201 } |
10204 | 10202 |
10205 | 10203 |
10206 MaybeObject* JSObject::GetPropertyPostInterceptor( | 10204 MaybeObject* JSObject::GetPropertyPostInterceptor( |
10207 JSReceiver* receiver, | 10205 Object* receiver, |
10208 String* name, | 10206 String* name, |
10209 PropertyAttributes* attributes) { | 10207 PropertyAttributes* attributes) { |
10210 // Check local property in holder, ignore interceptor. | 10208 // Check local property in holder, ignore interceptor. |
10211 LookupResult result(GetIsolate()); | 10209 LookupResult result(GetIsolate()); |
10212 LocalLookupRealNamedProperty(name, &result); | 10210 LocalLookupRealNamedProperty(name, &result); |
10213 if (result.IsFound()) { | 10211 if (result.IsFound()) { |
10214 return GetProperty(receiver, &result, name, attributes); | 10212 return GetProperty(receiver, &result, name, attributes); |
10215 } | 10213 } |
10216 // Continue searching via the prototype chain. | 10214 // Continue searching via the prototype chain. |
10217 Object* pt = GetPrototype(); | 10215 Object* pt = GetPrototype(); |
10218 *attributes = ABSENT; | 10216 *attributes = ABSENT; |
10219 if (pt->IsNull()) return GetHeap()->undefined_value(); | 10217 if (pt->IsNull()) return GetHeap()->undefined_value(); |
10220 return pt->GetPropertyWithReceiver(receiver, name, attributes); | 10218 return pt->GetPropertyWithReceiver(receiver, name, attributes); |
10221 } | 10219 } |
10222 | 10220 |
10223 | 10221 |
10224 MaybeObject* JSObject::GetLocalPropertyPostInterceptor( | 10222 MaybeObject* JSObject::GetLocalPropertyPostInterceptor( |
10225 JSReceiver* receiver, | 10223 Object* receiver, |
10226 String* name, | 10224 String* name, |
10227 PropertyAttributes* attributes) { | 10225 PropertyAttributes* attributes) { |
10228 // Check local property in holder, ignore interceptor. | 10226 // Check local property in holder, ignore interceptor. |
10229 LookupResult result(GetIsolate()); | 10227 LookupResult result(GetIsolate()); |
10230 LocalLookupRealNamedProperty(name, &result); | 10228 LocalLookupRealNamedProperty(name, &result); |
10231 if (result.IsFound()) { | 10229 if (result.IsFound()) { |
10232 return GetProperty(receiver, &result, name, attributes); | 10230 return GetProperty(receiver, &result, name, attributes); |
10233 } | 10231 } |
10234 return GetHeap()->undefined_value(); | 10232 return GetHeap()->undefined_value(); |
10235 } | 10233 } |
10236 | 10234 |
10237 | 10235 |
10238 MaybeObject* JSObject::GetPropertyWithInterceptor( | 10236 MaybeObject* JSObject::GetPropertyWithInterceptor( |
10239 JSReceiver* receiver, | 10237 Object* receiver, |
10240 String* name, | 10238 String* name, |
10241 PropertyAttributes* attributes) { | 10239 PropertyAttributes* attributes) { |
10242 Isolate* isolate = GetIsolate(); | 10240 Isolate* isolate = GetIsolate(); |
10243 InterceptorInfo* interceptor = GetNamedInterceptor(); | 10241 InterceptorInfo* interceptor = GetNamedInterceptor(); |
10244 HandleScope scope(isolate); | 10242 HandleScope scope(isolate); |
10245 Handle<JSReceiver> receiver_handle(receiver); | 10243 Handle<Object> receiver_handle(receiver); |
10246 Handle<JSObject> holder_handle(this); | 10244 Handle<JSObject> holder_handle(this); |
10247 Handle<String> name_handle(name); | 10245 Handle<String> name_handle(name); |
10248 | 10246 |
10249 if (!interceptor->getter()->IsUndefined()) { | 10247 if (!interceptor->getter()->IsUndefined()) { |
10250 v8::NamedPropertyGetter getter = | 10248 v8::NamedPropertyGetter getter = |
10251 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter()); | 10249 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter()); |
10252 LOG(isolate, | 10250 LOG(isolate, |
10253 ApiNamedPropertyAccess("interceptor-named-get", *holder_handle, name)); | 10251 ApiNamedPropertyAccess("interceptor-named-get", *holder_handle, name)); |
10254 CustomArguments args(isolate, interceptor->data(), receiver, this); | 10252 CustomArguments args(isolate, interceptor->data(), receiver, this); |
10255 v8::AccessorInfo info(args.end()); | 10253 v8::AccessorInfo info(args.end()); |
(...skipping 2965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13221 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 13219 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
13222 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 13220 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
13223 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 13221 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
13224 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 13222 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
13225 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 13223 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
13226 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 13224 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
13227 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 13225 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
13228 } | 13226 } |
13229 | 13227 |
13230 } } // namespace v8::internal | 13228 } } // namespace v8::internal |
OLD | NEW |