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" |
| 11 #include "src/json-stringifier.h" |
11 #include "src/messages.h" | 12 #include "src/messages.h" |
12 #include "src/property-descriptor.h" | 13 #include "src/property-descriptor.h" |
13 #include "src/runtime/runtime.h" | 14 #include "src/runtime/runtime.h" |
14 | 15 |
15 namespace v8 { | 16 namespace v8 { |
16 namespace internal { | 17 namespace internal { |
17 | 18 |
18 MaybeHandle<Object> Runtime::GetObjectProperty(Isolate* isolate, | 19 MaybeHandle<Object> Runtime::GetObjectProperty(Isolate* isolate, |
19 Handle<Object> object, | 20 Handle<Object> object, |
20 Handle<Object> key) { | 21 Handle<Object> key) { |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 bool success = false; | 219 bool success = false; |
219 LookupIterator it = | 220 LookupIterator it = |
220 LookupIterator::PropertyOrElement(isolate, object, key, &success); | 221 LookupIterator::PropertyOrElement(isolate, object, key, &success); |
221 if (!success) return MaybeHandle<Object>(); | 222 if (!success) return MaybeHandle<Object>(); |
222 | 223 |
223 MAYBE_RETURN_NULL(Object::SetProperty(&it, value, language_mode, | 224 MAYBE_RETURN_NULL(Object::SetProperty(&it, value, language_mode, |
224 Object::MAY_BE_STORE_FROM_KEYED)); | 225 Object::MAY_BE_STORE_FROM_KEYED)); |
225 return value; | 226 return value; |
226 } | 227 } |
227 | 228 |
| 229 MaybeHandle<Object> Runtime::BasicJsonStringify(Isolate* isolate, |
| 230 Handle<Object> object) { |
| 231 return BasicJsonStringifier(isolate).Stringify(object); |
| 232 } |
| 233 |
| 234 MaybeHandle<Object> Runtime::BasicJsonStringifyString(Isolate* isolate, |
| 235 Handle<String> string) { |
| 236 return BasicJsonStringifier::StringifyString(isolate, string); |
| 237 } |
228 | 238 |
229 RUNTIME_FUNCTION(Runtime_GetPrototype) { | 239 RUNTIME_FUNCTION(Runtime_GetPrototype) { |
230 HandleScope scope(isolate); | 240 HandleScope scope(isolate); |
231 DCHECK(args.length() == 1); | 241 DCHECK(args.length() == 1); |
232 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, obj, 0); | 242 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, obj, 0); |
233 Handle<Object> prototype; | 243 Handle<Object> prototype; |
234 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, prototype, | 244 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, prototype, |
235 JSReceiver::GetPrototype(isolate, obj)); | 245 JSReceiver::GetPrototype(isolate, obj)); |
236 return *prototype; | 246 return *prototype; |
237 } | 247 } |
(...skipping 1021 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1259 DCHECK(args.length() == 2); | 1269 DCHECK(args.length() == 2); |
1260 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); | 1270 CONVERT_ARG_HANDLE_CHECKED(Object, o, 0); |
1261 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); | 1271 CONVERT_ARG_HANDLE_CHECKED(Object, properties, 1); |
1262 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 1272 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
1263 isolate, o, JSReceiver::DefineProperties(isolate, o, properties)); | 1273 isolate, o, JSReceiver::DefineProperties(isolate, o, properties)); |
1264 return *o; | 1274 return *o; |
1265 } | 1275 } |
1266 | 1276 |
1267 } // namespace internal | 1277 } // namespace internal |
1268 } // namespace v8 | 1278 } // namespace v8 |
OLD | NEW |