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" |
(...skipping 3542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3553 DisallowHeapAllocation no_gc; | 3553 DisallowHeapAllocation no_gc; |
3554 LookupOwnRealNamedProperty(name, result); | 3554 LookupOwnRealNamedProperty(name, result); |
3555 if (result->IsFound()) return; | 3555 if (result->IsFound()) return; |
3556 | 3556 |
3557 LookupRealNamedPropertyInPrototypes(name, result); | 3557 LookupRealNamedPropertyInPrototypes(name, result); |
3558 } | 3558 } |
3559 | 3559 |
3560 | 3560 |
3561 void JSObject::LookupRealNamedPropertyInPrototypes(Handle<Name> name, | 3561 void JSObject::LookupRealNamedPropertyInPrototypes(Handle<Name> name, |
3562 LookupResult* result) { | 3562 LookupResult* result) { |
| 3563 if (name->IsOwn()) { |
| 3564 result->NotFound(); |
| 3565 return; |
| 3566 } |
| 3567 |
3563 DisallowHeapAllocation no_gc; | 3568 DisallowHeapAllocation no_gc; |
3564 Isolate* isolate = GetIsolate(); | 3569 Isolate* isolate = GetIsolate(); |
3565 for (PrototypeIterator iter(isolate, this); !iter.IsAtEnd(); iter.Advance()) { | 3570 for (PrototypeIterator iter(isolate, this); !iter.IsAtEnd(); iter.Advance()) { |
3566 if (iter.GetCurrent()->IsJSProxy()) { | 3571 if (iter.GetCurrent()->IsJSProxy()) { |
3567 return result->HandlerResult(JSProxy::cast(iter.GetCurrent())); | 3572 return result->HandlerResult(JSProxy::cast(iter.GetCurrent())); |
3568 } | 3573 } |
3569 JSObject::cast(iter.GetCurrent())->LookupOwnRealNamedProperty(name, result); | 3574 JSObject::cast(iter.GetCurrent())->LookupOwnRealNamedProperty(name, result); |
3570 DCHECK(!(result->IsFound() && result->type() == INTERCEPTOR)); | 3575 DCHECK(!(result->IsFound() && result->type() == INTERCEPTOR)); |
3571 if (result->IsFound()) return; | 3576 if (result->IsFound()) return; |
3572 } | 3577 } |
(...skipping 2527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6100 JSObject* js_object = JSObject::cast(this); | 6105 JSObject* js_object = JSObject::cast(this); |
6101 | 6106 |
6102 // Check for lookup interceptor except when bootstrapping. | 6107 // Check for lookup interceptor except when bootstrapping. |
6103 if (js_object->HasNamedInterceptor() && | 6108 if (js_object->HasNamedInterceptor() && |
6104 !GetIsolate()->bootstrapper()->IsActive()) { | 6109 !GetIsolate()->bootstrapper()->IsActive()) { |
6105 result->InterceptorResult(js_object); | 6110 result->InterceptorResult(js_object); |
6106 return; | 6111 return; |
6107 } | 6112 } |
6108 | 6113 |
6109 js_object->LookupOwnRealNamedProperty(name, result); | 6114 js_object->LookupOwnRealNamedProperty(name, result); |
6110 if (result->IsFound() || !search_hidden_prototypes) return; | 6115 if (result->IsFound() || name->IsOwn() || !search_hidden_prototypes) return; |
6111 | 6116 |
6112 PrototypeIterator iter(GetIsolate(), js_object); | 6117 PrototypeIterator iter(GetIsolate(), js_object); |
6113 if (!iter.GetCurrent()->IsJSReceiver()) return; | 6118 if (!iter.GetCurrent()->IsJSReceiver()) return; |
6114 JSReceiver* receiver = JSReceiver::cast(iter.GetCurrent()); | 6119 JSReceiver* receiver = JSReceiver::cast(iter.GetCurrent()); |
6115 if (receiver->map()->is_hidden_prototype()) { | 6120 if (receiver->map()->is_hidden_prototype()) { |
6116 receiver->LookupOwn(name, result, search_hidden_prototypes); | 6121 receiver->LookupOwn(name, result, search_hidden_prototypes); |
6117 } | 6122 } |
6118 } | 6123 } |
6119 | 6124 |
6120 | 6125 |
6121 void JSReceiver::Lookup(Handle<Name> name, LookupResult* result) { | 6126 void JSReceiver::Lookup(Handle<Name> name, LookupResult* result) { |
6122 DisallowHeapAllocation no_gc; | 6127 DisallowHeapAllocation no_gc; |
6123 // Ecma-262 3rd 8.6.2.4 | 6128 // Ecma-262 3rd 8.6.2.4 |
6124 for (PrototypeIterator iter(GetIsolate(), this, | 6129 for (PrototypeIterator iter(GetIsolate(), this, |
6125 PrototypeIterator::START_AT_RECEIVER); | 6130 PrototypeIterator::START_AT_RECEIVER); |
6126 !iter.IsAtEnd(); iter.Advance()) { | 6131 !iter.IsAtEnd(); iter.Advance()) { |
6127 JSReceiver::cast(iter.GetCurrent())->LookupOwn(name, result, false); | 6132 JSReceiver::cast(iter.GetCurrent())->LookupOwn(name, result, false); |
6128 if (result->IsFound()) return; | 6133 if (result->IsFound()) return; |
| 6134 if (name->IsOwn()) { |
| 6135 result->NotFound(); |
| 6136 return; |
| 6137 } |
6129 } | 6138 } |
6130 result->NotFound(); | 6139 result->NotFound(); |
6131 } | 6140 } |
6132 | 6141 |
6133 | 6142 |
6134 static bool ContainsOnlyValidKeys(Handle<FixedArray> array) { | 6143 static bool ContainsOnlyValidKeys(Handle<FixedArray> array) { |
6135 int len = array->length(); | 6144 int len = array->length(); |
6136 for (int i = 0; i < len; i++) { | 6145 for (int i = 0; i < len; i++) { |
6137 Object* e = array->get(i); | 6146 Object* e = array->get(i); |
6138 if (!(e->IsString() || e->IsNumber())) return false; | 6147 if (!(e->IsString() || e->IsNumber())) return false; |
(...skipping 10781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16920 #define ERROR_MESSAGES_TEXTS(C, T) T, | 16929 #define ERROR_MESSAGES_TEXTS(C, T) T, |
16921 static const char* error_messages_[] = { | 16930 static const char* error_messages_[] = { |
16922 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) | 16931 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) |
16923 }; | 16932 }; |
16924 #undef ERROR_MESSAGES_TEXTS | 16933 #undef ERROR_MESSAGES_TEXTS |
16925 return error_messages_[reason]; | 16934 return error_messages_[reason]; |
16926 } | 16935 } |
16927 | 16936 |
16928 | 16937 |
16929 } } // namespace v8::internal | 16938 } } // namespace v8::internal |
OLD | NEW |