OLD | NEW |
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 <sstream> | 9 #include <sstream> |
10 | 10 |
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1063 THROW_NEW_ERROR(isolate, | 1063 THROW_NEW_ERROR(isolate, |
1064 NewTypeError(MessageTemplate::kIncompatibleMethodReceiver, | 1064 NewTypeError(MessageTemplate::kIncompatibleMethodReceiver, |
1065 name, receiver), | 1065 name, receiver), |
1066 Object); | 1066 Object); |
1067 } | 1067 } |
1068 | 1068 |
1069 v8::AccessorNameGetterCallback call_fun = | 1069 v8::AccessorNameGetterCallback call_fun = |
1070 v8::ToCData<v8::AccessorNameGetterCallback>(info->getter()); | 1070 v8::ToCData<v8::AccessorNameGetterCallback>(info->getter()); |
1071 if (call_fun == nullptr) return isolate->factory()->undefined_value(); | 1071 if (call_fun == nullptr) return isolate->factory()->undefined_value(); |
1072 | 1072 |
| 1073 if (info->is_sloppy() && !receiver->IsJSReceiver()) { |
| 1074 ASSIGN_RETURN_ON_EXCEPTION(isolate, receiver, |
| 1075 Object::ConvertReceiver(isolate, receiver), |
| 1076 Object); |
| 1077 } |
| 1078 |
1073 PropertyCallbackArguments args(isolate, info->data(), *receiver, *holder, | 1079 PropertyCallbackArguments args(isolate, info->data(), *receiver, *holder, |
1074 Object::DONT_THROW); | 1080 Object::DONT_THROW); |
1075 Handle<Object> result = args.Call(call_fun, name); | 1081 Handle<Object> result = args.Call(call_fun, name); |
1076 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); | 1082 RETURN_EXCEPTION_IF_SCHEDULED_EXCEPTION(isolate, Object); |
1077 if (result.is_null()) return ReadAbsentProperty(isolate, receiver, name); | 1083 if (result.is_null()) return ReadAbsentProperty(isolate, receiver, name); |
1078 // Rebox handle before return. | 1084 // Rebox handle before return. |
1079 return handle(*result, isolate); | 1085 return handle(*result, isolate); |
1080 } | 1086 } |
1081 | 1087 |
1082 // Regular accessor. | 1088 // Regular accessor. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1147 return Nothing<bool>(); | 1153 return Nothing<bool>(); |
1148 } | 1154 } |
1149 | 1155 |
1150 v8::AccessorNameSetterCallback call_fun = | 1156 v8::AccessorNameSetterCallback call_fun = |
1151 v8::ToCData<v8::AccessorNameSetterCallback>(info->setter()); | 1157 v8::ToCData<v8::AccessorNameSetterCallback>(info->setter()); |
1152 // TODO(verwaest): We should not get here anymore once all AccessorInfos are | 1158 // TODO(verwaest): We should not get here anymore once all AccessorInfos are |
1153 // marked as special_data_property. They cannot both be writable and not | 1159 // marked as special_data_property. They cannot both be writable and not |
1154 // have a setter. | 1160 // have a setter. |
1155 if (call_fun == nullptr) return Just(true); | 1161 if (call_fun == nullptr) return Just(true); |
1156 | 1162 |
| 1163 if (info->is_sloppy() && !receiver->IsJSReceiver()) { |
| 1164 ASSIGN_RETURN_ON_EXCEPTION_VALUE( |
| 1165 isolate, receiver, Object::ConvertReceiver(isolate, receiver), |
| 1166 Nothing<bool>()); |
| 1167 } |
| 1168 |
1157 PropertyCallbackArguments args(isolate, info->data(), *receiver, *holder, | 1169 PropertyCallbackArguments args(isolate, info->data(), *receiver, *holder, |
1158 should_throw); | 1170 should_throw); |
1159 args.Call(call_fun, name, value); | 1171 args.Call(call_fun, name, value); |
1160 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>()); | 1172 RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>()); |
1161 return Just(true); | 1173 return Just(true); |
1162 } | 1174 } |
1163 | 1175 |
1164 // Regular accessor. | 1176 // Regular accessor. |
1165 Handle<Object> setter(AccessorPair::cast(*structure)->setter(), isolate); | 1177 Handle<Object> setter(AccessorPair::cast(*structure)->setter(), isolate); |
1166 if (setter->IsFunctionTemplateInfo()) { | 1178 if (setter->IsFunctionTemplateInfo()) { |
(...skipping 17079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18246 if (cell->value() != *new_value) { | 18258 if (cell->value() != *new_value) { |
18247 cell->set_value(*new_value); | 18259 cell->set_value(*new_value); |
18248 Isolate* isolate = cell->GetIsolate(); | 18260 Isolate* isolate = cell->GetIsolate(); |
18249 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 18261 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
18250 isolate, DependentCode::kPropertyCellChangedGroup); | 18262 isolate, DependentCode::kPropertyCellChangedGroup); |
18251 } | 18263 } |
18252 } | 18264 } |
18253 | 18265 |
18254 } // namespace internal | 18266 } // namespace internal |
18255 } // namespace v8 | 18267 } // namespace v8 |
OLD | NEW |