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" | |
12 #include "src/messages.h" | 11 #include "src/messages.h" |
13 #include "src/property-descriptor.h" | 12 #include "src/property-descriptor.h" |
14 #include "src/runtime/runtime.h" | 13 #include "src/runtime/runtime.h" |
15 | 14 |
16 namespace v8 { | 15 namespace v8 { |
17 namespace internal { | 16 namespace internal { |
18 | 17 |
19 MaybeHandle<Object> Runtime::GetObjectProperty(Isolate* isolate, | 18 MaybeHandle<Object> Runtime::GetObjectProperty(Isolate* isolate, |
20 Handle<Object> object, | 19 Handle<Object> object, |
21 Handle<Object> key) { | 20 Handle<Object> key) { |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 bool success = false; | 218 bool success = false; |
220 LookupIterator it = | 219 LookupIterator it = |
221 LookupIterator::PropertyOrElement(isolate, object, key, &success); | 220 LookupIterator::PropertyOrElement(isolate, object, key, &success); |
222 if (!success) return MaybeHandle<Object>(); | 221 if (!success) return MaybeHandle<Object>(); |
223 | 222 |
224 MAYBE_RETURN_NULL(Object::SetProperty(&it, value, language_mode, | 223 MAYBE_RETURN_NULL(Object::SetProperty(&it, value, language_mode, |
225 Object::MAY_BE_STORE_FROM_KEYED)); | 224 Object::MAY_BE_STORE_FROM_KEYED)); |
226 return value; | 225 return value; |
227 } | 226 } |
228 | 227 |
229 MaybeHandle<Object> Runtime::BasicJsonStringify(Isolate* isolate, | |
230 Handle<Object> object, | |
231 Handle<String> gap) { | |
232 return BasicJsonStringifier(isolate, gap).Stringify(object); | |
233 } | |
234 | |
235 MaybeHandle<Object> Runtime::BasicJsonStringifyString(Isolate* isolate, | |
236 Handle<String> string) { | |
237 return BasicJsonStringifier::StringifyString(isolate, string); | |
238 } | |
239 | 228 |
240 RUNTIME_FUNCTION(Runtime_GetPrototype) { | 229 RUNTIME_FUNCTION(Runtime_GetPrototype) { |
241 HandleScope scope(isolate); | 230 HandleScope scope(isolate); |
242 DCHECK(args.length() == 1); | 231 DCHECK(args.length() == 1); |
243 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, obj, 0); | 232 CONVERT_ARG_HANDLE_CHECKED(JSReceiver, obj, 0); |
244 Handle<Object> prototype; | 233 Handle<Object> prototype; |
245 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, prototype, | 234 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, prototype, |
246 JSReceiver::GetPrototype(isolate, obj)); | 235 JSReceiver::GetPrototype(isolate, obj)); |
247 return *prototype; | 236 return *prototype; |
248 } | 237 } |
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1029 isolate, o, key, &success, LookupIterator::OWN); | 1018 isolate, o, key, &success, LookupIterator::OWN); |
1030 if (!success) return isolate->heap()->exception(); | 1019 if (!success) return isolate->heap()->exception(); |
1031 MAYBE_RETURN( | 1020 MAYBE_RETURN( |
1032 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR), | 1021 JSReceiver::CreateDataProperty(&it, value, Object::THROW_ON_ERROR), |
1033 isolate->heap()->exception()); | 1022 isolate->heap()->exception()); |
1034 return *value; | 1023 return *value; |
1035 } | 1024 } |
1036 | 1025 |
1037 } // namespace internal | 1026 } // namespace internal |
1038 } // namespace v8 | 1027 } // namespace v8 |
OLD | NEW |