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

Side by Side Diff: src/runtime.cc

Issue 464473002: Add "own" symbols support. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fixes for 64-bit builds Created 6 years, 4 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') | test/mjsunit/own-symbols.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdlib.h> 5 #include <stdlib.h>
6 #include <limits> 6 #include <limits>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 HandleScope scope(isolate); 601 HandleScope scope(isolate);
602 DCHECK(args.length() == 1); 602 DCHECK(args.length() == 1);
603 CONVERT_ARG_HANDLE_CHECKED(Object, name, 0); 603 CONVERT_ARG_HANDLE_CHECKED(Object, name, 0);
604 RUNTIME_ASSERT(name->IsString() || name->IsUndefined()); 604 RUNTIME_ASSERT(name->IsString() || name->IsUndefined());
605 Handle<Symbol> symbol = isolate->factory()->NewPrivateSymbol(); 605 Handle<Symbol> symbol = isolate->factory()->NewPrivateSymbol();
606 if (name->IsString()) symbol->set_name(*name); 606 if (name->IsString()) symbol->set_name(*name);
607 return *symbol; 607 return *symbol;
608 } 608 }
609 609
610 610
611 RUNTIME_FUNCTION(Runtime_CreatePrivateOwnSymbol) {
612 HandleScope scope(isolate);
613 DCHECK(args.length() == 1);
614 CONVERT_ARG_HANDLE_CHECKED(Object, name, 0);
615 RUNTIME_ASSERT(name->IsString() || name->IsUndefined());
616 Handle<Symbol> symbol = isolate->factory()->NewPrivateOwnSymbol();
617 if (name->IsString()) symbol->set_name(*name);
618 return *symbol;
619 }
620
621
611 RUNTIME_FUNCTION(Runtime_CreateGlobalPrivateSymbol) { 622 RUNTIME_FUNCTION(Runtime_CreateGlobalPrivateSymbol) {
612 HandleScope scope(isolate); 623 HandleScope scope(isolate);
613 DCHECK(args.length() == 1); 624 DCHECK(args.length() == 1);
614 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); 625 CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
615 Handle<JSObject> registry = isolate->GetSymbolRegistry(); 626 Handle<JSObject> registry = isolate->GetSymbolRegistry();
616 Handle<String> part = isolate->factory()->private_intern_string(); 627 Handle<String> part = isolate->factory()->private_intern_string();
617 Handle<Object> privates; 628 Handle<Object> privates;
618 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 629 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
619 isolate, privates, Object::GetPropertyOrElement(registry, part)); 630 isolate, privates, Object::GetPropertyOrElement(registry, part));
620 Handle<Object> symbol; 631 Handle<Object> symbol;
(...skipping 14998 matching lines...) Expand 10 before | Expand all | Expand 10 after
15619 } 15630 }
15620 return NULL; 15631 return NULL;
15621 } 15632 }
15622 15633
15623 15634
15624 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { 15635 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
15625 return &(kIntrinsicFunctions[static_cast<int>(id)]); 15636 return &(kIntrinsicFunctions[static_cast<int>(id)]);
15626 } 15637 }
15627 15638
15628 } } // namespace v8::internal 15639 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | test/mjsunit/own-symbols.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698