OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
10 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 isolate->heap()->exception()); | 176 isolate->heap()->exception()); |
177 return *obj; | 177 return *obj; |
178 } | 178 } |
179 | 179 |
180 | 180 |
181 RUNTIME_FUNCTION(Runtime_SetPrototype) { | 181 RUNTIME_FUNCTION(Runtime_SetPrototype) { |
182 HandleScope scope(isolate); | 182 HandleScope scope(isolate); |
183 DCHECK(args.length() == 2); | 183 DCHECK(args.length() == 2); |
184 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, obj, 0); | 184 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, obj, 0); |
185 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); | 185 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); |
186 Maybe<bool> status = | 186 MAYBE_RETURN( |
187 JSReceiver::SetPrototype(obj, prototype, true, Object::THROW_ON_ERROR); | 187 JSReceiver::SetPrototype(obj, prototype, true, Object::THROW_ON_ERROR), |
188 if (status.IsNothing()) return isolate->heap()->exception(); | 188 isolate->heap()->exception()); |
189 if (!status.FromJust()) { | |
190 THROW_NEW_ERROR_RETURN_FAILURE( | |
191 isolate, | |
192 NewTypeError(MessageTemplate::kProxySetPrototypeFailed, prototype)); | |
193 } | |
194 return *obj; | 189 return *obj; |
195 } | 190 } |
196 | 191 |
197 | 192 |
198 // Enumerator used as indices into the array returned from GetOwnProperty | 193 // Enumerator used as indices into the array returned from GetOwnProperty |
199 enum PropertyDescriptorIndices { | 194 enum PropertyDescriptorIndices { |
200 IS_ACCESSOR_INDEX, | 195 IS_ACCESSOR_INDEX, |
201 VALUE_INDEX, | 196 VALUE_INDEX, |
202 GETTER_INDEX, | 197 GETTER_INDEX, |
203 SETTER_INDEX, | 198 SETTER_INDEX, |
(...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1434 | 1429 |
1435 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) { | 1430 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) { |
1436 HandleScope scope(isolate); | 1431 HandleScope scope(isolate); |
1437 DCHECK(args.length() == 2); | 1432 DCHECK(args.length() == 2); |
1438 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); | 1433 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); |
1439 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); | 1434 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); |
1440 return JSReceiver::DefineProperties(isolate, o, properties); | 1435 return JSReceiver::DefineProperties(isolate, o, properties); |
1441 } | 1436 } |
1442 } // namespace internal | 1437 } // namespace internal |
1443 } // namespace v8 | 1438 } // namespace v8 |
OLD | NEW |