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 |
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 14984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15605 } | 15616 } |
15606 return NULL; | 15617 return NULL; |
15607 } | 15618 } |
15608 | 15619 |
15609 | 15620 |
15610 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15621 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
15611 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15622 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
15612 } | 15623 } |
15613 | 15624 |
15614 } } // namespace v8::internal | 15625 } } // namespace v8::internal |
OLD | NEW |