Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(901)

Side by Side Diff: src/objects.cc

Issue 500203002: Version 3.27.34.15 (merged r23129) (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.27
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/version.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 6891 matching lines...) Expand 10 before | Expand all | Expand 10 after
6902 6902
6903 MaybeHandle<Object> JSObject::GetAccessor(Handle<JSObject> object, 6903 MaybeHandle<Object> JSObject::GetAccessor(Handle<JSObject> object,
6904 Handle<Name> name, 6904 Handle<Name> name,
6905 AccessorComponent component) { 6905 AccessorComponent component) {
6906 Isolate* isolate = object->GetIsolate(); 6906 Isolate* isolate = object->GetIsolate();
6907 6907
6908 // Make sure that the top context does not change when doing callbacks or 6908 // Make sure that the top context does not change when doing callbacks or
6909 // interceptor calls. 6909 // interceptor calls.
6910 AssertNoContextChange ncc(isolate); 6910 AssertNoContextChange ncc(isolate);
6911 6911
6912 // Check access rights if needed.
6913 if (object->IsAccessCheckNeeded() &&
6914 !isolate->MayNamedAccess(object, name, v8::ACCESS_HAS)) {
6915 isolate->ReportFailedAccessCheck(object, v8::ACCESS_HAS);
6916 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
6917 return isolate->factory()->undefined_value();
6918 }
6919
6920 // Make the lookup and include prototypes. 6912 // Make the lookup and include prototypes.
6921 uint32_t index = 0; 6913 uint32_t index = 0;
6922 if (name->AsArrayIndex(&index)) { 6914 if (name->AsArrayIndex(&index)) {
6923 for (Handle<Object> obj = object; 6915 for (Handle<Object> obj = object;
6924 !obj->IsNull(); 6916 !obj->IsNull();
6925 obj = handle(JSReceiver::cast(*obj)->GetPrototype(), isolate)) { 6917 obj = handle(JSReceiver::cast(*obj)->GetPrototype(), isolate)) {
6918 if (obj->IsAccessCheckNeeded() &&
6919 !isolate->MayNamedAccess(Handle<JSObject>::cast(obj), name,
6920 v8::ACCESS_HAS)) {
6921 isolate->ReportFailedAccessCheck(Handle<JSObject>::cast(obj),
6922 v8::ACCESS_HAS);
6923 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
6924 return isolate->factory()->undefined_value();
6925 }
6926
6926 if (obj->IsJSObject() && JSObject::cast(*obj)->HasDictionaryElements()) { 6927 if (obj->IsJSObject() && JSObject::cast(*obj)->HasDictionaryElements()) {
6927 JSObject* js_object = JSObject::cast(*obj); 6928 JSObject* js_object = JSObject::cast(*obj);
6928 SeededNumberDictionary* dictionary = js_object->element_dictionary(); 6929 SeededNumberDictionary* dictionary = js_object->element_dictionary();
6929 int entry = dictionary->FindEntry(index); 6930 int entry = dictionary->FindEntry(index);
6930 if (entry != SeededNumberDictionary::kNotFound) { 6931 if (entry != SeededNumberDictionary::kNotFound) {
6931 Object* element = dictionary->ValueAt(entry); 6932 Object* element = dictionary->ValueAt(entry);
6932 if (dictionary->DetailsAt(entry).type() == CALLBACKS && 6933 if (dictionary->DetailsAt(entry).type() == CALLBACKS &&
6933 element->IsAccessorPair()) { 6934 element->IsAccessorPair()) {
6934 return handle(AccessorPair::cast(element)->GetComponent(component), 6935 return handle(AccessorPair::cast(element)->GetComponent(component),
6935 isolate); 6936 isolate);
6936 } 6937 }
6937 } 6938 }
6938 } 6939 }
6939 } 6940 }
6940 } else { 6941 } else {
6941 for (Handle<Object> obj = object; 6942 for (Handle<Object> obj = object;
6942 !obj->IsNull(); 6943 !obj->IsNull();
6943 obj = handle(JSReceiver::cast(*obj)->GetPrototype(), isolate)) { 6944 obj = handle(JSReceiver::cast(*obj)->GetPrototype(), isolate)) {
6945 if (obj->IsAccessCheckNeeded() &&
6946 !isolate->MayNamedAccess(Handle<JSObject>::cast(obj), name,
6947 v8::ACCESS_HAS)) {
6948 isolate->ReportFailedAccessCheck(Handle<JSObject>::cast(obj),
6949 v8::ACCESS_HAS);
6950 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
6951 return isolate->factory()->undefined_value();
6952 }
6944 LookupResult result(isolate); 6953 LookupResult result(isolate);
6945 JSReceiver::cast(*obj)->LookupOwn(name, &result); 6954 JSReceiver::cast(*obj)->LookupOwn(name, &result);
6946 if (result.IsFound()) { 6955 if (result.IsFound()) {
6947 if (result.IsReadOnly()) return isolate->factory()->undefined_value(); 6956 if (result.IsReadOnly()) return isolate->factory()->undefined_value();
6948 if (result.IsPropertyCallbacks()) { 6957 if (result.IsPropertyCallbacks()) {
6949 Object* obj = result.GetCallbackObject(); 6958 Object* obj = result.GetCallbackObject();
6950 if (obj->IsAccessorPair()) { 6959 if (obj->IsAccessorPair()) {
6951 return handle(AccessorPair::cast(obj)->GetComponent(component), 6960 return handle(AccessorPair::cast(obj)->GetComponent(component),
6952 isolate); 6961 isolate);
6953 } 6962 }
(...skipping 10046 matching lines...) Expand 10 before | Expand all | Expand 10 after
17000 #define ERROR_MESSAGES_TEXTS(C, T) T, 17009 #define ERROR_MESSAGES_TEXTS(C, T) T,
17001 static const char* error_messages_[] = { 17010 static const char* error_messages_[] = {
17002 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS) 17011 ERROR_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)
17003 }; 17012 };
17004 #undef ERROR_MESSAGES_TEXTS 17013 #undef ERROR_MESSAGES_TEXTS
17005 return error_messages_[reason]; 17014 return error_messages_[reason];
17006 } 17015 }
17007 17016
17008 17017
17009 } } // namespace v8::internal 17018 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698