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 9606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9617 | 9617 |
9618 RUNTIME_FUNCTION(MaybeObject*, Runtime_GlobalReceiver) { | 9618 RUNTIME_FUNCTION(MaybeObject*, Runtime_GlobalReceiver) { |
9619 SealHandleScope shs(isolate); | 9619 SealHandleScope shs(isolate); |
9620 ASSERT(args.length() == 1); | 9620 ASSERT(args.length() == 1); |
9621 Object* global = args[0]; | 9621 Object* global = args[0]; |
9622 if (!global->IsJSGlobalObject()) return isolate->heap()->null_value(); | 9622 if (!global->IsJSGlobalObject()) return isolate->heap()->null_value(); |
9623 return JSGlobalObject::cast(global)->global_receiver(); | 9623 return JSGlobalObject::cast(global)->global_receiver(); |
9624 } | 9624 } |
9625 | 9625 |
9626 | 9626 |
| 9627 RUNTIME_FUNCTION(MaybeObject*, Runtime_IsAttachedGlobal) { |
| 9628 SealHandleScope shs(isolate); |
| 9629 ASSERT(args.length() == 1); |
| 9630 Object* global = args[0]; |
| 9631 if (!global->IsJSGlobalObject()) return isolate->heap()->false_value(); |
| 9632 return isolate->heap()->ToBoolean( |
| 9633 !JSGlobalObject::cast(global)->IsDetached()); |
| 9634 } |
| 9635 |
| 9636 |
9627 RUNTIME_FUNCTION(MaybeObject*, Runtime_ParseJson) { | 9637 RUNTIME_FUNCTION(MaybeObject*, Runtime_ParseJson) { |
9628 HandleScope scope(isolate); | 9638 HandleScope scope(isolate); |
9629 ASSERT_EQ(1, args.length()); | 9639 ASSERT_EQ(1, args.length()); |
9630 CONVERT_ARG_HANDLE_CHECKED(String, source, 0); | 9640 CONVERT_ARG_HANDLE_CHECKED(String, source, 0); |
9631 | 9641 |
9632 source = Handle<String>(FlattenGetString(source)); | 9642 source = Handle<String>(FlattenGetString(source)); |
9633 // Optimized fast case where we only have ASCII characters. | 9643 // Optimized fast case where we only have ASCII characters. |
9634 Handle<Object> result; | 9644 Handle<Object> result; |
9635 if (source->IsSeqOneByteString()) { | 9645 if (source->IsSeqOneByteString()) { |
9636 result = JsonParser<true>::Parse(source); | 9646 result = JsonParser<true>::Parse(source); |
(...skipping 5256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14893 // Handle last resort GC and make sure to allow future allocations | 14903 // Handle last resort GC and make sure to allow future allocations |
14894 // to grow the heap without causing GCs (if possible). | 14904 // to grow the heap without causing GCs (if possible). |
14895 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14905 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14896 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14906 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14897 "Runtime::PerformGC"); | 14907 "Runtime::PerformGC"); |
14898 } | 14908 } |
14899 } | 14909 } |
14900 | 14910 |
14901 | 14911 |
14902 } } // namespace v8::internal | 14912 } } // namespace v8::internal |
OLD | NEW |