| OLD | NEW | 
|---|
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "src/v8.h" | 5 #include "src/v8.h" | 
| 6 | 6 | 
| 7 #include "src/accessors.h" | 7 #include "src/accessors.h" | 
| 8 #include "src/allocation-site-scopes.h" | 8 #include "src/allocation-site-scopes.h" | 
| 9 #include "src/api.h" | 9 #include "src/api.h" | 
| 10 #include "src/arguments.h" | 10 #include "src/arguments.h" | 
| 11 #include "src/bootstrapper.h" | 11 #include "src/bootstrapper.h" | 
| 12 #include "src/codegen.h" | 12 #include "src/codegen.h" | 
| 13 #include "src/code-stubs.h" | 13 #include "src/code-stubs.h" | 
| 14 #include "src/cpu-profiler.h" | 14 #include "src/cpu-profiler.h" | 
| 15 #include "src/debug.h" | 15 #include "src/debug.h" | 
| 16 #include "src/deoptimizer.h" | 16 #include "src/deoptimizer.h" | 
| 17 #include "src/date.h" | 17 #include "src/date.h" | 
| 18 #include "src/elements.h" | 18 #include "src/elements.h" | 
| 19 #include "src/execution.h" | 19 #include "src/execution.h" | 
| 20 #include "src/field-index.h" | 20 #include "src/field-index.h" | 
| 21 #include "src/field-index-inl.h" | 21 #include "src/field-index-inl.h" | 
| 22 #include "src/full-codegen.h" | 22 #include "src/full-codegen.h" | 
| 23 #include "src/hydrogen.h" | 23 #include "src/hydrogen.h" | 
| 24 #include "src/isolate-inl.h" | 24 #include "src/isolate-inl.h" | 
| 25 #include "src/log.h" | 25 #include "src/log.h" | 
|  | 26 #include "src/lookup.h" | 
| 26 #include "src/objects-inl.h" | 27 #include "src/objects-inl.h" | 
| 27 #include "src/objects-visiting-inl.h" | 28 #include "src/objects-visiting-inl.h" | 
| 28 #include "src/macro-assembler.h" | 29 #include "src/macro-assembler.h" | 
| 29 #include "src/mark-compact.h" | 30 #include "src/mark-compact.h" | 
| 30 #include "src/safepoint-table.h" | 31 #include "src/safepoint-table.h" | 
| 31 #include "src/string-search.h" | 32 #include "src/string-search.h" | 
| 32 #include "src/string-stream.h" | 33 #include "src/string-stream.h" | 
| 33 #include "src/utils.h" | 34 #include "src/utils.h" | 
| 34 | 35 | 
| 35 #ifdef ENABLE_DISASSEMBLER | 36 #ifdef ENABLE_DISASSEMBLER | 
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 120     } else { | 121     } else { | 
| 121       result->isolate()->PushStackTraceAndDie( | 122       result->isolate()->PushStackTraceAndDie( | 
| 122           0xDEAD0000, this, JSReceiver::cast(this)->map(), 0xDEAD0001); | 123           0xDEAD0000, this, JSReceiver::cast(this)->map(), 0xDEAD0001); | 
| 123     } | 124     } | 
| 124   } | 125   } | 
| 125   ASSERT(holder != NULL);  // Cannot handle null or undefined. | 126   ASSERT(holder != NULL);  // Cannot handle null or undefined. | 
| 126   JSReceiver::cast(holder)->Lookup(name, result); | 127   JSReceiver::cast(holder)->Lookup(name, result); | 
| 127 } | 128 } | 
| 128 | 129 | 
| 129 | 130 | 
| 130 MaybeHandle<Object> Object::GetPropertyWithReceiver( | 131 MaybeHandle<Object> Object::GetProperty(LookupIterator* it) { | 
| 131     Handle<Object> object, | 132   for (; it->IsFound(); it->Next()) { | 
| 132     Handle<Object> receiver, | 133     switch (it->state()) { | 
| 133     Handle<Name> name, | 134       case LookupIterator::NOT_FOUND: | 
| 134     PropertyAttributes* attributes) { | 135         UNREACHABLE(); | 
| 135   LookupResult lookup(name->GetIsolate()); | 136       case LookupIterator::JSPROXY: | 
| 136   object->Lookup(name, &lookup); | 137         return JSProxy::GetPropertyWithHandler( | 
| 137   MaybeHandle<Object> result = | 138             it->GetJSProxy(), it->GetReceiver(), it->name()); | 
| 138       GetProperty(object, receiver, &lookup, name, attributes); | 139       case LookupIterator::INTERCEPTOR: { | 
| 139   ASSERT(*attributes <= ABSENT); | 140         MaybeHandle<Object> maybe_result = JSObject::GetPropertyWithInterceptor( | 
| 140   return result; | 141             it->GetHolder(), it->GetReceiver(), it->name()); | 
|  | 142         if (!maybe_result.is_null()) return maybe_result; | 
|  | 143         if (it->isolate()->has_pending_exception()) return maybe_result; | 
|  | 144         break; | 
|  | 145       } | 
|  | 146       case LookupIterator::ACCESS_CHECK: { | 
|  | 147         if (it->HasAccess(v8::ACCESS_GET)) break; | 
|  | 148         return JSObject::GetPropertyWithFailedAccessCheck(it); | 
|  | 149       } | 
|  | 150       case LookupIterator::PROPERTY: | 
|  | 151         if (it->HasProperty()) { | 
|  | 152           switch (it->property_type()) { | 
|  | 153             case LookupIterator::ACCESSORS: | 
|  | 154               return GetPropertyWithAccessor( | 
|  | 155                   it->GetReceiver(), it->name(), | 
|  | 156                   it->GetHolder(), it->GetAccessors()); | 
|  | 157             case LookupIterator::DATA: | 
|  | 158               return it->GetDataValue(); | 
|  | 159           } | 
|  | 160         } | 
|  | 161         break; | 
|  | 162     } | 
|  | 163   } | 
|  | 164   return it->factory()->undefined_value(); | 
| 141 } | 165 } | 
| 142 | 166 | 
| 143 | 167 | 
| 144 bool Object::ToInt32(int32_t* value) { | 168 bool Object::ToInt32(int32_t* value) { | 
| 145   if (IsSmi()) { | 169   if (IsSmi()) { | 
| 146     *value = Smi::cast(this)->value(); | 170     *value = Smi::cast(this)->value(); | 
| 147     return true; | 171     return true; | 
| 148   } | 172   } | 
| 149   if (IsHeapNumber()) { | 173   if (IsHeapNumber()) { | 
| 150     double num = HeapNumber::cast(this)->value(); | 174     double num = HeapNumber::cast(this)->value(); | 
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 370 | 394 | 
| 371   // TODO(rossberg): adjust once there is a story for symbols vs proxies. | 395   // TODO(rossberg): adjust once there is a story for symbols vs proxies. | 
| 372   if (name->IsSymbol()) return isolate->factory()->undefined_value(); | 396   if (name->IsSymbol()) return isolate->factory()->undefined_value(); | 
| 373 | 397 | 
| 374   Handle<Object> args[] = { receiver, name }; | 398   Handle<Object> args[] = { receiver, name }; | 
| 375   return CallTrap( | 399   return CallTrap( | 
| 376       proxy, "get",  isolate->derived_get_trap(), ARRAY_SIZE(args), args); | 400       proxy, "get",  isolate->derived_get_trap(), ARRAY_SIZE(args), args); | 
| 377 } | 401 } | 
| 378 | 402 | 
| 379 | 403 | 
| 380 MaybeHandle<Object> Object::GetPropertyWithCallback(Handle<Object> receiver, | 404 MaybeHandle<Object> Object::GetPropertyWithAccessor(Handle<Object> receiver, | 
| 381                                                     Handle<Name> name, | 405                                                     Handle<Name> name, | 
| 382                                                     Handle<JSObject> holder, | 406                                                     Handle<JSObject> holder, | 
| 383                                                     Handle<Object> structure) { | 407                                                     Handle<Object> structure) { | 
| 384   Isolate* isolate = name->GetIsolate(); | 408   Isolate* isolate = name->GetIsolate(); | 
| 385   ASSERT(!structure->IsForeign()); | 409   ASSERT(!structure->IsForeign()); | 
| 386   // api style callbacks. | 410   // api style callbacks. | 
| 387   if (structure->IsAccessorInfo()) { | 411   if (structure->IsAccessorInfo()) { | 
| 388     Handle<AccessorInfo> accessor_info = Handle<AccessorInfo>::cast(structure); | 412     Handle<AccessorInfo> accessor_info = Handle<AccessorInfo>::cast(structure); | 
| 389     if (!accessor_info->IsCompatibleReceiver(*receiver)) { | 413     if (!accessor_info->IsCompatibleReceiver(*receiver)) { | 
| 390       Handle<Object> args[2] = { name, receiver }; | 414       Handle<Object> args[2] = { name, receiver }; | 
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 535 | 559 | 
| 536   Handle<Object> argv[] = { value }; | 560   Handle<Object> argv[] = { value }; | 
| 537   RETURN_ON_EXCEPTION( | 561   RETURN_ON_EXCEPTION( | 
| 538       isolate, | 562       isolate, | 
| 539       Execution::Call(isolate, setter, receiver, ARRAY_SIZE(argv), argv), | 563       Execution::Call(isolate, setter, receiver, ARRAY_SIZE(argv), argv), | 
| 540       Object); | 564       Object); | 
| 541   return value; | 565   return value; | 
| 542 } | 566 } | 
| 543 | 567 | 
| 544 | 568 | 
| 545 static bool FindAllCanReadHolder(LookupResult* result, | 569 static bool FindAllCanReadHolder(LookupIterator* it) { | 
| 546                                  Handle<Name> name, | 570   for (; it->IsFound(); it->Next()) { | 
| 547                                  bool check_prototype) { | 571     if (it->state() == LookupIterator::PROPERTY && | 
| 548   if (result->IsInterceptor()) { | 572         it->HasProperty() && | 
| 549     result->holder()->LookupOwnRealNamedProperty(name, result); | 573         it->property_type() == LookupIterator::ACCESSORS) { | 
| 550   } | 574       Handle<Object> accessors = it->GetAccessors(); | 
| 551 | 575       if (accessors->IsAccessorInfo()) { | 
| 552   while (result->IsProperty()) { | 576         if (AccessorInfo::cast(*accessors)->all_can_read()) return true; | 
| 553     if (result->type() == CALLBACKS) { | 577       } else if (accessors->IsAccessorPair()) { | 
| 554       Object* callback_obj = result->GetCallbackObject(); | 578         if (AccessorPair::cast(*accessors)->all_can_read()) return true; | 
| 555       if (callback_obj->IsAccessorInfo()) { |  | 
| 556         if (AccessorInfo::cast(callback_obj)->all_can_read()) return true; |  | 
| 557       } else if (callback_obj->IsAccessorPair()) { |  | 
| 558         if (AccessorPair::cast(callback_obj)->all_can_read()) return true; |  | 
| 559       } | 579       } | 
| 560     } | 580     } | 
| 561     if (!check_prototype) break; |  | 
| 562     result->holder()->LookupRealNamedPropertyInPrototypes(name, result); |  | 
| 563   } | 581   } | 
| 564   return false; | 582   return false; | 
| 565 } | 583 } | 
| 566 | 584 | 
| 567 | 585 | 
| 568 MaybeHandle<Object> JSObject::GetPropertyWithFailedAccessCheck( | 586 MaybeHandle<Object> JSObject::GetPropertyWithFailedAccessCheck( | 
| 569     Handle<JSObject> object, | 587     LookupIterator* it) { | 
| 570     Handle<Object> receiver, | 588   Handle<JSObject> checked = Handle<JSObject>::cast(it->GetHolder()); | 
| 571     LookupResult* result, | 589   if (FindAllCanReadHolder(it)) { | 
| 572     Handle<Name> name, | 590     return GetPropertyWithAccessor( | 
| 573     PropertyAttributes* attributes) { | 591         it->GetReceiver(), it->name(), it->GetHolder(), it->GetAccessors()); | 
| 574   if (FindAllCanReadHolder(result, name, true)) { |  | 
| 575     *attributes = result->GetAttributes(); |  | 
| 576     Handle<JSObject> holder(result->holder()); |  | 
| 577     Handle<Object> callbacks(result->GetCallbackObject(), result->isolate()); |  | 
| 578     return GetPropertyWithCallback(receiver, name, holder, callbacks); |  | 
| 579   } | 592   } | 
| 580   *attributes = ABSENT; | 593   it->isolate()->ReportFailedAccessCheck(checked, v8::ACCESS_GET); | 
| 581   Isolate* isolate = result->isolate(); | 594   RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(it->isolate(), Object); | 
| 582   isolate->ReportFailedAccessCheck(object, v8::ACCESS_GET); | 595   return it->factory()->undefined_value(); | 
| 583   RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); |  | 
| 584   return isolate->factory()->undefined_value(); |  | 
| 585 } | 596 } | 
| 586 | 597 | 
| 587 | 598 | 
| 588 PropertyAttributes JSObject::GetPropertyAttributeWithFailedAccessCheck( | 599 PropertyAttributes JSObject::GetPropertyAttributeWithFailedAccessCheck( | 
| 589     Handle<JSObject> object, | 600     Handle<JSObject> object, | 
| 590     LookupResult* result, | 601     LookupResult* result, | 
| 591     Handle<Name> name, | 602     Handle<Name> name, | 
| 592     bool check_prototype) { | 603     bool check_prototype) { | 
| 593   if (FindAllCanReadHolder(result, name, check_prototype)) { | 604   LookupIterator::Type type = check_prototype | 
| 594     return result->GetAttributes(); | 605       ? LookupIterator::CHECK_DERIVED | 
| 595   } | 606       : LookupIterator::CHECK_OWN_REAL; | 
| 596   result->isolate()->ReportFailedAccessCheck(object, v8::ACCESS_HAS); | 607   LookupIterator it(object, name, object, type); | 
|  | 608   if (FindAllCanReadHolder(&it)) return it.property_details().attributes(); | 
|  | 609   it.isolate()->ReportFailedAccessCheck(object, v8::ACCESS_HAS); | 
| 597   // TODO(yangguo): Issue 3269, check for scheduled exception missing? | 610   // TODO(yangguo): Issue 3269, check for scheduled exception missing? | 
| 598   return ABSENT; | 611   return ABSENT; | 
| 599 } | 612 } | 
| 600 | 613 | 
| 601 | 614 | 
| 602 static bool FindAllCanWriteHolder(LookupResult* result, | 615 static bool FindAllCanWriteHolder(LookupResult* result, | 
| 603                                   Handle<Name> name, | 616                                   Handle<Name> name, | 
| 604                                   bool check_prototype) { | 617                                   bool check_prototype) { | 
| 605   if (result->IsInterceptor()) { | 618   if (result->IsInterceptor()) { | 
| 606     result->holder()->LookupOwnRealNamedProperty(name, result); | 619     result->holder()->LookupOwnRealNamedProperty(name, result); | 
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 786   if (!fun->shared()->IsApiFunction()) | 799   if (!fun->shared()->IsApiFunction()) | 
| 787     return true; | 800     return true; | 
| 788   // If the object is fully fast case and has the same map it was | 801   // If the object is fully fast case and has the same map it was | 
| 789   // created with then no changes can have been made to it. | 802   // created with then no changes can have been made to it. | 
| 790   return map() != fun->initial_map() | 803   return map() != fun->initial_map() | 
| 791       || !HasFastObjectElements() | 804       || !HasFastObjectElements() | 
| 792       || !HasFastProperties(); | 805       || !HasFastProperties(); | 
| 793 } | 806 } | 
| 794 | 807 | 
| 795 | 808 | 
| 796 MaybeHandle<Object> Object::GetProperty(Handle<Object> object, |  | 
| 797                                         Handle<Object> receiver, |  | 
| 798                                         LookupResult* result, |  | 
| 799                                         Handle<Name> name, |  | 
| 800                                         PropertyAttributes* attributes) { |  | 
| 801   Isolate* isolate = name->GetIsolate(); |  | 
| 802   Factory* factory = isolate->factory(); |  | 
| 803 |  | 
| 804   // Make sure that the top context does not change when doing |  | 
| 805   // callbacks or interceptor calls. |  | 
| 806   AssertNoContextChange ncc(isolate); |  | 
| 807 |  | 
| 808   // Traverse the prototype chain from the current object (this) to |  | 
| 809   // the holder and check for access rights. This avoids traversing the |  | 
| 810   // objects more than once in case of interceptors, because the |  | 
| 811   // holder will always be the interceptor holder and the search may |  | 
| 812   // only continue with a current object just after the interceptor |  | 
| 813   // holder in the prototype chain. |  | 
| 814   // Proxy handlers do not use the proxy's prototype, so we can skip this. |  | 
| 815   if (!result->IsHandler()) { |  | 
| 816     ASSERT(*object != object->GetPrototype(isolate)); |  | 
| 817     Handle<Object> last = result->IsProperty() |  | 
| 818         ? handle(result->holder()->GetPrototype(), isolate) |  | 
| 819         : Handle<Object>::cast(factory->null_value()); |  | 
| 820     for (Handle<Object> current = object; |  | 
| 821          !current.is_identical_to(last); |  | 
| 822          current = Object::GetPrototype(isolate, current)) { |  | 
| 823       if (current->IsAccessCheckNeeded()) { |  | 
| 824         // Check if we're allowed to read from the current object. Note |  | 
| 825         // that even though we may not actually end up loading the named |  | 
| 826         // property from the current object, we still check that we have |  | 
| 827         // access to it. |  | 
| 828         Handle<JSObject> checked = Handle<JSObject>::cast(current); |  | 
| 829         if (!isolate->MayNamedAccess(checked, name, v8::ACCESS_GET)) { |  | 
| 830           return JSObject::GetPropertyWithFailedAccessCheck( |  | 
| 831               checked, receiver, result, name, attributes); |  | 
| 832         } |  | 
| 833       } |  | 
| 834     } |  | 
| 835   } |  | 
| 836 |  | 
| 837   if (!result->IsProperty()) { |  | 
| 838     *attributes = ABSENT; |  | 
| 839     return factory->undefined_value(); |  | 
| 840   } |  | 
| 841   *attributes = result->GetAttributes(); |  | 
| 842 |  | 
| 843   Handle<Object> value; |  | 
| 844   switch (result->type()) { |  | 
| 845     case NORMAL: { |  | 
| 846       value = JSObject::GetNormalizedProperty( |  | 
| 847           handle(result->holder(), isolate), result); |  | 
| 848       break; |  | 
| 849     } |  | 
| 850     case FIELD: |  | 
| 851       value = JSObject::FastPropertyAt(handle(result->holder(), isolate), |  | 
| 852           result->representation(), FieldIndex::ForLookupResult(result)); |  | 
| 853       break; |  | 
| 854     case CONSTANT: |  | 
| 855       return handle(result->GetConstant(), isolate); |  | 
| 856     case CALLBACKS: |  | 
| 857       return GetPropertyWithCallback( |  | 
| 858           receiver, name, handle(result->holder(), isolate), |  | 
| 859           handle(result->GetCallbackObject(), isolate)); |  | 
| 860     case HANDLER: |  | 
| 861       return JSProxy::GetPropertyWithHandler( |  | 
| 862           handle(result->proxy(), isolate), receiver, name); |  | 
| 863     case INTERCEPTOR: |  | 
| 864       return JSObject::GetPropertyWithInterceptor( |  | 
| 865           handle(result->holder(), isolate), receiver, name, attributes); |  | 
| 866     case NONEXISTENT: |  | 
| 867       UNREACHABLE(); |  | 
| 868       break; |  | 
| 869   } |  | 
| 870   ASSERT(!value->IsTheHole() || result->IsReadOnly()); |  | 
| 871   return value->IsTheHole() ? Handle<Object>::cast(factory->undefined_value()) |  | 
| 872                             : value; |  | 
| 873 } |  | 
| 874 |  | 
| 875 |  | 
| 876 MaybeHandle<Object> Object::GetElementWithReceiver(Isolate* isolate, | 809 MaybeHandle<Object> Object::GetElementWithReceiver(Isolate* isolate, | 
| 877                                                    Handle<Object> object, | 810                                                    Handle<Object> object, | 
| 878                                                    Handle<Object> receiver, | 811                                                    Handle<Object> receiver, | 
| 879                                                    uint32_t index) { | 812                                                    uint32_t index) { | 
| 880   Handle<Object> holder; | 813   Handle<Object> holder; | 
| 881 | 814 | 
| 882   // Iterate up the prototype chain until an element is found or the null | 815   // Iterate up the prototype chain until an element is found or the null | 
| 883   // prototype is encountered. | 816   // prototype is encountered. | 
| 884   for (holder = object; | 817   for (holder = object; | 
| 885        !holder->IsNull(); | 818        !holder->IsNull(); | 
| (...skipping 12887 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 13773 InterceptorInfo* JSObject::GetIndexedInterceptor() { | 13706 InterceptorInfo* JSObject::GetIndexedInterceptor() { | 
| 13774   ASSERT(map()->has_indexed_interceptor()); | 13707   ASSERT(map()->has_indexed_interceptor()); | 
| 13775   JSFunction* constructor = JSFunction::cast(map()->constructor()); | 13708   JSFunction* constructor = JSFunction::cast(map()->constructor()); | 
| 13776   ASSERT(constructor->shared()->IsApiFunction()); | 13709   ASSERT(constructor->shared()->IsApiFunction()); | 
| 13777   Object* result = | 13710   Object* result = | 
| 13778       constructor->shared()->get_api_func_data()->indexed_property_handler(); | 13711       constructor->shared()->get_api_func_data()->indexed_property_handler(); | 
| 13779   return InterceptorInfo::cast(result); | 13712   return InterceptorInfo::cast(result); | 
| 13780 } | 13713 } | 
| 13781 | 13714 | 
| 13782 | 13715 | 
| 13783 MaybeHandle<Object> JSObject::GetPropertyPostInterceptor( |  | 
| 13784     Handle<JSObject> object, |  | 
| 13785     Handle<Object> receiver, |  | 
| 13786     Handle<Name> name, |  | 
| 13787     PropertyAttributes* attributes) { |  | 
| 13788   // Check own property in holder, ignore interceptor. |  | 
| 13789   Isolate* isolate = object->GetIsolate(); |  | 
| 13790   LookupResult lookup(isolate); |  | 
| 13791   object->LookupOwnRealNamedProperty(name, &lookup); |  | 
| 13792   if (lookup.IsFound()) { |  | 
| 13793     return GetProperty(object, receiver, &lookup, name, attributes); |  | 
| 13794   } else { |  | 
| 13795     // Continue searching via the prototype chain. |  | 
| 13796     Handle<Object> prototype(object->GetPrototype(), isolate); |  | 
| 13797     *attributes = ABSENT; |  | 
| 13798     if (prototype->IsNull()) return isolate->factory()->undefined_value(); |  | 
| 13799     return GetPropertyWithReceiver(prototype, receiver, name, attributes); |  | 
| 13800   } |  | 
| 13801 } |  | 
| 13802 |  | 
| 13803 |  | 
| 13804 MaybeHandle<Object> JSObject::GetPropertyWithInterceptor( | 13716 MaybeHandle<Object> JSObject::GetPropertyWithInterceptor( | 
| 13805     Handle<JSObject> object, | 13717     Handle<JSObject> holder, | 
| 13806     Handle<Object> receiver, | 13718     Handle<Object> receiver, | 
| 13807     Handle<Name> name, | 13719     Handle<Name> name) { | 
| 13808     PropertyAttributes* attributes) { | 13720   Isolate* isolate = holder->GetIsolate(); | 
| 13809   Isolate* isolate = object->GetIsolate(); |  | 
| 13810 | 13721 | 
| 13811   // TODO(rossberg): Support symbols in the API. | 13722   // TODO(rossberg): Support symbols in the API. | 
| 13812   if (name->IsSymbol()) return isolate->factory()->undefined_value(); | 13723   if (name->IsSymbol()) return isolate->factory()->undefined_value(); | 
| 13813 | 13724 | 
| 13814   Handle<InterceptorInfo> interceptor(object->GetNamedInterceptor(), isolate); | 13725   Handle<InterceptorInfo> interceptor(holder->GetNamedInterceptor(), isolate); | 
| 13815   Handle<String> name_string = Handle<String>::cast(name); | 13726   Handle<String> name_string = Handle<String>::cast(name); | 
| 13816 | 13727 | 
| 13817   if (!interceptor->getter()->IsUndefined()) { | 13728   if (interceptor->getter()->IsUndefined()) return MaybeHandle<Object>(); | 
| 13818     v8::NamedPropertyGetterCallback getter = |  | 
| 13819         v8::ToCData<v8::NamedPropertyGetterCallback>(interceptor->getter()); |  | 
| 13820     LOG(isolate, |  | 
| 13821         ApiNamedPropertyAccess("interceptor-named-get", *object, *name)); |  | 
| 13822     PropertyCallbackArguments |  | 
| 13823         args(isolate, interceptor->data(), *receiver, *object); |  | 
| 13824     v8::Handle<v8::Value> result = |  | 
| 13825         args.Call(getter, v8::Utils::ToLocal(name_string)); |  | 
| 13826     RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); |  | 
| 13827     if (!result.IsEmpty()) { |  | 
| 13828       *attributes = NONE; |  | 
| 13829       Handle<Object> result_internal = v8::Utils::OpenHandle(*result); |  | 
| 13830       result_internal->VerifyApiCallResultType(); |  | 
| 13831       // Rebox handle before return. |  | 
| 13832       return handle(*result_internal, isolate); |  | 
| 13833     } |  | 
| 13834   } |  | 
| 13835 | 13729 | 
| 13836   return GetPropertyPostInterceptor(object, receiver, name, attributes); | 13730   v8::NamedPropertyGetterCallback getter = | 
|  | 13731       v8::ToCData<v8::NamedPropertyGetterCallback>(interceptor->getter()); | 
|  | 13732   LOG(isolate, | 
|  | 13733       ApiNamedPropertyAccess("interceptor-named-get", *holder, *name)); | 
|  | 13734   PropertyCallbackArguments | 
|  | 13735       args(isolate, interceptor->data(), *receiver, *holder); | 
|  | 13736   v8::Handle<v8::Value> result = | 
|  | 13737       args.Call(getter, v8::Utils::ToLocal(name_string)); | 
|  | 13738   RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); | 
|  | 13739   if (result.IsEmpty()) return MaybeHandle<Object>(); | 
|  | 13740 | 
|  | 13741   Handle<Object> result_internal = v8::Utils::OpenHandle(*result); | 
|  | 13742   result_internal->VerifyApiCallResultType(); | 
|  | 13743   // Rebox handle before return | 
|  | 13744   return handle(*result_internal, isolate); | 
| 13837 } | 13745 } | 
| 13838 | 13746 | 
| 13839 | 13747 | 
| 13840 // Compute the property keys from the interceptor. | 13748 // Compute the property keys from the interceptor. | 
| 13841 // TODO(rossberg): support symbols in API, and filter here if needed. | 13749 // TODO(rossberg): support symbols in API, and filter here if needed. | 
| 13842 MaybeHandle<JSObject> JSObject::GetKeysForNamedInterceptor( | 13750 MaybeHandle<JSObject> JSObject::GetKeysForNamedInterceptor( | 
| 13843     Handle<JSObject> object, Handle<JSReceiver> receiver) { | 13751     Handle<JSObject> object, Handle<JSReceiver> receiver) { | 
| 13844   Isolate* isolate = receiver->GetIsolate(); | 13752   Isolate* isolate = receiver->GetIsolate(); | 
| 13845   Handle<InterceptorInfo> interceptor(object->GetNamedInterceptor()); | 13753   Handle<InterceptorInfo> interceptor(object->GetNamedInterceptor()); | 
| 13846   PropertyCallbackArguments | 13754   PropertyCallbackArguments | 
| (...skipping 3353 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 17200 #define ERROR_MESSAGES_TEXTS(C, T) T, | 17108 #define ERROR_MESSAGES_TEXTS(C, T) T, | 
| 17201   static const char* error_messages_[] = { | 17109   static const char* error_messages_[] = { | 
| 17202       ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 17110       ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 
| 17203   }; | 17111   }; | 
| 17204 #undef ERROR_MESSAGES_TEXTS | 17112 #undef ERROR_MESSAGES_TEXTS | 
| 17205   return error_messages_[reason]; | 17113   return error_messages_[reason]; | 
| 17206 } | 17114 } | 
| 17207 | 17115 | 
| 17208 | 17116 | 
| 17209 } }  // namespace v8::internal | 17117 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|