| 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 10610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11257 | 11264 |
| 11258 // Add the value being returned. | 11265 // Add the value being returned. |
| 11259 if (at_return) { | 11266 if (at_return) { |
| 11260 details->set(details_index++, *return_value); | 11267 details->set(details_index++, *return_value); |
| 11261 } | 11268 } |
| 11262 | 11269 |
| 11263 // Add the receiver (same as in function frame). | 11270 // Add the receiver (same as in function frame). |
| 11264 // THIS MUST BE DONE LAST SINCE WE MIGHT ADVANCE | 11271 // THIS MUST BE DONE LAST SINCE WE MIGHT ADVANCE |
| 11265 // THE FRAME ITERATOR TO WRAP THE RECEIVER. | 11272 // THE FRAME ITERATOR TO WRAP THE RECEIVER. |
| 11266 Handle<Object> receiver(it.frame()->receiver(), isolate); | 11273 Handle<Object> receiver(it.frame()->receiver(), isolate); |
| 11267 if (!receiver->IsJSObject() && | 11274 if (receiver->IsSymbol() || |
| 11268 shared->is_classic_mode() && | 11275 (!receiver->IsJSObject() && |
| 11269 !function->IsBuiltin()) { | 11276 shared->is_classic_mode() && |
| 11277 !function->IsBuiltin())) { |
| 11270 // If the receiver is not a JSObject and the function is not a | 11278 // If the receiver is not a JSObject and the function is not a |
| 11271 // builtin or strict-mode we have hit an optimization where a | 11279 // builtin or strict-mode we have hit an optimization where a |
| 11272 // value object is not converted into a wrapped JS objects. To | 11280 // value object is not converted into a wrapped JS objects. To |
| 11273 // hide this optimization from the debugger, we wrap the receiver | 11281 // hide this optimization from the debugger, we wrap the receiver |
| 11274 // by creating correct wrapper object based on the calling frame's | 11282 // by creating correct wrapper object based on the calling frame's |
| 11275 // native context. | 11283 // native context. |
| 11284 // Symbol receivers are always exempted as their (strict) builtins |
| 11285 // only work over the wrapped form. |
| 11276 it.Advance(); | 11286 it.Advance(); |
| 11277 if (receiver->IsUndefined()) { | 11287 if (receiver->IsUndefined()) { |
| 11278 Context* context = function->context(); | 11288 Context* context = function->context(); |
| 11279 receiver = handle(context->global_object()->global_receiver()); | 11289 receiver = handle(context->global_object()->global_receiver()); |
| 11280 } else { | 11290 } else { |
| 11281 ASSERT(!receiver->IsNull()); | 11291 ASSERT(!receiver->IsNull()); |
| 11282 Context* context = Context::cast(it.frame()->context()); | 11292 Context* context = Context::cast(it.frame()->context()); |
| 11283 Handle<Context> native_context(Context::cast(context->native_context())); | 11293 Handle<Context> native_context(Context::cast(context->native_context())); |
| 11284 receiver = isolate->factory()->ToObject(receiver, native_context); | 11294 receiver = isolate->factory()->ToObject(receiver, native_context); |
| 11285 } | 11295 } |
| (...skipping 3574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14860 // Handle last resort GC and make sure to allow future allocations | 14870 // Handle last resort GC and make sure to allow future allocations |
| 14861 // to grow the heap without causing GCs (if possible). | 14871 // to grow the heap without causing GCs (if possible). |
| 14862 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14872 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 14863 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14873 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 14864 "Runtime::PerformGC"); | 14874 "Runtime::PerformGC"); |
| 14865 } | 14875 } |
| 14866 } | 14876 } |
| 14867 | 14877 |
| 14868 | 14878 |
| 14869 } } // namespace v8::internal | 14879 } } // namespace v8::internal |
| OLD | NEW |