Chromium Code Reviews| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 175 isolate->heap()->exception()); | 175 isolate->heap()->exception()); |
| 176 return *obj; | 176 return *obj; |
| 177 } | 177 } |
| 178 | 178 |
| 179 | 179 |
| 180 RUNTIME_FUNCTION(Runtime_SetPrototype) { | 180 RUNTIME_FUNCTION(Runtime_SetPrototype) { |
| 181 HandleScope scope(isolate); | 181 HandleScope scope(isolate); |
| 182 DCHECK(args.length() == 2); | 182 DCHECK(args.length() == 2); |
| 183 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, obj, 0); | 183 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, obj, 0); |
| 184 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); | 184 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); |
| 185 MAYBE_RETURN( | 185 |
| 186 JSReceiver::SetPrototype(obj, prototype, true, Object::THROW_ON_ERROR), | 186 Maybe<bool> status = |
| 187 isolate->heap()->exception()); | 187 JSReceiver::SetPrototype(obj, prototype, true, Object::THROW_ON_ERROR); |
| 188 if (status.IsNothing()) return isolate->heap()->exception(); | |
| 189 if (!status.FromJust()) { | |
|
Camillo Bruni
2015/11/16 13:32:08
We should probably throw the error already in JSPr
| |
| 190 THROW_NEW_ERROR_RETURN_FAILURE( | |
| 191 isolate, NewTypeError(MessageTemplate::kObjectSetPrototypeFailed, obj, | |
| 192 prototype)); | |
| 193 } | |
| 188 return *obj; | 194 return *obj; |
| 189 } | 195 } |
| 190 | 196 |
| 191 | 197 |
| 192 // Enumerator used as indices into the array returned from GetOwnProperty | 198 // Enumerator used as indices into the array returned from GetOwnProperty |
| 193 enum PropertyDescriptorIndices { | 199 enum PropertyDescriptorIndices { |
| 194 IS_ACCESSOR_INDEX, | 200 IS_ACCESSOR_INDEX, |
| 195 VALUE_INDEX, | 201 VALUE_INDEX, |
| 196 GETTER_INDEX, | 202 GETTER_INDEX, |
| 197 SETTER_INDEX, | 203 SETTER_INDEX, |
| (...skipping 1370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1568 | 1574 |
| 1569 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) { | 1575 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) { |
| 1570 HandleScope scope(isolate); | 1576 HandleScope scope(isolate); |
| 1571 DCHECK(args.length() == 2); | 1577 DCHECK(args.length() == 2); |
| 1572 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); | 1578 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); |
| 1573 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); | 1579 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); |
| 1574 return JSReceiver::DefineProperties(isolate, o, properties); | 1580 return JSReceiver::DefineProperties(isolate, o, properties); |
| 1575 } | 1581 } |
| 1576 } // namespace internal | 1582 } // namespace internal |
| 1577 } // namespace v8 | 1583 } // namespace v8 |
| OLD | NEW |