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

Side by Side Diff: src/builtins/builtins-symbol.cc

Issue 2903533002: Revert of [es2015] Precompute the descriptive string for symbols. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « src/builtins/arm64/builtins-arm64.cc ('k') | src/builtins/builtins-symbol-gen.cc » ('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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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 "src/builtins/builtins-utils.h" 5 #include "src/builtins/builtins-utils.h"
6 #include "src/builtins/builtins.h" 6 #include "src/builtins/builtins.h"
7 #include "src/counters.h" 7 #include "src/counters.h"
8 #include "src/objects-inl.h" 8 #include "src/objects-inl.h"
9 9
10 namespace v8 { 10 namespace v8 {
11 namespace internal { 11 namespace internal {
12 12
13 // ----------------------------------------------------------------------------- 13 // -----------------------------------------------------------------------------
14 // ES6 section 19.4 Symbol Objects 14 // ES6 section 19.4 Symbol Objects
15 15
16 // ES6 section 19.4.1.1 Symbol ( [ description ] ) for the [[Call]] case. 16 // ES6 section 19.4.1.1 Symbol ( [ description ] ) for the [[Call]] case.
17 BUILTIN(SymbolConstructor) { 17 BUILTIN(SymbolConstructor) {
18 HandleScope scope(isolate); 18 HandleScope scope(isolate);
19 Handle<Symbol> result = isolate->factory()->NewSymbol();
19 Handle<Object> description = args.atOrUndefined(isolate, 1); 20 Handle<Object> description = args.atOrUndefined(isolate, 1);
20 if (!description->IsUndefined(isolate)) { 21 if (!description->IsUndefined(isolate)) {
21 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, description, 22 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, description,
22 Object::ToString(isolate, description)); 23 Object::ToString(isolate, description));
24 result->set_name(*description);
23 } 25 }
24 RETURN_RESULT_OR_FAILURE(isolate, isolate->factory()->NewSymbol(description)); 26 return *result;
25 } 27 }
26 28
27 // ES6 section 19.4.1.1 Symbol ( [ description ] ) for the [[Construct]] case. 29 // ES6 section 19.4.1.1 Symbol ( [ description ] ) for the [[Construct]] case.
28 BUILTIN(SymbolConstructor_ConstructStub) { 30 BUILTIN(SymbolConstructor_ConstructStub) {
29 HandleScope scope(isolate); 31 HandleScope scope(isolate);
30 THROW_NEW_ERROR_RETURN_FAILURE( 32 THROW_NEW_ERROR_RETURN_FAILURE(
31 isolate, NewTypeError(MessageTemplate::kNotConstructor, 33 isolate, NewTypeError(MessageTemplate::kNotConstructor,
32 isolate->factory()->Symbol_string())); 34 isolate->factory()->Symbol_string()));
33 } 35 }
34 36
(...skipping 24 matching lines...) Expand all
59 } else { 61 } else {
60 result = isolate->heap()->undefined_value(); 62 result = isolate->heap()->undefined_value();
61 } 63 }
62 DCHECK_EQ(isolate->heap()->public_symbol_table()->SlowReverseLookup(*symbol), 64 DCHECK_EQ(isolate->heap()->public_symbol_table()->SlowReverseLookup(*symbol),
63 result); 65 result);
64 return result; 66 return result;
65 } 67 }
66 68
67 } // namespace internal 69 } // namespace internal
68 } // namespace v8 70 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins/arm64/builtins-arm64.cc ('k') | src/builtins/builtins-symbol-gen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698