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