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

Side by Side Diff: src/objects.cc

Issue 2311413002: Super property loads and stores should throw if [[Prototype]] is null (Closed)
Patch Set: Created 4 years, 3 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/objects.h ('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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 <memory> 9 #include <memory>
10 #include <sstream> 10 #include <sstream>
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 JSObject::GetPropertyWithInterceptor(it, &done), Object); 988 JSObject::GetPropertyWithInterceptor(it, &done), Object);
989 if (done) return result; 989 if (done) return result;
990 break; 990 break;
991 } 991 }
992 case LookupIterator::ACCESS_CHECK: 992 case LookupIterator::ACCESS_CHECK:
993 if (it->HasAccess()) break; 993 if (it->HasAccess()) break;
994 return JSObject::GetPropertyWithFailedAccessCheck(it); 994 return JSObject::GetPropertyWithFailedAccessCheck(it);
995 case LookupIterator::ACCESSOR: 995 case LookupIterator::ACCESSOR:
996 return GetPropertyWithAccessor(it); 996 return GetPropertyWithAccessor(it);
997 case LookupIterator::INTEGER_INDEXED_EXOTIC: 997 case LookupIterator::INTEGER_INDEXED_EXOTIC:
998 return ReadAbsentProperty(it); 998 return it->isolate()->factory()->undefined_value();
999 case LookupIterator::DATA: 999 case LookupIterator::DATA:
1000 return it->GetDataValue(); 1000 return it->GetDataValue();
1001 } 1001 }
1002 } 1002 }
1003 return ReadAbsentProperty(it); 1003 return it->isolate()->factory()->undefined_value();
1004 } 1004 }
1005 1005
1006 1006
1007 // static 1007 // static
1008 MaybeHandle<Object> JSProxy::GetProperty(Isolate* isolate, 1008 MaybeHandle<Object> JSProxy::GetProperty(Isolate* isolate,
1009 Handle<JSProxy> proxy, 1009 Handle<JSProxy> proxy,
1010 Handle<Name> name, 1010 Handle<Name> name,
1011 Handle<Object> receiver, 1011 Handle<Object> receiver,
1012 bool* was_found) { 1012 bool* was_found) {
1013 *was_found = true; 1013 *was_found = true;
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
1342 if (info->is_sloppy() && !receiver->IsJSReceiver()) { 1342 if (info->is_sloppy() && !receiver->IsJSReceiver()) {
1343 ASSIGN_RETURN_ON_EXCEPTION(isolate, receiver, 1343 ASSIGN_RETURN_ON_EXCEPTION(isolate, receiver,
1344 Object::ConvertReceiver(isolate, receiver), 1344 Object::ConvertReceiver(isolate, receiver),
1345 Object); 1345 Object);
1346 } 1346 }
1347 1347
1348 PropertyCallbackArguments args(isolate, info->data(), *receiver, *holder, 1348 PropertyCallbackArguments args(isolate, info->data(), *receiver, *holder,
1349 Object::DONT_THROW); 1349 Object::DONT_THROW);
1350 Handle<Object> result = args.Call(call_fun, name); 1350 Handle<Object> result = args.Call(call_fun, name);
1351 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); 1351 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object);
1352 if (result.is_null()) return ReadAbsentProperty(isolate, receiver, name); 1352 if (result.is_null()) return isolate->factory()->undefined_value();
1353 // Rebox handle before return. 1353 // Rebox handle before return.
1354 return handle(*result, isolate); 1354 return handle(*result, isolate);
1355 } 1355 }
1356 1356
1357 // Regular accessor. 1357 // Regular accessor.
1358 Handle<Object> getter(AccessorPair::cast(*structure)->getter(), isolate); 1358 Handle<Object> getter(AccessorPair::cast(*structure)->getter(), isolate);
1359 if (getter->IsFunctionTemplateInfo()) { 1359 if (getter->IsFunctionTemplateInfo()) {
1360 return Builtins::InvokeApiFunction( 1360 return Builtins::InvokeApiFunction(
1361 isolate, false, Handle<FunctionTemplateInfo>::cast(getter), receiver, 0, 1361 isolate, false, Handle<FunctionTemplateInfo>::cast(getter), receiver, 0,
1362 nullptr, isolate->factory()->undefined_value()); 1362 nullptr, isolate->factory()->undefined_value());
1363 } else if (getter->IsCallable()) { 1363 } else if (getter->IsCallable()) {
1364 // TODO(rossberg): nicer would be to cast to some JSCallable here... 1364 // TODO(rossberg): nicer would be to cast to some JSCallable here...
1365 return Object::GetPropertyWithDefinedGetter( 1365 return Object::GetPropertyWithDefinedGetter(
1366 receiver, Handle<JSReceiver>::cast(getter)); 1366 receiver, Handle<JSReceiver>::cast(getter));
1367 } 1367 }
1368 // Getter is not a function. 1368 // Getter is not a function.
1369 return ReadAbsentProperty(isolate, receiver, it->GetName()); 1369 return isolate->factory()->undefined_value();
1370 } 1370 }
1371 1371
1372 // static 1372 // static
1373 Address AccessorInfo::redirect(Isolate* isolate, Address address, 1373 Address AccessorInfo::redirect(Isolate* isolate, Address address,
1374 AccessorComponent component) { 1374 AccessorComponent component) {
1375 ApiFunction fun(address); 1375 ApiFunction fun(address);
1376 DCHECK_EQ(ACCESSOR_GETTER, component); 1376 DCHECK_EQ(ACCESSOR_GETTER, component);
1377 ExternalReference::Type type = ExternalReference::DIRECT_GETTER_CALL; 1377 ExternalReference::Type type = ExternalReference::DIRECT_GETTER_CALL;
1378 return ExternalReference(&fun, type, isolate).address(); 1378 return ExternalReference(&fun, type, isolate).address();
1379 } 1379 }
(...skipping 3432 matching lines...) Expand 10 before | Expand all | Expand 10 after
4812 4812
4813 case LookupIterator::NOT_FOUND: 4813 case LookupIterator::NOT_FOUND:
4814 case LookupIterator::TRANSITION: 4814 case LookupIterator::TRANSITION:
4815 UNREACHABLE(); 4815 UNREACHABLE();
4816 } 4816 }
4817 } 4817 }
4818 4818
4819 return AddDataProperty(&own_lookup, value, NONE, should_throw, store_mode); 4819 return AddDataProperty(&own_lookup, value, NONE, should_throw, store_mode);
4820 } 4820 }
4821 4821
4822 MaybeHandle<Object> Object::ReadAbsentProperty(LookupIterator* it) {
4823 return it->isolate()->factory()->undefined_value();
4824 }
4825
4826 MaybeHandle<Object> Object::ReadAbsentProperty(Isolate* isolate,
4827 Handle<Object> receiver,
4828 Handle<Object> name) {
4829 return isolate->factory()->undefined_value();
4830 }
4831
4832
4833 Maybe<bool> Object::CannotCreateProperty(Isolate* isolate, 4822 Maybe<bool> Object::CannotCreateProperty(Isolate* isolate,
4834 Handle<Object> receiver, 4823 Handle<Object> receiver,
4835 Handle<Object> name, 4824 Handle<Object> name,
4836 Handle<Object> value, 4825 Handle<Object> value,
4837 ShouldThrow should_throw) { 4826 ShouldThrow should_throw) {
4838 RETURN_FAILURE( 4827 RETURN_FAILURE(
4839 isolate, should_throw, 4828 isolate, should_throw,
4840 NewTypeError(MessageTemplate::kStrictCannotCreateProperty, name, 4829 NewTypeError(MessageTemplate::kStrictCannotCreateProperty, name,
4841 Object::TypeOf(isolate, receiver), receiver)); 4830 Object::TypeOf(isolate, receiver), receiver));
4842 } 4831 }
(...skipping 14574 matching lines...) Expand 10 before | Expand all | Expand 10 after
19417 for (PrototypeIterator iter(isolate, this, kStartAtReceiver, 19406 for (PrototypeIterator iter(isolate, this, kStartAtReceiver,
19418 PrototypeIterator::END_AT_NULL); 19407 PrototypeIterator::END_AT_NULL);
19419 !iter.IsAtEnd(); iter.AdvanceIgnoringProxies()) { 19408 !iter.IsAtEnd(); iter.AdvanceIgnoringProxies()) {
19420 if (iter.GetCurrent<Object>()->IsJSProxy()) return true; 19409 if (iter.GetCurrent<Object>()->IsJSProxy()) return true;
19421 } 19410 }
19422 return false; 19411 return false;
19423 } 19412 }
19424 19413
19425 } // namespace internal 19414 } // namespace internal
19426 } // namespace v8 19415 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/runtime/runtime-classes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698