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 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 Handle<Object> name(args[0], isolate); | 626 Handle<Object> name(args[0], isolate); |
627 RUNTIME_ASSERT(name->IsString() || name->IsUndefined()); | 627 RUNTIME_ASSERT(name->IsString() || name->IsUndefined()); |
628 Symbol* symbol; | 628 Symbol* symbol; |
629 MaybeObject* maybe = isolate->heap()->AllocatePrivateSymbol(); | 629 MaybeObject* maybe = isolate->heap()->AllocatePrivateSymbol(); |
630 if (!maybe->To(&symbol)) return maybe; | 630 if (!maybe->To(&symbol)) return maybe; |
631 if (name->IsString()) symbol->set_name(*name); | 631 if (name->IsString()) symbol->set_name(*name); |
632 return symbol; | 632 return symbol; |
633 } | 633 } |
634 | 634 |
635 | 635 |
636 RUNTIME_FUNCTION(MaybeObject*, Runtime_SymbolName) { | 636 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewSymbolWrapper) { |
| 637 ASSERT(args.length() == 1); |
| 638 CONVERT_ARG_CHECKED(Symbol, symbol, 0); |
| 639 return symbol->ToObject(isolate); |
| 640 } |
| 641 |
| 642 |
| 643 RUNTIME_FUNCTION(MaybeObject*, Runtime_SymbolDescription) { |
637 SealHandleScope shs(isolate); | 644 SealHandleScope shs(isolate); |
638 ASSERT(args.length() == 1); | 645 ASSERT(args.length() == 1); |
639 CONVERT_ARG_CHECKED(Symbol, symbol, 0); | 646 CONVERT_ARG_CHECKED(Symbol, symbol, 0); |
640 return symbol->name(); | 647 return symbol->name(); |
641 } | 648 } |
642 | 649 |
643 | 650 |
644 RUNTIME_FUNCTION(MaybeObject*, Runtime_SymbolIsPrivate) { | 651 RUNTIME_FUNCTION(MaybeObject*, Runtime_SymbolIsPrivate) { |
645 SealHandleScope shs(isolate); | 652 SealHandleScope shs(isolate); |
646 ASSERT(args.length() == 1); | 653 ASSERT(args.length() == 1); |
(...skipping 14213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14860 // Handle last resort GC and make sure to allow future allocations | 14867 // Handle last resort GC and make sure to allow future allocations |
14861 // to grow the heap without causing GCs (if possible). | 14868 // to grow the heap without causing GCs (if possible). |
14862 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14869 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14863 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14870 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14864 "Runtime::PerformGC"); | 14871 "Runtime::PerformGC"); |
14865 } | 14872 } |
14866 } | 14873 } |
14867 | 14874 |
14868 | 14875 |
14869 } } // namespace v8::internal | 14876 } } // namespace v8::internal |
OLD | NEW |