Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/runtime.cc

Issue 12459026: ES6 symbols: implement name property (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/runtime.h ('k') | src/symbol.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 if (mode == TRACK_ALLOCATION_SITE) { 677 if (mode == TRACK_ALLOCATION_SITE) {
678 return isolate->heap()->CopyJSObjectWithAllocationSite(boilerplate_object); 678 return isolate->heap()->CopyJSObjectWithAllocationSite(boilerplate_object);
679 } 679 }
680 680
681 return isolate->heap()->CopyJSObject(boilerplate_object); 681 return isolate->heap()->CopyJSObject(boilerplate_object);
682 } 682 }
683 683
684 684
685 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateSymbol) { 685 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateSymbol) {
686 NoHandleAllocation ha(isolate); 686 NoHandleAllocation ha(isolate);
687 ASSERT(args.length() == 0); 687 ASSERT(args.length() == 1);
688 return isolate->heap()->AllocateSymbol(); 688 CONVERT_ARG_HANDLE_CHECKED(Object, name, 0);
689 RUNTIME_ASSERT(name->IsString() || name->IsUndefined());
690 Symbol* symbol;
691 MaybeObject* maybe = isolate->heap()->AllocateSymbol();
692 if (!maybe->To(&symbol)) return maybe;
693 if (name->IsString()) symbol->set_name(*name);
694 return symbol;
689 } 695 }
690 696
691 697
698 RUNTIME_FUNCTION(MaybeObject*, Runtime_SymbolName) {
699 NoHandleAllocation ha(isolate);
700 ASSERT(args.length() == 1);
701 CONVERT_ARG_CHECKED(Symbol, symbol, 0);
702 return symbol->name();
703 }
704
705
692 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateJSProxy) { 706 RUNTIME_FUNCTION(MaybeObject*, Runtime_CreateJSProxy) {
693 NoHandleAllocation ha(isolate); 707 NoHandleAllocation ha(isolate);
694 ASSERT(args.length() == 2); 708 ASSERT(args.length() == 2);
695 CONVERT_ARG_CHECKED(JSReceiver, handler, 0); 709 CONVERT_ARG_CHECKED(JSReceiver, handler, 0);
696 Object* prototype = args[1]; 710 Object* prototype = args[1];
697 Object* used_prototype = 711 Object* used_prototype =
698 prototype->IsJSReceiver() ? prototype : isolate->heap()->null_value(); 712 prototype->IsJSReceiver() ? prototype : isolate->heap()->null_value();
699 return isolate->heap()->AllocateJSProxy(handler, used_prototype); 713 return isolate->heap()->AllocateJSProxy(handler, used_prototype);
700 } 714 }
701 715
(...skipping 12286 matching lines...) Expand 10 before | Expand all | Expand 10 after
12988 // Handle last resort GC and make sure to allow future allocations 13002 // Handle last resort GC and make sure to allow future allocations
12989 // to grow the heap without causing GCs (if possible). 13003 // to grow the heap without causing GCs (if possible).
12990 isolate->counters()->gc_last_resort_from_js()->Increment(); 13004 isolate->counters()->gc_last_resort_from_js()->Increment();
12991 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13005 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
12992 "Runtime::PerformGC"); 13006 "Runtime::PerformGC");
12993 } 13007 }
12994 } 13008 }
12995 13009
12996 13010
12997 } } // namespace v8::internal 13011 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | src/symbol.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698