OLD | NEW |
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 Loading... |
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 | |
622 RUNTIME_FUNCTION(Runtime_CreateGlobalPrivateSymbol) { | 611 RUNTIME_FUNCTION(Runtime_CreateGlobalPrivateSymbol) { |
623 HandleScope scope(isolate); | 612 HandleScope scope(isolate); |
624 DCHECK(args.length() == 1); | 613 DCHECK(args.length() == 1); |
625 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); | 614 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); |
626 Handle<JSObject> registry = isolate->GetSymbolRegistry(); | 615 Handle<JSObject> registry = isolate->GetSymbolRegistry(); |
627 Handle<String> part = isolate->factory()->private_intern_string(); | 616 Handle<String> part = isolate->factory()->private_intern_string(); |
628 Handle<Object> privates; | 617 Handle<Object> privates; |
629 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 618 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
630 isolate, privates, Object::GetPropertyOrElement(registry, part)); | 619 isolate, privates, Object::GetPropertyOrElement(registry, part)); |
631 Handle<Object> symbol; | 620 Handle<Object> symbol; |
(...skipping 14998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15630 } | 15619 } |
15631 return NULL; | 15620 return NULL; |
15632 } | 15621 } |
15633 | 15622 |
15634 | 15623 |
15635 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15624 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
15636 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15625 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
15637 } | 15626 } |
15638 | 15627 |
15639 } } // namespace v8::internal | 15628 } } // namespace v8::internal |
OLD | NEW |