| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 9628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9639 | 9639 |
| 9640 RUNTIME_FUNCTION(MaybeObject*, Runtime_GlobalReceiver) { | 9640 RUNTIME_FUNCTION(MaybeObject*, Runtime_GlobalReceiver) { |
| 9641 SealHandleScope shs(isolate); | 9641 SealHandleScope shs(isolate); |
| 9642 ASSERT(args.length() == 1); | 9642 ASSERT(args.length() == 1); |
| 9643 Object* global = args[0]; | 9643 Object* global = args[0]; |
| 9644 if (!global->IsJSGlobalObject()) return isolate->heap()->null_value(); | 9644 if (!global->IsJSGlobalObject()) return isolate->heap()->null_value(); |
| 9645 return JSGlobalObject::cast(global)->global_receiver(); | 9645 return JSGlobalObject::cast(global)->global_receiver(); |
| 9646 } | 9646 } |
| 9647 | 9647 |
| 9648 | 9648 |
| 9649 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsAttachedGlobal) { |
| 9650 SealHandleScope shs(isolate); |
| 9651 ASSERT(args.length() == 1); |
| 9652 Object* global = args[0]; |
| 9653 if (!global->IsJSGlobalObject()) return isolate->heap()->false_value(); |
| 9654 return isolate->heap()->ToBoolean( |
| 9655 !JSGlobalObject::cast(global)->IsDetached()); |
| 9656 } |
| 9657 |
| 9658 |
| 9649 RUNTIME_FUNCTION(MaybeObject*, Runtime_ParseJson) { | 9659 RUNTIME_FUNCTION(MaybeObject*, Runtime_ParseJson) { |
| 9650 HandleScope scope(isolate); | 9660 HandleScope scope(isolate); |
| 9651 ASSERT_EQ(1, args.length()); | 9661 ASSERT_EQ(1, args.length()); |
| 9652 CONVERT_ARG_HANDLE_CHECKED(String, source, 0); | 9662 CONVERT_ARG_HANDLE_CHECKED(String, source, 0); |
| 9653 | 9663 |
| 9654 source = Handle<String>(FlattenGetString(source)); | 9664 source = Handle<String>(FlattenGetString(source)); |
| 9655 // Optimized fast case where we only have ASCII characters. | 9665 // Optimized fast case where we only have ASCII characters. |
| 9656 Handle<Object> result; | 9666 Handle<Object> result; |
| 9657 if (source->IsSeqOneByteString()) { | 9667 if (source->IsSeqOneByteString()) { |
| 9658 result = JsonParser<true>::Parse(source); | 9668 result = JsonParser<true>::Parse(source); |
| (...skipping 5256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14915 // Handle last resort GC and make sure to allow future allocations | 14925 // Handle last resort GC and make sure to allow future allocations |
| 14916 // to grow the heap without causing GCs (if possible). | 14926 // to grow the heap without causing GCs (if possible). |
| 14917 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14927 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 14918 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14928 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 14919 "Runtime::PerformGC"); | 14929 "Runtime::PerformGC"); |
| 14920 } | 14930 } |
| 14921 } | 14931 } |
| 14922 | 14932 |
| 14923 | 14933 |
| 14924 } } // namespace v8::internal | 14934 } } // namespace v8::internal |
| OLD | NEW |