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; | |
342 default: | 340 default: |
343 if (object->IsString()) { | 341 if (object->IsString()) { |
344 if (deferred_string_key) SerializeDeferredKey(comma, key); | 342 if (deferred_string_key) SerializeDeferredKey(comma, key); |
345 SerializeString(Handle<String>::cast(object)); | 343 SerializeString(Handle<String>::cast(object)); |
346 return SUCCESS; | 344 return SUCCESS; |
347 } else if (object->IsJSObject()) { | 345 } else if (object->IsJSObject()) { |
| 346 if (object->IsCallable()) return UNCHANGED; |
348 // Go to slow path for global proxy and objects requiring access checks. | 347 // Go to slow path for global proxy and objects requiring access checks. |
349 if (object->IsAccessCheckNeeded() || object->IsJSGlobalProxy()) break; | 348 if (object->IsAccessCheckNeeded() || object->IsJSGlobalProxy()) break; |
350 if (deferred_string_key) SerializeDeferredKey(comma, key); | 349 if (deferred_string_key) SerializeDeferredKey(comma, key); |
351 return SerializeJSObject(Handle<JSObject>::cast(object)); | 350 return SerializeJSObject(Handle<JSObject>::cast(object)); |
352 } | 351 } |
353 } | 352 } |
354 | 353 |
355 return SerializeGeneric(object, key, comma, deferred_string_key); | 354 return SerializeGeneric(object, key, comma, deferred_string_key); |
356 } | 355 } |
357 | 356 |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 } else { | 679 } else { |
681 SerializeString_<uc16, uc16>(object); | 680 SerializeString_<uc16, uc16>(object); |
682 } | 681 } |
683 } | 682 } |
684 } | 683 } |
685 | 684 |
686 } // namespace internal | 685 } // namespace internal |
687 } // namespace v8 | 686 } // namespace v8 |
688 | 687 |
689 #endif // V8_JSON_STRINGIFIER_H_ | 688 #endif // V8_JSON_STRINGIFIER_H_ |
OLD | NEW |