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 9807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10476 ASSERT(map()->has_indexed_interceptor()); | 10474 ASSERT(map()->has_indexed_interceptor()); |
10477 JSFunction* constructor = JSFunction::cast(map()->constructor()); | 10475 JSFunction* constructor = JSFunction::cast(map()->constructor()); |
10478 ASSERT(constructor->shared()->IsApiFunction()); | 10476 ASSERT(constructor->shared()->IsApiFunction()); |
10479 Object* result = | 10477 Object* result = |
10480 constructor->shared()->get_api_func_data()->indexed_property_handler(); | 10478 constructor->shared()->get_api_func_data()->indexed_property_handler(); |
10481 return InterceptorInfo::cast(result); | 10479 return InterceptorInfo::cast(result); |
10482 } | 10480 } |
10483 | 10481 |
10484 | 10482 |
10485 MaybeObject* JSObject::GetPropertyPostInterceptor( | 10483 MaybeObject* JSObject::GetPropertyPostInterceptor( |
10486 JSReceiver* receiver, | 10484 Object* receiver, |
10487 String* name, | 10485 String* name, |
10488 PropertyAttributes* attributes) { | 10486 PropertyAttributes* attributes) { |
10489 // Check local property in holder, ignore interceptor. | 10487 // Check local property in holder, ignore interceptor. |
10490 LookupResult result(GetIsolate()); | 10488 LookupResult result(GetIsolate()); |
10491 LocalLookupRealNamedProperty(name, &result); | 10489 LocalLookupRealNamedProperty(name, &result); |
10492 if (result.IsFound()) { | 10490 if (result.IsFound()) { |
10493 return GetProperty(receiver, &result, name, attributes); | 10491 return GetProperty(receiver, &result, name, attributes); |
10494 } | 10492 } |
10495 // Continue searching via the prototype chain. | 10493 // Continue searching via the prototype chain. |
10496 Object* pt = GetPrototype(); | 10494 Object* pt = GetPrototype(); |
10497 *attributes = ABSENT; | 10495 *attributes = ABSENT; |
10498 if (pt->IsNull()) return GetHeap()->undefined_value(); | 10496 if (pt->IsNull()) return GetHeap()->undefined_value(); |
10499 return pt->GetPropertyWithReceiver(receiver, name, attributes); | 10497 return pt->GetPropertyWithReceiver(receiver, name, attributes); |
10500 } | 10498 } |
10501 | 10499 |
10502 | 10500 |
10503 MaybeObject* JSObject::GetLocalPropertyPostInterceptor( | 10501 MaybeObject* JSObject::GetLocalPropertyPostInterceptor( |
10504 JSReceiver* receiver, | 10502 Object* receiver, |
10505 String* name, | 10503 String* name, |
10506 PropertyAttributes* attributes) { | 10504 PropertyAttributes* attributes) { |
10507 // Check local property in holder, ignore interceptor. | 10505 // Check local property in holder, ignore interceptor. |
10508 LookupResult result(GetIsolate()); | 10506 LookupResult result(GetIsolate()); |
10509 LocalLookupRealNamedProperty(name, &result); | 10507 LocalLookupRealNamedProperty(name, &result); |
10510 if (result.IsFound()) { | 10508 if (result.IsFound()) { |
10511 return GetProperty(receiver, &result, name, attributes); | 10509 return GetProperty(receiver, &result, name, attributes); |
10512 } | 10510 } |
10513 return GetHeap()->undefined_value(); | 10511 return GetHeap()->undefined_value(); |
10514 } | 10512 } |
10515 | 10513 |
10516 | 10514 |
10517 MaybeObject* JSObject::GetPropertyWithInterceptor( | 10515 MaybeObject* JSObject::GetPropertyWithInterceptor( |
10518 JSReceiver* receiver, | 10516 Object* receiver, |
10519 String* name, | 10517 String* name, |
10520 PropertyAttributes* attributes) { | 10518 PropertyAttributes* attributes) { |
10521 Isolate* isolate = GetIsolate(); | 10519 Isolate* isolate = GetIsolate(); |
10522 InterceptorInfo* interceptor = GetNamedInterceptor(); | 10520 InterceptorInfo* interceptor = GetNamedInterceptor(); |
10523 HandleScope scope(isolate); | 10521 HandleScope scope(isolate); |
10524 Handle<JSReceiver> receiver_handle(receiver); | 10522 Handle<Object> receiver_handle(receiver); |
10525 Handle<JSObject> holder_handle(this); | 10523 Handle<JSObject> holder_handle(this); |
10526 Handle<String> name_handle(name); | 10524 Handle<String> name_handle(name); |
10527 | 10525 |
10528 if (!interceptor->getter()->IsUndefined()) { | 10526 if (!interceptor->getter()->IsUndefined()) { |
10529 v8::NamedPropertyGetter getter = | 10527 v8::NamedPropertyGetter getter = |
10530 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter()); | 10528 v8::ToCData<v8::NamedPropertyGetter>(interceptor->getter()); |
10531 LOG(isolate, | 10529 LOG(isolate, |
10532 ApiNamedPropertyAccess("interceptor-named-get", *holder_handle, name)); | 10530 ApiNamedPropertyAccess("interceptor-named-get", *holder_handle, name)); |
10533 CustomArguments args(isolate, interceptor->data(), receiver, this); | 10531 CustomArguments args(isolate, interceptor->data(), receiver, this); |
10534 v8::AccessorInfo info(args.end()); | 10532 v8::AccessorInfo info(args.end()); |
(...skipping 2967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13502 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 13500 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); |
13503 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 13501 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); |
13504 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 13502 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); |
13505 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 13503 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); |
13506 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 13504 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); |
13507 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 13505 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); |
13508 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 13506 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); |
13509 } | 13507 } |
13510 | 13508 |
13511 } } // namespace v8::internal | 13509 } } // namespace v8::internal |
OLD | NEW |