| 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 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 Handle<Object> name(args[0], isolate); | 622 Handle<Object> name(args[0], isolate); |
| 623 RUNTIME_ASSERT(name->IsString() || name->IsUndefined()); | 623 RUNTIME_ASSERT(name->IsString() || name->IsUndefined()); |
| 624 Symbol* symbol; | 624 Symbol* symbol; |
| 625 MaybeObject* maybe = isolate->heap()->AllocatePrivateSymbol(); | 625 MaybeObject* maybe = isolate->heap()->AllocatePrivateSymbol(); |
| 626 if (!maybe->To(&symbol)) return maybe; | 626 if (!maybe->To(&symbol)) return maybe; |
| 627 if (name->IsString()) symbol->set_name(*name); | 627 if (name->IsString()) symbol->set_name(*name); |
| 628 return symbol; | 628 return symbol; |
| 629 } | 629 } |
| 630 | 630 |
| 631 | 631 |
| 632 RUNTIME_FUNCTION(MaybeObject*, Runtime_SymbolName) { | 632 RUNTIME_FUNCTION(MaybeObject*, Runtime_NewSymbolWrapper) { |
| 633 ASSERT(args.length() == 1); |
| 634 CONVERT_ARG_CHECKED(Symbol, symbol, 0); |
| 635 return symbol->ToObject(isolate); |
| 636 } |
| 637 |
| 638 |
| 639 RUNTIME_FUNCTION(MaybeObject*, Runtime_SymbolDescription) { |
| 633 SealHandleScope shs(isolate); | 640 SealHandleScope shs(isolate); |
| 634 ASSERT(args.length() == 1); | 641 ASSERT(args.length() == 1); |
| 635 CONVERT_ARG_CHECKED(Symbol, symbol, 0); | 642 CONVERT_ARG_CHECKED(Symbol, symbol, 0); |
| 636 return symbol->name(); | 643 return symbol->name(); |
| 637 } | 644 } |
| 638 | 645 |
| 639 | 646 |
| 640 RUNTIME_FUNCTION(MaybeObject*, Runtime_SymbolIsPrivate) { | 647 RUNTIME_FUNCTION(MaybeObject*, Runtime_SymbolIsPrivate) { |
| 641 SealHandleScope shs(isolate); | 648 SealHandleScope shs(isolate); |
| 642 ASSERT(args.length() == 1); | 649 ASSERT(args.length() == 1); |
| (...skipping 10683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11326 | 11333 |
| 11327 // Add the value being returned. | 11334 // Add the value being returned. |
| 11328 if (at_return) { | 11335 if (at_return) { |
| 11329 details->set(details_index++, *return_value); | 11336 details->set(details_index++, *return_value); |
| 11330 } | 11337 } |
| 11331 | 11338 |
| 11332 // Add the receiver (same as in function frame). | 11339 // Add the receiver (same as in function frame). |
| 11333 // THIS MUST BE DONE LAST SINCE WE MIGHT ADVANCE | 11340 // THIS MUST BE DONE LAST SINCE WE MIGHT ADVANCE |
| 11334 // THE FRAME ITERATOR TO WRAP THE RECEIVER. | 11341 // THE FRAME ITERATOR TO WRAP THE RECEIVER. |
| 11335 Handle<Object> receiver(it.frame()->receiver(), isolate); | 11342 Handle<Object> receiver(it.frame()->receiver(), isolate); |
| 11336 if (!receiver->IsJSObject() && | 11343 if (receiver->IsSymbol() || |
| 11337 shared->is_classic_mode() && | 11344 (!receiver->IsJSObject() && |
| 11338 !function->IsBuiltin()) { | 11345 shared->is_classic_mode() && |
| 11346 !function->IsBuiltin())) { |
| 11339 // If the receiver is not a JSObject and the function is not a | 11347 // If the receiver is not a JSObject and the function is not a |
| 11340 // builtin or strict-mode we have hit an optimization where a | 11348 // builtin or strict-mode we have hit an optimization where a |
| 11341 // value object is not converted into a wrapped JS objects. To | 11349 // value object is not converted into a wrapped JS objects. To |
| 11342 // hide this optimization from the debugger, we wrap the receiver | 11350 // hide this optimization from the debugger, we wrap the receiver |
| 11343 // by creating correct wrapper object based on the calling frame's | 11351 // by creating correct wrapper object based on the calling frame's |
| 11344 // native context. | 11352 // native context. |
| 11353 // Symbol receivers are always exempted as their (strict) builtins |
| 11354 // only work over the wrapped form. |
| 11345 it.Advance(); | 11355 it.Advance(); |
| 11346 Handle<Context> calling_frames_native_context( | 11356 Handle<Context> calling_frames_native_context( |
| 11347 Context::cast(Context::cast(it.frame()->context())->native_context())); | 11357 Context::cast(Context::cast(it.frame()->context())->native_context())); |
| 11348 ASSERT(!receiver->IsUndefined() && !receiver->IsNull()); | 11358 ASSERT(!receiver->IsUndefined() && !receiver->IsNull()); |
| 11349 receiver = | 11359 receiver = |
| 11350 isolate->factory()->ToObject(receiver, calling_frames_native_context); | 11360 isolate->factory()->ToObject(receiver, calling_frames_native_context); |
| 11351 } | 11361 } |
| 11352 details->set(kFrameDetailsReceiverIndex, *receiver); | 11362 details->set(kFrameDetailsReceiverIndex, *receiver); |
| 11353 | 11363 |
| 11354 ASSERT_EQ(details_size, details_index); | 11364 ASSERT_EQ(details_size, details_index); |
| (...skipping 3536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14891 // Handle last resort GC and make sure to allow future allocations | 14901 // Handle last resort GC and make sure to allow future allocations |
| 14892 // to grow the heap without causing GCs (if possible). | 14902 // to grow the heap without causing GCs (if possible). |
| 14893 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14903 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 14894 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14904 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 14895 "Runtime::PerformGC"); | 14905 "Runtime::PerformGC"); |
| 14896 } | 14906 } |
| 14897 } | 14907 } |
| 14898 | 14908 |
| 14899 | 14909 |
| 14900 } } // namespace v8::internal | 14910 } } // namespace v8::internal |
| OLD | NEW |