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

Side by Side Diff: src/runtime.cc

Issue 486763002: Make all global private symbols own symbols. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: HAS_DEFINED_PRIVATE is back 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') | src/string-iterator.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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 HandleScope scope(isolate); 612 HandleScope scope(isolate);
613 DCHECK(args.length() == 1); 613 DCHECK(args.length() == 1);
614 CONVERT_ARG_HANDLE_CHECKED(Object, name, 0); 614 CONVERT_ARG_HANDLE_CHECKED(Object, name, 0);
615 RUNTIME_ASSERT(name->IsString() || name->IsUndefined()); 615 RUNTIME_ASSERT(name->IsString() || name->IsUndefined());
616 Handle<Symbol> symbol = isolate->factory()->NewPrivateOwnSymbol(); 616 Handle<Symbol> symbol = isolate->factory()->NewPrivateOwnSymbol();
617 if (name->IsString()) symbol->set_name(*name); 617 if (name->IsString()) symbol->set_name(*name);
618 return *symbol; 618 return *symbol;
619 } 619 }
620 620
621 621
622 RUNTIME_FUNCTION(Runtime_CreateGlobalPrivateSymbol) { 622 RUNTIME_FUNCTION(Runtime_CreateGlobalPrivateOwnSymbol) {
623 HandleScope scope(isolate); 623 HandleScope scope(isolate);
624 DCHECK(args.length() == 1); 624 DCHECK(args.length() == 1);
625 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); 625 CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
626 Handle<JSObject> registry = isolate->GetSymbolRegistry(); 626 Handle<JSObject> registry = isolate->GetSymbolRegistry();
627 Handle<String> part = isolate->factory()->private_intern_string(); 627 Handle<String> part = isolate->factory()->private_intern_string();
628 Handle<Object> privates; 628 Handle<Object> privates;
629 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 629 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
630 isolate, privates, Object::GetPropertyOrElement(registry, part)); 630 isolate, privates, Object::GetPropertyOrElement(registry, part));
631 Handle<Object> symbol; 631 Handle<Object> symbol;
632 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 632 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
633 isolate, symbol, Object::GetPropertyOrElement(privates, name)); 633 isolate, symbol, Object::GetPropertyOrElement(privates, name));
634 if (!symbol->IsSymbol()) { 634 if (!symbol->IsSymbol()) {
635 DCHECK(symbol->IsUndefined()); 635 DCHECK(symbol->IsUndefined());
636 symbol = isolate->factory()->NewPrivateSymbol(); 636 symbol = isolate->factory()->NewPrivateSymbol();
637 Handle<Symbol>::cast(symbol)->set_name(*name); 637 Handle<Symbol>::cast(symbol)->set_name(*name);
638 Handle<Symbol>::cast(symbol)->set_is_own(true);
638 JSObject::SetProperty(Handle<JSObject>::cast(privates), name, symbol, 639 JSObject::SetProperty(Handle<JSObject>::cast(privates), name, symbol,
639 STRICT).Assert(); 640 STRICT).Assert();
640 } 641 }
641 return *symbol; 642 return *symbol;
642 } 643 }
643 644
644 645
645 RUNTIME_FUNCTION(Runtime_NewSymbolWrapper) { 646 RUNTIME_FUNCTION(Runtime_NewSymbolWrapper) {
646 HandleScope scope(isolate); 647 HandleScope scope(isolate);
647 DCHECK(args.length() == 1); 648 DCHECK(args.length() == 1);
(...skipping 14982 matching lines...) Expand 10 before | Expand all | Expand 10 after
15630 } 15631 }
15631 return NULL; 15632 return NULL;
15632 } 15633 }
15633 15634
15634 15635
15635 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { 15636 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
15636 return &(kIntrinsicFunctions[static_cast<int>(id)]); 15637 return &(kIntrinsicFunctions[static_cast<int>(id)]);
15637 } 15638 }
15638 15639
15639 } } // namespace v8::internal 15640 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | src/string-iterator.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698