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 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1231 | 1231 |
1232 RUNTIME_FUNCTION(Runtime_ObjectDefineProperty) { | 1232 RUNTIME_FUNCTION(Runtime_ObjectDefineProperty) { |
1233 HandleScope scope(isolate); | 1233 HandleScope scope(isolate); |
1234 DCHECK(args.length() == 3); | 1234 DCHECK(args.length() == 3); |
1235 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); | 1235 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); |
1236 CONVERT_ARG_HANDLE_CHECKED(Object, name, 1); | 1236 CONVERT_ARG_HANDLE_CHECKED(Object, name, 1); |
1237 CONVERT_ARG_HANDLE_CHECKED(Object, attributes, 2); | 1237 CONVERT_ARG_HANDLE_CHECKED(Object, attributes, 2); |
1238 return JSReceiver::DefineProperty(isolate, o, name, attributes); | 1238 return JSReceiver::DefineProperty(isolate, o, name, attributes); |
1239 } | 1239 } |
1240 | 1240 |
| 1241 RUNTIME_FUNCTION(Runtime_CreateDataProperty) { |
| 1242 HandleScope scope(isolate); |
| 1243 DCHECK(args.length() == 3); |
| 1244 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, o, 0); |
| 1245 CONVERT_ARG_HANDLE_CHECKED(Object, key, 1); |
| 1246 CONVERT_ARG_HANDLE_CHECKED(Object, value, 2); |
| 1247 bool success; |
| 1248 LookupIterator it = LookupIterator::PropertyOrElement( |
| 1249 isolate, o, key, &success, LookupIterator::HIDDEN); |
| 1250 if (!success) return isolate->heap()->exception(); |
| 1251 MAYBE_RETURN( |
| 1252 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR), |
| 1253 isolate->heap()->exception()); |
| 1254 return *value; |
| 1255 } |
1241 | 1256 |
1242 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) { | 1257 RUNTIME_FUNCTION(Runtime_ObjectDefineProperties) { |
1243 HandleScope scope(isolate); | 1258 HandleScope scope(isolate); |
1244 DCHECK(args.length() == 2); | 1259 DCHECK(args.length() == 2); |
1245 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); | 1260 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); |
1246 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); | 1261 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); |
1247 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 1262 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
1248 isolate, o, JSReceiver::DefineProperties(isolate, o, properties)); | 1263 isolate, o, JSReceiver::DefineProperties(isolate, o, properties)); |
1249 return *o; | 1264 return *o; |
1250 } | 1265 } |
1251 | 1266 |
1252 } // namespace internal | 1267 } // namespace internal |
1253 } // namespace v8 | 1268 } // namespace v8 |
OLD | NEW |