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