| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 CONVERT_ARG_HANDLE_CHECKED(Object, obj, 0); | 159 CONVERT_ARG_HANDLE_CHECKED(Object, obj, 0); |
| 160 return *Object::GetPrototype(isolate, obj); | 160 return *Object::GetPrototype(isolate, obj); |
| 161 } | 161 } |
| 162 | 162 |
| 163 | 163 |
| 164 RUNTIME_FUNCTION(Runtime_InternalSetPrototype) { | 164 RUNTIME_FUNCTION(Runtime_InternalSetPrototype) { |
| 165 HandleScope scope(isolate); | 165 HandleScope scope(isolate); |
| 166 DCHECK(args.length() == 2); | 166 DCHECK(args.length() == 2); |
| 167 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, obj, 0); | 167 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, obj, 0); |
| 168 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); | 168 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); |
| 169 MAYBE_RETURN(JSReceiver::SetPrototype(obj, prototype, false, THROW_ON_ERROR), | 169 MAYBE_RETURN( |
| 170 isolate->heap()->exception()); | 170 JSReceiver::SetPrototype(obj, prototype, false, Object::THROW_ON_ERROR), |
| 171 isolate->heap()->exception()); |
| 171 return *obj; | 172 return *obj; |
| 172 } | 173 } |
| 173 | 174 |
| 174 | 175 |
| 175 RUNTIME_FUNCTION(Runtime_SetPrototype) { | 176 RUNTIME_FUNCTION(Runtime_SetPrototype) { |
| 176 HandleScope scope(isolate); | 177 HandleScope scope(isolate); |
| 177 DCHECK(args.length() == 2); | 178 DCHECK(args.length() == 2); |
| 178 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, obj, 0); | 179 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, obj, 0); |
| 179 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); | 180 CONVERT_ARG_HANDLE_CHECKED(Object, prototype, 1); |
| 180 MAYBE_RETURN(JSReceiver::SetPrototype(obj, prototype, true, THROW_ON_ERROR), | 181 MAYBE_RETURN( |
| 181 isolate->heap()->exception()); | 182 JSReceiver::SetPrototype(obj, prototype, true, Object::THROW_ON_ERROR), |
| 183 isolate->heap()->exception()); |
| 182 return *obj; | 184 return *obj; |
| 183 } | 185 } |
| 184 | 186 |
| 185 | 187 |
| 186 // Enumerator used as indices into the array returned from GetOwnProperty | 188 // Enumerator used as indices into the array returned from GetOwnProperty |
| 187 enum PropertyDescriptorIndices { | 189 enum PropertyDescriptorIndices { |
| 188 IS_ACCESSOR_INDEX, | 190 IS_ACCESSOR_INDEX, |
| 189 VALUE_INDEX, | 191 VALUE_INDEX, |
| 190 GETTER_INDEX, | 192 GETTER_INDEX, |
| 191 SETTER_INDEX, | 193 SETTER_INDEX, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, | 258 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
| 257 GetOwnProperty(isolate, obj, name)); | 259 GetOwnProperty(isolate, obj, name)); |
| 258 return *result; | 260 return *result; |
| 259 } | 261 } |
| 260 | 262 |
| 261 | 263 |
| 262 RUNTIME_FUNCTION(Runtime_PreventExtensions) { | 264 RUNTIME_FUNCTION(Runtime_PreventExtensions) { |
| 263 HandleScope scope(isolate); | 265 HandleScope scope(isolate); |
| 264 DCHECK(args.length() == 1); | 266 DCHECK(args.length() == 1); |
| 265 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, obj, 0); | 267 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, obj, 0); |
| 266 if (JSReceiver::PreventExtensions(obj, THROW_ON_ERROR).IsNothing()) | 268 if (JSReceiver::PreventExtensions(obj, Object::THROW_ON_ERROR).IsNothing()) |
| 267 return isolate->heap()->exception(); | 269 return isolate->heap()->exception(); |
| 268 return *obj; | 270 return *obj; |
| 269 } | 271 } |
| 270 | 272 |
| 271 | 273 |
| 272 RUNTIME_FUNCTION(Runtime_IsExtensible) { | 274 RUNTIME_FUNCTION(Runtime_IsExtensible) { |
| 273 HandleScope scope(isolate); | 275 HandleScope scope(isolate); |
| 274 DCHECK(args.length() == 1); | 276 DCHECK(args.length() == 1); |
| 275 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); | 277 CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0); |
| 276 return isolate->heap()->ToBoolean(JSObject::IsExtensible(obj)); | 278 return isolate->heap()->ToBoolean(JSObject::IsExtensible(obj)); |
| (...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 result = isolate->factory()->NewJSObjectWithMemento(function, site); | 1020 result = isolate->factory()->NewJSObjectWithMemento(function, site); |
| 1019 } | 1021 } |
| 1020 | 1022 |
| 1021 // Set up the prototoype using original function. | 1023 // Set up the prototoype using original function. |
| 1022 // TODO(dslomov): instead of setting the __proto__, | 1024 // TODO(dslomov): instead of setting the __proto__, |
| 1023 // use and cache the correct map. | 1025 // use and cache the correct map. |
| 1024 if (*original_function != *function) { | 1026 if (*original_function != *function) { |
| 1025 if (original_function->has_instance_prototype()) { | 1027 if (original_function->has_instance_prototype()) { |
| 1026 Handle<Object> prototype = | 1028 Handle<Object> prototype = |
| 1027 handle(original_function->instance_prototype(), isolate); | 1029 handle(original_function->instance_prototype(), isolate); |
| 1028 MAYBE_RETURN( | 1030 MAYBE_RETURN(JSObject::SetPrototype(result, prototype, false, |
| 1029 JSObject::SetPrototype(result, prototype, false, THROW_ON_ERROR), | 1031 Object::THROW_ON_ERROR), |
| 1030 isolate->heap()->exception()); | 1032 isolate->heap()->exception()); |
| 1031 } | 1033 } |
| 1032 } | 1034 } |
| 1033 | 1035 |
| 1034 isolate->counters()->constructed_objects()->Increment(); | 1036 isolate->counters()->constructed_objects()->Increment(); |
| 1035 isolate->counters()->constructed_objects_runtime()->Increment(); | 1037 isolate->counters()->constructed_objects_runtime()->Increment(); |
| 1036 | 1038 |
| 1037 return *result; | 1039 return *result; |
| 1038 } | 1040 } |
| 1039 | 1041 |
| 1040 | 1042 |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1572 | 1574 |
| 1573 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) { | 1575 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) { |
| 1574 HandleScope scope(isolate); | 1576 HandleScope scope(isolate); |
| 1575 DCHECK(args.length() == 2); | 1577 DCHECK(args.length() == 2); |
| 1576 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); | 1578 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); |
| 1577 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); | 1579 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); |
| 1578 return JSReceiver::DefineProperties(isolate, o, properties); | 1580 return JSReceiver::DefineProperties(isolate, o, properties); |
| 1579 } | 1581 } |
| 1580 } // namespace internal | 1582 } // namespace internal |
| 1581 } // namespace v8 | 1583 } // namespace v8 |
| OLD | NEW |