OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #ifndef V8_JSON_STRINGIFIER_H_ | 5 #ifndef V8_JSON_STRINGIFIER_H_ |
6 #define V8_JSON_STRINGIFIER_H_ | 6 #define V8_JSON_STRINGIFIER_H_ |
7 | 7 |
8 #include "src/conversions.h" | 8 #include "src/conversions.h" |
9 #include "src/lookup.h" | 9 #include "src/lookup.h" |
10 #include "src/messages.h" | 10 #include "src/messages.h" |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 default: | 330 default: |
331 return UNCHANGED; | 331 return UNCHANGED; |
332 } | 332 } |
333 case JS_ARRAY_TYPE: | 333 case JS_ARRAY_TYPE: |
334 if (object->IsAccessCheckNeeded()) break; | 334 if (object->IsAccessCheckNeeded()) break; |
335 if (deferred_string_key) SerializeDeferredKey(comma, key); | 335 if (deferred_string_key) SerializeDeferredKey(comma, key); |
336 return SerializeJSArray(Handle<JSArray>::cast(object)); | 336 return SerializeJSArray(Handle<JSArray>::cast(object)); |
337 case JS_VALUE_TYPE: | 337 case JS_VALUE_TYPE: |
338 if (deferred_string_key) SerializeDeferredKey(comma, key); | 338 if (deferred_string_key) SerializeDeferredKey(comma, key); |
339 return SerializeJSValue(Handle<JSValue>::cast(object)); | 339 return SerializeJSValue(Handle<JSValue>::cast(object)); |
| 340 case JS_FUNCTION_TYPE: |
| 341 return UNCHANGED; |
340 default: | 342 default: |
341 if (object->IsString()) { | 343 if (object->IsString()) { |
342 if (deferred_string_key) SerializeDeferredKey(comma, key); | 344 if (deferred_string_key) SerializeDeferredKey(comma, key); |
343 SerializeString(Handle<String>::cast(object)); | 345 SerializeString(Handle<String>::cast(object)); |
344 return SUCCESS; | 346 return SUCCESS; |
345 } else if (object->IsJSObject()) { | 347 } else if (object->IsJSObject()) { |
346 if (object->IsCallable()) return UNCHANGED; | |
347 // Go to slow path for global proxy and objects requiring access checks. | 348 // Go to slow path for global proxy and objects requiring access checks. |
348 if (object->IsAccessCheckNeeded() || object->IsJSGlobalProxy()) break; | 349 if (object->IsAccessCheckNeeded() || object->IsJSGlobalProxy()) break; |
349 if (deferred_string_key) SerializeDeferredKey(comma, key); | 350 if (deferred_string_key) SerializeDeferredKey(comma, key); |
350 return SerializeJSObject(Handle<JSObject>::cast(object)); | 351 return SerializeJSObject(Handle<JSObject>::cast(object)); |
351 } | 352 } |
352 } | 353 } |
353 | 354 |
354 return SerializeGeneric(object, key, comma, deferred_string_key); | 355 return SerializeGeneric(object, key, comma, deferred_string_key); |
355 } | 356 } |
356 | 357 |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 } else { | 680 } else { |
680 SerializeString_<uc16, uc16>(object); | 681 SerializeString_<uc16, uc16>(object); |
681 } | 682 } |
682 } | 683 } |
683 } | 684 } |
684 | 685 |
685 } // namespace internal | 686 } // namespace internal |
686 } // namespace v8 | 687 } // namespace v8 |
687 | 688 |
688 #endif // V8_JSON_STRINGIFIER_H_ | 689 #endif // V8_JSON_STRINGIFIER_H_ |
OLD | NEW |