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

Side by Side Diff: src/objects.cc

Issue 1398093002: Pass the context from which a given receiver is accessed explicitly (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « src/lookup.cc ('k') | src/runtime/runtime-classes.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/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 5983 matching lines...) Expand 10 before | Expand all | Expand 10 after
5994 5994
5995 Maybe<bool> JSObject::PreventExtensionsInternal(Handle<JSObject> object) { 5995 Maybe<bool> JSObject::PreventExtensionsInternal(Handle<JSObject> object) {
5996 Isolate* isolate = object->GetIsolate(); 5996 Isolate* isolate = object->GetIsolate();
5997 5997
5998 if (!object->map()->is_extensible()) return Just(true); 5998 if (!object->map()->is_extensible()) return Just(true);
5999 5999
6000 if (!object->HasSloppyArgumentsElements() && !object->map()->is_observed()) { 6000 if (!object->HasSloppyArgumentsElements() && !object->map()->is_observed()) {
6001 return PreventExtensionsWithTransition<NONE>(object); 6001 return PreventExtensionsWithTransition<NONE>(object);
6002 } 6002 }
6003 6003
6004 if (object->IsAccessCheckNeeded() && !isolate->MayAccess(object)) { 6004 if (object->IsAccessCheckNeeded() &&
6005 !isolate->MayAccess(handle(isolate->context()), object)) {
6005 isolate->ReportFailedAccessCheck(object); 6006 isolate->ReportFailedAccessCheck(object);
6006 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>()); 6007 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>());
6007 UNREACHABLE(); 6008 UNREACHABLE();
6008 return Just(false); 6009 return Just(false);
6009 } 6010 }
6010 6011
6011 if (object->IsJSGlobalProxy()) { 6012 if (object->IsJSGlobalProxy()) {
6012 PrototypeIterator iter(isolate, object); 6013 PrototypeIterator iter(isolate, object);
6013 if (iter.IsAtEnd()) return Just(true); 6014 if (iter.IsAtEnd()) return Just(true);
6014 DCHECK(PrototypeIterator::GetCurrent(iter)->IsJSGlobalObject()); 6015 DCHECK(PrototypeIterator::GetCurrent(iter)->IsJSGlobalObject());
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
6060 6061
6061 6062
6062 MaybeHandle<Object> JSObject::PreventExtensions(Handle<JSObject> object) { 6063 MaybeHandle<Object> JSObject::PreventExtensions(Handle<JSObject> object) {
6063 return ReturnObjectOrThrowTypeError(object, PreventExtensionsInternal(object), 6064 return ReturnObjectOrThrowTypeError(object, PreventExtensionsInternal(object),
6064 MessageTemplate::kCannotPreventExt); 6065 MessageTemplate::kCannotPreventExt);
6065 } 6066 }
6066 6067
6067 6068
6068 bool JSObject::IsExtensible(Handle<JSObject> object) { 6069 bool JSObject::IsExtensible(Handle<JSObject> object) {
6069 Isolate* isolate = object->GetIsolate(); 6070 Isolate* isolate = object->GetIsolate();
6070 if (object->IsAccessCheckNeeded() && !isolate->MayAccess(object)) { 6071 if (object->IsAccessCheckNeeded() &&
6072 !isolate->MayAccess(handle(isolate->context()), object)) {
6071 return true; 6073 return true;
6072 } 6074 }
6073 if (object->IsJSGlobalProxy()) { 6075 if (object->IsJSGlobalProxy()) {
6074 PrototypeIterator iter(isolate, *object); 6076 PrototypeIterator iter(isolate, *object);
6075 if (iter.IsAtEnd()) return false; 6077 if (iter.IsAtEnd()) return false;
6076 DCHECK(iter.GetCurrent()->IsJSGlobalObject()); 6078 DCHECK(iter.GetCurrent()->IsJSGlobalObject());
6077 return iter.GetCurrent<JSObject>()->map()->is_extensible(); 6079 return iter.GetCurrent<JSObject>()->map()->is_extensible();
6078 } 6080 }
6079 return object->map()->is_extensible(); 6081 return object->map()->is_extensible();
6080 } 6082 }
(...skipping 25 matching lines...) Expand all
6106 6108
6107 template <PropertyAttributes attrs> 6109 template <PropertyAttributes attrs>
6108 Maybe<bool> JSObject::PreventExtensionsWithTransition(Handle<JSObject> object) { 6110 Maybe<bool> JSObject::PreventExtensionsWithTransition(Handle<JSObject> object) {
6109 STATIC_ASSERT(attrs == NONE || attrs == SEALED || attrs == FROZEN); 6111 STATIC_ASSERT(attrs == NONE || attrs == SEALED || attrs == FROZEN);
6110 6112
6111 // Sealing/freezing sloppy arguments should be handled elsewhere. 6113 // Sealing/freezing sloppy arguments should be handled elsewhere.
6112 DCHECK(!object->HasSloppyArgumentsElements()); 6114 DCHECK(!object->HasSloppyArgumentsElements());
6113 DCHECK(!object->map()->is_observed()); 6115 DCHECK(!object->map()->is_observed());
6114 6116
6115 Isolate* isolate = object->GetIsolate(); 6117 Isolate* isolate = object->GetIsolate();
6116 if (object->IsAccessCheckNeeded() && !isolate->MayAccess(object)) { 6118 if (object->IsAccessCheckNeeded() &&
6119 !isolate->MayAccess(handle(isolate->context()), object)) {
6117 isolate->ReportFailedAccessCheck(object); 6120 isolate->ReportFailedAccessCheck(object);
6118 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>()); 6121 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>());
6119 UNREACHABLE(); 6122 UNREACHABLE();
6120 } 6123 }
6121 6124
6122 if (object->IsJSGlobalProxy()) { 6125 if (object->IsJSGlobalProxy()) {
6123 PrototypeIterator iter(isolate, object); 6126 PrototypeIterator iter(isolate, object);
6124 if (iter.IsAtEnd()) return Just(true); 6127 if (iter.IsAtEnd()) return Just(true);
6125 DCHECK(PrototypeIterator::GetCurrent(iter)->IsJSGlobalObject()); 6128 DCHECK(PrototypeIterator::GetCurrent(iter)->IsJSGlobalObject());
6126 return PreventExtensionsWithTransition<attrs>( 6129 return PreventExtensionsWithTransition<attrs>(
(...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after
6914 arraysize(args), 6917 arraysize(args),
6915 args), 6918 args),
6916 FixedArray); 6919 FixedArray);
6917 accumulator.AddKeys(Handle<JSObject>::cast(names), filter); 6920 accumulator.AddKeys(Handle<JSObject>::cast(names), filter);
6918 break; 6921 break;
6919 } 6922 }
6920 6923
6921 Handle<JSObject> current = PrototypeIterator::GetCurrent<JSObject>(iter); 6924 Handle<JSObject> current = PrototypeIterator::GetCurrent<JSObject>(iter);
6922 6925
6923 // Check access rights if required. 6926 // Check access rights if required.
6924 if (current->IsAccessCheckNeeded() && !isolate->MayAccess(current)) { 6927 if (current->IsAccessCheckNeeded() &&
6928 !isolate->MayAccess(handle(isolate->context()), current)) {
6925 if (iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)) { 6929 if (iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)) {
6926 isolate->ReportFailedAccessCheck(current); 6930 isolate->ReportFailedAccessCheck(current);
6927 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, FixedArray); 6931 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, FixedArray);
6928 } 6932 }
6929 break; 6933 break;
6930 } 6934 }
6931 6935
6932 // Compute the element keys. 6936 // Compute the element keys.
6933 Handle<FixedArray> element_keys = 6937 Handle<FixedArray> element_keys =
6934 isolate->factory()->NewFixedArray(current->NumberOfEnumElements()); 6938 isolate->factory()->NewFixedArray(current->NumberOfEnumElements());
(...skipping 9986 matching lines...) Expand 10 before | Expand all | Expand 10 after
16921 if (cell->value() != *new_value) { 16925 if (cell->value() != *new_value) {
16922 cell->set_value(*new_value); 16926 cell->set_value(*new_value);
16923 Isolate* isolate = cell->GetIsolate(); 16927 Isolate* isolate = cell->GetIsolate();
16924 cell->dependent_code()->DeoptimizeDependentCodeGroup( 16928 cell->dependent_code()->DeoptimizeDependentCodeGroup(
16925 isolate, DependentCode::kPropertyCellChangedGroup); 16929 isolate, DependentCode::kPropertyCellChangedGroup);
16926 } 16930 }
16927 } 16931 }
16928 16932
16929 } // namespace internal 16933 } // namespace internal
16930 } // namespace v8 16934 } // namespace v8
OLDNEW
« no previous file with comments | « src/lookup.cc ('k') | src/runtime/runtime-classes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698